From 670be33d7cc6213fc9330a8002b5735e66c38c8f Mon Sep 17 00:00:00 2001 From: Remy Roy <303593+remyroy@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:09:44 -0400 Subject: [PATCH 1/2] Adding Ephemery testnet with optional GENESIS_VALIDATORS_ROOT --- staking_deposit/credentials.py | 3 +++ staking_deposit/settings.py | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/staking_deposit/credentials.py b/staking_deposit/credentials.py index 3fcd1144..5073ca6e 100644 --- a/staking_deposit/credentials.py +++ b/staking_deposit/credentials.py @@ -164,6 +164,9 @@ def verify_keystore(self, keystore_filefolder: str, password: str) -> bool: def get_bls_to_execution_change(self, validator_index: int) -> SignedBLSToExecutionChange: if self.eth1_withdrawal_address is None: raise ValueError("The execution address should NOT be empty.") + if self.chain_setting.GENESIS_VALIDATORS_ROOT is None: + raise ValidationError("The genesis validators root should NOT be empty " + "for this chain to obtain the BLS to execution change.") message = BLSToExecutionChange( # type: ignore[no-untyped-call] validator_index=validator_index, diff --git a/staking_deposit/settings.py b/staking_deposit/settings.py index e989d89b..2cc2e345 100644 --- a/staking_deposit/settings.py +++ b/staking_deposit/settings.py @@ -1,4 +1,4 @@ -from typing import Dict, NamedTuple +from typing import Dict, NamedTuple, Optional from eth_utils import decode_hex DEPOSIT_CLI_VERSION = '2.7.0' @@ -7,7 +7,7 @@ class BaseChainSetting(NamedTuple): NETWORK_NAME: str GENESIS_FORK_VERSION: bytes - GENESIS_VALIDATORS_ROOT: bytes + GENESIS_VALIDATORS_ROOT: Optional[bytes] = None MAINNET = 'mainnet' @@ -16,6 +16,7 @@ class BaseChainSetting(NamedTuple): SEPOLIA = 'sepolia' ZHEJIANG = 'zhejiang' HOLESKY = 'holesky' +EPHEMERY = 'ephemery' # Mainnet setting MainnetSetting = BaseChainSetting( @@ -37,6 +38,14 @@ class BaseChainSetting(NamedTuple): HoleskySetting = BaseChainSetting( NETWORK_NAME=HOLESKY, GENESIS_FORK_VERSION=bytes.fromhex('01017000'), GENESIS_VALIDATORS_ROOT=bytes.fromhex('9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1')) +# Ephemery setting +# Upcoming EXIT_FORK_VERSION=bytes.fromhex('4000101b'), # for Ephemery +# From https://github.com/ephemery-testnet/ephemery-genesis/blob/master/values.env +# There is no builtin GENESIS_VALIDATORS_ROOT since the root changes with each reset. +# You can manually obtain the GENESIS_VALIDATORS_ROOT with each reset on +# https://github.com/ephemery-testnet/ephemery-genesis/releases +EphemerySetting = BaseChainSetting( + NETWORK_NAME=EPHEMERY, GENESIS_FORK_VERSION=bytes.fromhex('1000101b')) ALL_CHAINS: Dict[str, BaseChainSetting] = { @@ -46,6 +55,7 @@ class BaseChainSetting(NamedTuple): SEPOLIA: SepoliaSetting, ZHEJIANG: ZhejiangSetting, HOLESKY: HoleskySetting, + EPHEMERY: EphemerySetting, } From 2853868faf0e0a172d29840da9cfdaef0368b864 Mon Sep 17 00:00:00 2001 From: Remy Roy <303593+remyroy@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:14:04 -0400 Subject: [PATCH 2/2] Fix for flake8 styles --- staking_deposit/credentials.py | 2 +- staking_deposit/settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/staking_deposit/credentials.py b/staking_deposit/credentials.py index 5073ca6e..6d0fdc9c 100644 --- a/staking_deposit/credentials.py +++ b/staking_deposit/credentials.py @@ -166,7 +166,7 @@ def get_bls_to_execution_change(self, validator_index: int) -> SignedBLSToExecut raise ValueError("The execution address should NOT be empty.") if self.chain_setting.GENESIS_VALIDATORS_ROOT is None: raise ValidationError("The genesis validators root should NOT be empty " - "for this chain to obtain the BLS to execution change.") + "for this chain to obtain the BLS to execution change.") message = BLSToExecutionChange( # type: ignore[no-untyped-call] validator_index=validator_index, diff --git a/staking_deposit/settings.py b/staking_deposit/settings.py index 2cc2e345..d883a04c 100644 --- a/staking_deposit/settings.py +++ b/staking_deposit/settings.py @@ -42,7 +42,7 @@ class BaseChainSetting(NamedTuple): # Upcoming EXIT_FORK_VERSION=bytes.fromhex('4000101b'), # for Ephemery # From https://github.com/ephemery-testnet/ephemery-genesis/blob/master/values.env # There is no builtin GENESIS_VALIDATORS_ROOT since the root changes with each reset. -# You can manually obtain the GENESIS_VALIDATORS_ROOT with each reset on +# You can manually obtain the GENESIS_VALIDATORS_ROOT with each reset on # https://github.com/ephemery-testnet/ephemery-genesis/releases EphemerySetting = BaseChainSetting( NETWORK_NAME=EPHEMERY, GENESIS_FORK_VERSION=bytes.fromhex('1000101b'))