update network list for msf11 and msf12 (#4034)

Tracks correct deployment phase for the latest mainnet shadow forks.
This commit is contained in:
Etan Kissling 2022-08-26 18:49:43 +02:00 committed by GitHub
parent 91a1b4e0c5
commit 4e90e9f52c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 2 deletions

View File

@ -86,7 +86,51 @@ type DeploymentPhase* {.pure.} = enum
Mainnet Mainnet
func deploymentPhase*(genesisData: string): DeploymentPhase = func deploymentPhase*(genesisData: string): DeploymentPhase =
DeploymentPhase.Devnet # SSZ processing at compile time does not work well.
#
# `BeaconState` layout:
# ```
# - genesis_time: uint64
# - genesis_validators_root: Eth2Digest
# - ...
# ```
#
# Comparing the first 40 bytes covers those two fields,
# which should identify the network with high likelihood.
# ''.join('%02X'%b for b in open("network_name/genesis.ssz", "rb").read()[:40])
if genesisData.len < 40:
return DeploymentPhase.None
const
mainnets = [
# Mainnet
"5730C65F000000004B363DB94E286120D76EB905340FDD4E54BFE9F06BF33FF6CF5AD27F511BFE95",
]
testnets = [
# Kiln
"0C572B620000000099B09FCD43E5905236C370F184056BEC6E6638CFC31A323B304FC4AA789CB4AD",
# Ropsten
"F0DB94620000000044F1E56283CA88B35C789F7F449E52339BC1FEFE3A45913A43A6D16EDCD33CF1",
# Sepolia
"607DB06200000000D8EA171F3C94AEA21EBC42A1ED61052ACF3F9209C00E4EFBAADDAC09ED9B8078",
# Goerli
"60F4596000000000043DB0D9A83813551EE2F33450D23797757D430911A9320530AD8A0EABC43EFB",
]
devnets = [
# Mainnet Shadow Fork 11
"FC95FB6200000000422F215805E0007A693FCA223DC4E42D392485698D45AFAFB962F50A8235789F",
# Mainnet Shadow Fork 12
"6CAB0C630000000096BBD4D72A6B5901B3E9402FF565C80D3A067D3C81A97BF65DE07129ADA6A821",
]
let data = (genesisData[0 ..< 40].toHex())
if data in mainnets:
return DeploymentPhase.Mainnet
if data in testnets:
return DeploymentPhase.Testnet
if data in devnets:
return DeploymentPhase.Devnet
DeploymentPhase.None
const const
eth2NetworksDir = currentSourcePath.parentDir.replace('\\', '/') & "/../../vendor/eth2-networks" eth2NetworksDir = currentSourcePath.parentDir.replace('\\', '/') & "/../../vendor/eth2-networks"

View File

@ -155,7 +155,7 @@ proc loadChainDag(
let let
extraFlags = extraFlags =
if shouldEnableTestFeatures: {enableTestFeatures} if shouldEnableTestFeatures: {enableTestFeatures}
else: {} else: {enableTestFeatures}
chainDagFlags = chainDagFlags =
if config.strictVerification: {strictVerification} if config.strictVerification: {strictVerification}
else: {} else: {}