Skip to content

Commit

Permalink
Merge pull request #22 from remyroy/add-ephemery-testnet
Browse files Browse the repository at this point in the history
Adding Ephemery testnet with optional GENESIS_VALIDATORS_ROOT
  • Loading branch information
valefar-on-discord authored Apr 27, 2024
2 parents 631465e + 2853868 commit 4f57639
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions staking_deposit/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 12 additions & 2 deletions staking_deposit/settings.py
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'
Expand All @@ -16,6 +16,7 @@ class BaseChainSetting(NamedTuple):
SEPOLIA = 'sepolia'
ZHEJIANG = 'zhejiang'
HOLESKY = 'holesky'
EPHEMERY = 'ephemery'

# Mainnet setting
MainnetSetting = BaseChainSetting(
Expand All @@ -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] = {
Expand All @@ -46,6 +55,7 @@ class BaseChainSetting(NamedTuple):
SEPOLIA: SepoliaSetting,
ZHEJIANG: ZhejiangSetting,
HOLESKY: HoleskySetting,
EPHEMERY: EphemerySetting,
}


Expand Down

0 comments on commit 4f57639

Please sign in to comment.