2020-05-23 16:19:41 +00:00
|
|
|
from typing import Dict, NamedTuple
|
|
|
|
|
|
|
|
|
|
|
|
class BaseChainSetting(NamedTuple):
|
|
|
|
GENESIS_FORK_VERSION: bytes
|
|
|
|
|
2020-06-25 03:42:03 +00:00
|
|
|
|
2020-07-27 15:52:00 +00:00
|
|
|
# Eth2 Mainnet setting
|
2020-06-25 03:23:00 +00:00
|
|
|
MainnetSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000000'))
|
2020-05-26 08:13:12 +00:00
|
|
|
# Eth2 spec v0.11.3 testnet
|
2020-06-25 03:23:00 +00:00
|
|
|
WittiSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000113'))
|
|
|
|
# Eth2 spec v0.12.1 testnet
|
|
|
|
AltonaSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000121'))
|
2020-07-23 08:01:15 +00:00
|
|
|
# Eth2 "official" public testnet (spec v0.12.2)
|
|
|
|
MedallaSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000001'))
|
2020-05-26 08:13:12 +00:00
|
|
|
|
2020-05-23 16:19:41 +00:00
|
|
|
MAINNET = 'mainnet'
|
2020-05-26 08:13:12 +00:00
|
|
|
WITTI = 'witti'
|
2020-06-25 03:23:00 +00:00
|
|
|
ALTONA = 'altona'
|
2020-07-23 08:01:15 +00:00
|
|
|
MEDALLA = 'medalla'
|
2020-05-23 16:19:41 +00:00
|
|
|
ALL_CHAINS: Dict[str, BaseChainSetting] = {
|
|
|
|
MAINNET: MainnetSetting,
|
2020-05-26 08:13:12 +00:00
|
|
|
WITTI: WittiSetting,
|
2020-06-25 03:23:00 +00:00
|
|
|
ALTONA: AltonaSetting,
|
2020-07-23 08:01:15 +00:00
|
|
|
MEDALLA: MedallaSetting,
|
2020-05-23 16:19:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def get_setting(chain_name: str = MAINNET) -> BaseChainSetting:
|
|
|
|
return ALL_CHAINS[chain_name]
|