Skip to content

Commit

Permalink
Merge branch 'master' into keystores-refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cyc60 committed Dec 26, 2023
2 parents caf031d + 528fd73 commit 6cc2c45
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 54 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ RUN poetry install --only main
# `production` image used for runtime
FROM python-base as production

RUN apt-get update && apt-get upgrade -y; \
rm -rf /var/lib/apt/lists/*

USER nobody

# Copy dependencies from build container
Expand Down
8 changes: 4 additions & 4 deletions src/commands/tests/test_create_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def test_basic(
with open(f'{vault_dir}/deposit_data.json', encoding='utf-8') as f:
data = json.load(f)
assert count == len(data)
assert data[0].get('network_name') == 'goerli'
assert data[0].get('fork_version') == '00001020'
assert data[0].get('network_name') == 'holesky'
assert data[0].get('fork_version') == '01017000'
assert data[0].get('deposit_cli_version') == DEPOSIT_CLI_VERSION
with open(f'{vault_dir}/keystores/password.txt', encoding='utf-8') as f:
assert len(f.readline()) == 20
Expand Down Expand Up @@ -97,8 +97,8 @@ def test_per_keystore_password(
with open(f'{vault_dir}/deposit_data.json', encoding='utf-8') as f:
data = json.load(f)
assert count == len(data)
assert data[0].get('network_name') == 'goerli'
assert data[0].get('fork_version') == '00001020'
assert data[0].get('network_name') == 'holesky'
assert data[0].get('fork_version') == '01017000'
assert data[0].get('deposit_cli_version') == DEPOSIT_CLI_VERSION
password_files = glob.glob(os.path.join(keystores_dir / '*.txt'))
assert len(password_files) == count
Expand Down
6 changes: 3 additions & 3 deletions src/commands/tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_basic(self, mnemonic_mock, data_dir, runner: CliRunner):
'--vault',
vault,
'--network',
'goerli',
'holesky',
]
result = runner.invoke(init, args, input=f'\n{mnemonic}\n')
assert result.exit_code == 0
Expand All @@ -38,7 +38,7 @@ def test_bad_verify(self, mnemonic_mock, data_dir, runner: CliRunner):
'--vault',
vault,
'--network',
'goerli',
'holesky',
]
result = runner.invoke(init, args, input=f'\n{mnemonic} bad\n\n{mnemonic}\n')
assert result.exit_code == 0
Expand All @@ -57,7 +57,7 @@ def test_no_verify(self, mnemonic_mock, data_dir, runner: CliRunner):
'--vault',
vault,
'--network',
'goerli',
'holesky',
]
result = runner.invoke(init, args)
assert result.exit_code == 0
Expand Down
4 changes: 2 additions & 2 deletions src/commands/tests/test_remote_signer_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from src.commands.remote_signer_setup import remote_signer_setup
from src.common.typings import Oracles
from src.common.vault_config import VaultConfig
from src.config.networks import GOERLI
from src.config.networks import HOLESKY
from src.config.settings import settings
from src.validators.keystores.remote import RemoteSignerKeystore
from src.validators.signing.tests.oracle_functions import OracleCommittee
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_oracle_set_change(
vault_config = VaultConfig(vault=vault_address, data_dir=data_dir)
vault_config.load()
key_count = vault_config.mnemonic_next_index
vault_config.save(network=GOERLI, mnemonic=test_mnemonic, mnemonic_next_index=0)
vault_config.save(network=HOLESKY, mnemonic=test_mnemonic, mnemonic_next_index=0)

prev_key_share_count = key_count * prev_oracle_count
expected_new_key_share_count = key_count * (prev_oracle_count - 1)
Expand Down
40 changes: 1 addition & 39 deletions src/config/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
from web3.types import Wei

MAINNET = 'mainnet'
GOERLI = 'goerli'
GNOSIS = 'gnosis'
HOLESKY = 'holesky'

ETH_NETWORKS = [MAINNET, GOERLI, HOLESKY]
ETH_NETWORKS = [MAINNET, HOLESKY]
GNO_NETWORKS = [GNOSIS]


Expand Down Expand Up @@ -125,43 +124,6 @@ def IS_SUPPORT_V2_MIGRATION(self) -> bool:
'0xcA11bde05977b3631167028862bE2a173976CA11'
),
),
GOERLI: NetworkConfig(
SYMBOL='GoerliETH',
VALIDATORS_REGISTRY_CONTRACT_ADDRESS=Web3.to_checksum_address(
'0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b'
),
VALIDATORS_REGISTRY_GENESIS_BLOCK=BlockNumber(4367321),
KEEPER_CONTRACT_ADDRESS=Web3.to_checksum_address(
'0x893ceb1cF23475defE3747670EbE4b40e629c6fD'
),
KEEPER_GENESIS_BLOCK=BlockNumber(9583358),
V2_POOL_CONTRACT_ADDRESS=Web3.to_checksum_address(
'0x8c1EfEcFb5c4F1099AB0460b5659342943764Df7'
),
V2_POOL_GENESIS_BLOCK=BlockNumber(4468086),
V2_POOL_ESCROW_CONTRACT_ADDRESS=Web3.to_checksum_address(
'0x040F15C6b5Bfc5F324eCaB5864C38D4e1EEF4218'
),
GENESIS_VAULT_CONTRACT_ADDRESS=Web3.to_checksum_address(
'0x8B5c0d4c067Cf480766140B251B464de7F03B515'
),
GENESIS_VALIDATORS_ROOT=Bytes32(
Web3.to_bytes(
hexstr=HexStr('0x043db0d9a83813551ee2f33450d23797757d430911a9320530ad8a0eabc43efb')
)
),
GENESIS_VALIDATORS_IPFS_HASH='QmQo3oLYxqWm75fbgJJkCaUttZoYVqZhZj9r99r1UsZVpu',
SLOTS_PER_EPOCH=32,
SECONDS_PER_BLOCK=Decimal(12),
GENESIS_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x00001020')),
IS_POA=True,
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.03', 'ether'),
SHAPELLA_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x03001020')),
SHAPELLA_EPOCH=162304,
MULTICALL_CONTRACT_ADDRESS=Web3.to_checksum_address(
'0xcA11bde05977b3631167028862bE2a173976CA11'
),
),
GNOSIS: NetworkConfig(
SYMBOL='xDAI',
VALIDATORS_REGISTRY_CONTRACT_ADDRESS=Web3.to_checksum_address(
Expand Down
4 changes: 2 additions & 2 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from web3 import Web3
from web3.types import ChecksumAddress

from src.config.networks import GOERLI, HOLESKY, MAINNET, NETWORKS, NetworkConfig
from src.config.networks import HOLESKY, MAINNET, NETWORKS, NetworkConfig

DATA_DIR = Path.home() / '.stakewise'

Expand Down Expand Up @@ -192,7 +192,7 @@ def is_genesis_vault(self) -> bool:

settings = Settings()

AVAILABLE_NETWORKS = [MAINNET, GOERLI, HOLESKY]
AVAILABLE_NETWORKS = [MAINNET, HOLESKY]
DEFAULT_NETWORK = MAINNET

# oracles
Expand Down
8 changes: 4 additions & 4 deletions src/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from src.common.credentials import CredentialManager, ScryptKeystore
from src.common.typings import Oracles
from src.common.vault_config import VaultConfig
from src.config.networks import GOERLI
from src.config.networks import HOLESKY
from src.config.settings import settings
from src.test_fixtures.hashi_vault import hashi_vault_url, mocked_hashi_vault
from src.test_fixtures.remote_signer import mocked_remote_signer, remote_signer_url
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_mnemonic() -> str:
@pytest.fixture
def _init_vault(vault_address: HexAddress, data_dir: Path, test_mnemonic: str) -> None:
config = VaultConfig(vault=vault_address, data_dir=data_dir)
config.save(GOERLI, test_mnemonic)
config.save(HOLESKY, test_mnemonic)


@pytest.fixture
Expand Down Expand Up @@ -217,7 +217,7 @@ def fake_settings(
vault_dir=vault_dir,
consensus_endpoints=consensus_endpoints,
execution_endpoints=execution_endpoints,
network=GOERLI,
network=HOLESKY,
keystores_dir=str(keystores_dir),
database_dir=str(data_dir),
)
Expand Down Expand Up @@ -281,7 +281,7 @@ def create_validator_keypair(
def _generate_keypair_function() -> tuple[BLSPrivkey, HexStr]:
"""Returns a random validator keypair"""
credential = CredentialManager.generate_credential(
network=GOERLI,
network=HOLESKY,
vault=vault_address,
mnemonic=test_mnemonic,
index=randint(0, 100_000),
Expand Down

0 comments on commit 6cc2c45

Please sign in to comment.