Skip to content

Commit

Permalink
Add metadata for the Holesky network
Browse files Browse the repository at this point in the history
  • Loading branch information
zah committed Aug 22, 2023
1 parent c08d125 commit dc4e564
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,8 @@
url = https://github.com/arnetheduck/nim-results.git
ignore = untracked
branch = master
[submodule "vendor/holesky"]
path = vendor/holesky
url = https://github.com/eth-clients/holesky
ignore = untracked
branch = main
5 changes: 3 additions & 2 deletions AllTests-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,11 @@ OK: 9/9 Fail: 0/9 Skip: 0/9
## Network metadata
```diff
+ goerli OK
+ holesky OK
+ mainnet OK
+ sepolia OK
```
OK: 3/3 Fail: 0/3 Skip: 0/3
OK: 4/4 Fail: 0/4 Skip: 0/4
## Nimbus remote signer/signing test (verifying-web3signer)
```diff
+ Signing BeaconBlock (getBlockSignature(bellatrix)) OK
Expand Down Expand Up @@ -700,4 +701,4 @@ OK: 2/2 Fail: 0/2 Skip: 0/2
OK: 9/9 Fail: 0/9 Skip: 0/9

---TOTAL---
OK: 393/398 Fail: 0/398 Skip: 5/398
OK: 394/399 Fail: 0/399 Skip: 5/399
1 change: 1 addition & 0 deletions beacon_chain/el/el_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,7 @@ proc exchangeConfigWithSingleEL(m: ELManager, connection: ELConnection) {.async.
of rinkeby: 4.Quantity
of goerli: 5.Quantity
of sepolia: 11155111.Quantity # https://chainid.network/
of holesky: 17000.Quantity
if expectedChain != providerChain:
warn "The specified EL client is connected to a different chain",
url = connection.engineUrl,
Expand Down
12 changes: 10 additions & 2 deletions beacon_chain/networking/network_metadata.nim
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type
rinkeby
goerli
sepolia
holesky

Eth2NetworkMetadata* = object
case incompatible*: bool
Expand Down Expand Up @@ -254,6 +255,9 @@ elif const_preset == "mainnet":
praterGenesis {.importc: "eth2_goerli_genesis".}: ptr UncheckedArray[byte]
praterGenesisSize {.importc: "eth2_goerli_genesis_size".}: int

holeskyGenesis {.importc: "eth2_holesky_genesis".}: ptr UncheckedArray[byte]
holeskyGenesisSize {.importc: "eth2_holesky_genesis_size".}: int

sepoliaGenesis {.importc: "eth2_sepolia_genesis".}: ptr UncheckedArray[byte]
sepoliaGenesisSize {.importc: "eth2_sepolia_genesis_size".}: int

Expand All @@ -266,14 +270,16 @@ elif const_preset == "mainnet":
vendorDir & "/eth2-networks/shared/mainnet", some mainnet, not incbinEnabled)
praterMetadata = loadCompileTimeNetworkMetadata(
vendorDir & "/eth2-networks/shared/prater", some goerli, not incbinEnabled)
holeskyMetadata = loadCompileTimeNetworkMetadata(
vendorDir & "/holesky/custom_config_data", some holesky, not incbinEnabled)
sepoliaMetadata = loadCompileTimeNetworkMetadata(
vendorDir & "/sepolia/bepolia", some sepolia, not incbinEnabled)

static:
for network in [mainnetMetadata, praterMetadata, sepoliaMetadata]:
for network in [mainnetMetadata, praterMetadata, sepoliaMetadata, holeskyMetadata]:
checkForkConsistency(network.cfg)

for network in [mainnetMetadata, praterMetadata, sepoliaMetadata]:
for network in [mainnetMetadata, praterMetadata, sepoliaMetadata, holeskyMetadata]:
doAssert network.cfg.ALTAIR_FORK_EPOCH < FAR_FUTURE_EPOCH
doAssert network.cfg.BELLATRIX_FORK_EPOCH < FAR_FUTURE_EPOCH
doAssert network.cfg.CAPELLA_FORK_EPOCH < FAR_FUTURE_EPOCH
Expand Down Expand Up @@ -327,6 +333,8 @@ proc getMetadataForNetwork*(
withGenesis(mainnetMetadata, mainnetGenesis)
of "prater", "goerli":
withGenesis(praterMetadata, praterGenesis)
of "holesky":
withGenesis(holeskyMetadata, holeskyGenesis)
of "sepolia":
withGenesis(sepoliaMetadata, sepoliaGenesis)
else:
Expand Down
13 changes: 13 additions & 0 deletions beacon_chain/networking/network_metadata_mainnet.S
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ eth2_goerli_genesis_end:
cdecl(eth2_goerli_genesis_size):
.quad eth2_goerli_genesis_end - eth2_goerli_genesis_data

eth2_holesky_genesis_data:
.incbin "holesky/custom_config_data/genesis.ssz"
eth2_holesky_genesis_end:
.global cdecl(eth2_holesky_genesis_size)
.p2align 3
cdecl(eth2_holesky_genesis_size):
.quad eth2_holesky_genesis_end - eth2_holesky_genesis_data

eth2_sepolia_genesis_data:
.incbin "sepolia/bepolia/genesis.ssz"
eth2_sepolia_genesis_end:
Expand All @@ -67,6 +75,11 @@ cdecl(eth2_mainnet_genesis):
cdecl(eth2_goerli_genesis):
.quad eth2_goerli_genesis_data

.global cdecl(eth2_holesky_genesis)
.p2align 3
cdecl(eth2_holesky_genesis):
.quad eth2_holesky_genesis_data

.global cdecl(eth2_sepolia_genesis)
.p2align 3
cdecl(eth2_sepolia_genesis):
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/rpc/rest_config_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
TERMINAL_BLOCK_HASH:
$cfg.TERMINAL_BLOCK_HASH,
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH:
Base10.toString(uint64(TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH)),
Base10.toString(uint64(cfg.TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH)),
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT:
Base10.toString(cfg.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT),
MIN_GENESIS_TIME:
Expand Down
3 changes: 0 additions & 3 deletions beacon_chain/spec/datatypes/constants.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ const
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.0/specs/deneb/beacon-chain.md#domain-types
DOMAIN_BLOB_SIDECAR* = DomainType([byte 0x0b, 0x00, 0x00, 0x00])

# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/bellatrix/beacon-chain.md#transition-settings
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH* = FAR_FUTURE_EPOCH

# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#configuration
PROPOSER_SCORE_BOOST*: uint64 = 40

Expand Down
9 changes: 6 additions & 3 deletions beacon_chain/spec/presets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ type
DEPOSIT_NETWORK_ID*: uint64
DEPOSIT_CONTRACT_ADDRESS*: Eth1Address

# Not actively used, but part of the spec
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH*: Epoch

PresetFile* = object
values*: Table[string, string]
missingValues*: seq[string]
Expand Down Expand Up @@ -118,6 +121,7 @@ when const_preset == "mainnet":
# * 'prater' - testnet
# * 'ropsten' - testnet
# * 'sepolia' - testnet
# * 'holesky' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: "",

Expand Down Expand Up @@ -221,6 +225,7 @@ elif const_preset == "gnosis":
# * 'prater' - testnet
# * 'ropsten' - testnet
# * 'sepolia' - testnet
# * 'holesky' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: "",

Expand Down Expand Up @@ -319,6 +324,7 @@ elif const_preset == "minimal":
# * 'prater' - testnet
# * 'ropsten' - testnet
# * 'sepolia' - testnet
# * 'holesky' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: "minimal",

Expand Down Expand Up @@ -586,9 +592,6 @@ proc readRuntimeConfig*(
checkCompatibility BLOB_SIDECAR_SUBNET_COUNT
checkCompatibility MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS

# Never pervasively implemented, still under discussion
checkCompatibility TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH

# Isn't being used as a preset in the usual way: at any time, there's one correct value
checkCompatibility PROPOSER_SCORE_BOOST

Expand Down
2 changes: 1 addition & 1 deletion docs/e2store.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Each era is identified by when it ends. Thus, the genesis era is era `0`, follow

`.era` file names follow a simple convention: `<config-name>-<era-number>-<era-count>-<short-historical-root>.era`:

* `config-name` is the `CONFIG_NAME` field of the runtime configation (`mainnet`, `prater`, `sepolia`, etc)
* `config-name` is the `CONFIG_NAME` field of the runtime configation (`mainnet`, `prater`, `sepolia`, `holesky`, etc)
* `era-number` is the number of the _first_ era stored in the file - for example, the genesis era file has number 0 - as a 5-digit 0-filled decimal integer
* `short-era-root` is the first 4 bytes of the last historical root in the _last_ state in the era file, lower-case hex-encoded (8 characters), except the genesis era which instead uses the `genesis_validators_root` field from the genesis state.
* The root is available as `state.historical_roots[era - 1]` except for genesis, which is `state.genesis_validators_root`
Expand Down
5 changes: 5 additions & 0 deletions tests/test_network_metadata.nim
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ suite "Network metadata":
checkRoot(
"sepolia",
"fb9afe32150fa39f4b346be2519a67e2a4f5efcd50a1dc192c3f6b3d013d2798")

test "holesky":
checkRoot(
"holesky",
"706eeb43c9e44932b312cd26b8d35ef69725f117275ef3dcd67653625b519f16")
1 change: 1 addition & 0 deletions vendor/holesky
Submodule holesky added at 36e4ff

0 comments on commit dc4e564

Please sign in to comment.