Add support for the Sepolia network (#3762)

This commit is contained in:
zah 2022-06-16 17:11:26 +03:00 committed by GitHub
parent ac7393b8ac
commit e8efc0f184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 5 deletions

View File

@ -27,6 +27,7 @@ BASE_REST_PORT := 5052
BASE_METRICS_PORT := 8008
ROPSTEN_WEB3_URL := "--web3-url=wss://ropsten.infura.io/ws/v3/809a18497dd74102b5f37d25aae3c85a"
SEPOLIA_WEB3_URL := "--web3-url=https://rpc.sepolia.dev --web3-url=https://www.sepoliarpc.space"
GOERLI_WEB3_URL := "--web3-url=wss://goerli.infura.io/ws/v3/809a18497dd74102b5f37d25aae3c85a"
GNOSIS_WEB3_URLS := "--web3-url=wss://rpc.gnosischain.com/wss --web3-url=wss://xdai.poanetwork.dev/wss"
@ -445,6 +446,35 @@ ropsten-dev-deposit: | ropsten-build deposit_contract
clean-ropsten:
$(call CLEAN_NETWORK,ropsten)
###
### Sepolia
###
sepolia-build: | nimbus_beacon_node nimbus_signing_node
# https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
sepolia: | sepolia-build
$(call CONNECT_TO_NETWORK,sepolia,nimbus_beacon_node,$(SEPOLIA_WEB3_URL))
sepolia-vc: | sepolia-build nimbus_validator_client
$(call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,sepolia,nimbus_beacon_node,$(SEPOLIA_WEB3_URL))
sepolia-lc: | nimbus_light_client
$(call CONNECT_TO_NETWORK_WITH_LIGHT_CLIENT,sepolia)
ifneq ($(LOG_LEVEL), TRACE)
sepolia-dev:
+ "$(MAKE)" LOG_LEVEL=TRACE $@
else
sepolia-dev: | sepolia-build
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,sepolia,nimbus_beacon_node,$(SEPOLIA_WEB3_URL))
endif
sepolia-dev-deposit: | sepolia-build deposit_contract
$(call MAKE_DEPOSIT,sepolia,$(SEPOLIA_WEB3_URL))
clean-sepolia:
$(call CLEAN_NETWORK,sepolia)
###
### Gnosis chain binary
###

View File

@ -1343,6 +1343,7 @@ proc startEth1Syncing(m: Eth1Monitor, delayBeforeStart: Duration) {.async.} =
of ropsten: "3"
of rinkeby: "4"
of goerli: "5"
of sepolia: "11155111"
if expectedNetwork != providerNetwork:
fatal "The specified web3 provider serves data for a different network",
expectedNetwork, providerNetwork

View File

@ -40,6 +40,7 @@ type
ropsten
rinkeby
goerli
sepolia
Eth2NetworkConfigDefaults* = object
## Network specific config defaults
@ -246,8 +247,9 @@ when not defined(gnosisChainBinary):
mainnetMetadata* = eth2Network("shared/mainnet", mainnet)
praterMetadata* = eth2Network("shared/prater", goerli)
ropstenMetadata = mergeTestnet("ropsten-beacon-chain", ropsten)
sepoliaMetadata = mergeTestnet("sepolia", sepolia)
static:
for network in [mainnetMetadata, praterMetadata, ropstenMetadata]:
for network in [mainnetMetadata, praterMetadata, ropstenMetadata, sepoliaMetadata]:
checkForkConsistency(network.cfg)
proc getMetadataForNetwork*(networkName: string): Eth2NetworkMetadata {.raises: [Defect, IOError].} =
@ -271,6 +273,8 @@ when not defined(gnosisChainBinary):
praterMetadata
of "ropsten":
ropstenMetadata
of "sepolia":
sepoliaMetadata
else:
loadRuntimeMetadata()
else:

View File

@ -175,6 +175,7 @@ when const_preset == "mainnet":
# * 'mainnet' - there can be only one
# * 'prater' - testnet
# * 'ropsten' - testnet
# * 'sepolia' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: "mainnet",
@ -276,6 +277,7 @@ elif const_preset == "minimal":
# * 'mainnet' - there can be only one
# * 'prater' - testnet
# * 'ropsten' - testnet
# * 'sepolia' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: "minimal",

View File

@ -178,7 +178,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`, `ropsten`, etc)
* `config-name` is the `CONFIG_NAME` field of the runtime configation (`mainnet`, `prater`, `ropsten`, `sepolia`, 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`

View File

@ -32,9 +32,9 @@ The following options are available:
Where:
- The `network` can either be `mainnet`, `prater` or `ropsten`
- The `network` can either be `mainnet`, `prater`, `ropsten` or `sepolia`
- The default location of the `db` is either `build/data/shared_mainnet_0/db`, `build/data/shared_prater_0/db` or `build/data/shared_ropsten_0/db`
- The default location of the `db` is `build/data/shared_mainnet_0/db` for `mainnet`, `build/data/shared_prater_0/db` for `prater`, etc.
Near the bottom, you should see

12
run-sepolia-beacon-node.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Copyright (c) 2022 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
# at your option. This file may not be copied, modified, or distributed except
# according to those terms.
cd "$(dirname $0)"
# Allow the binary to receive signals directly.
exec scripts/run-beacon-node.sh nimbus_beacon_node sepolia $@

@ -1 +1 @@
Subproject commit 525141dcd7a6ca9a9260a049f24fc7ad39a0768f
Subproject commit 2f0050ea2487d4d97da64cff256e1a05edcd63b1