Skip to content

Commit

Permalink
Add support for the Sepolia network (#3762)
Browse files Browse the repository at this point in the history
  • Loading branch information
zah authored Jun 16, 2022
1 parent ac7393b commit e8efc0f
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 5 deletions.
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
###
Expand Down
1 change: 1 addition & 0 deletions beacon_chain/eth1/eth1_monitor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion beacon_chain/networking/network_metadata.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type
ropsten
rinkeby
goerli
sepolia

Eth2NetworkConfigDefaults* = object
## Network specific config defaults
Expand Down Expand Up @@ -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].} =
Expand All @@ -271,6 +273,8 @@ when not defined(gnosisChainBinary):
praterMetadata
of "ropsten":
ropstenMetadata
of "sepolia":
sepoliaMetadata
else:
loadRuntimeMetadata()
else:
Expand Down
2 changes: 2 additions & 0 deletions beacon_chain/spec/presets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down Expand Up @@ -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",

Expand Down
2 changes: 1 addition & 1 deletion docs/e2store.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions docs/the_nimbus_book/src/attestation-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions run-sepolia-beacon-node.sh
Original file line number Diff line number Diff line change
@@ -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 $@
2 changes: 1 addition & 1 deletion vendor/merge-testnets

0 comments on commit e8efc0f

Please sign in to comment.