Add support for the Ropsten beacon chain (#3648)
This commit is contained in:
parent
68fb3962c8
commit
e7ce3cacd0
|
@ -223,3 +223,7 @@
|
|||
url = https://github.com/status-im/nim-toml-serialization.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/merge-testnets"]
|
||||
path = vendor/merge-testnets
|
||||
url = https://github.com/eth-clients/merge-testnets.git
|
||||
branch = main
|
||||
|
|
27
Makefile
27
Makefile
|
@ -26,6 +26,7 @@ BASE_PORT := 9000
|
|||
BASE_REST_PORT := 5052
|
||||
BASE_METRICS_PORT := 8008
|
||||
|
||||
ROPSTEN_WEB3_URL := "--web3-url=wss://ropsten.infura.io/ws/v3/809a18497dd74102b5f37d25aae3c85a"
|
||||
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"
|
||||
|
||||
|
@ -399,6 +400,32 @@ prater-dev-deposit: | prater-build deposit_contract
|
|||
clean-prater:
|
||||
$(call CLEAN_NETWORK,prater)
|
||||
|
||||
###
|
||||
### Ropsten
|
||||
###
|
||||
ropsten-build: | nimbus_beacon_node nimbus_signing_node
|
||||
|
||||
# https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
|
||||
ropsten: | ropsten-build
|
||||
$(call CONNECT_TO_NETWORK,ropsten,nimbus_beacon_node,$(ROPSTEN_WEB3_URL))
|
||||
|
||||
ropsten-vc: | ropsten-build nimbus_validator_client
|
||||
$(call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,ropsten,nimbus_beacon_node,$(ROPSTEN_WEB3_URL))
|
||||
|
||||
ifneq ($(LOG_LEVEL), TRACE)
|
||||
ropsten-dev:
|
||||
+ "$(MAKE)" LOG_LEVEL=TRACE $@
|
||||
else
|
||||
ropsten-dev: | ropsten-build
|
||||
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,ropsten,nimbus_beacon_node,$(ROPSTEN_WEB3_URL))
|
||||
endif
|
||||
|
||||
ropsten-dev-deposit: | ropsten-build deposit_contract
|
||||
$(call MAKE_DEPOSIT,ropsten,$(ROPSTEN_WEB3_URL))
|
||||
|
||||
clean-ropsten:
|
||||
$(call CLEAN_NETWORK,ropsten)
|
||||
|
||||
###
|
||||
### Gnosis chain binary
|
||||
###
|
||||
|
|
|
@ -1292,6 +1292,7 @@ proc startEth1Syncing(m: Eth1Monitor, delayBeforeStart: Duration) {.async.} =
|
|||
providerNetwork = awaitWithRetries m.dataProvider.web3.provider.net_version()
|
||||
expectedNetwork = case m.eth1Network.get
|
||||
of mainnet: "1"
|
||||
of ropsten: "3"
|
||||
of rinkeby: "4"
|
||||
of goerli: "5"
|
||||
if expectedNetwork != providerNetwork:
|
||||
|
|
|
@ -37,6 +37,7 @@ type
|
|||
|
||||
Eth1Network* = enum
|
||||
mainnet
|
||||
ropsten
|
||||
rinkeby
|
||||
goerli
|
||||
|
||||
|
@ -86,6 +87,7 @@ type
|
|||
|
||||
const
|
||||
eth2NetworksDir = currentSourcePath.parentDir.replace('\\', '/') & "/../../vendor/eth2-networks"
|
||||
mergeTestnetsDir = currentSourcePath.parentDir.replace('\\', '/') & "/../../vendor/merge-testnets"
|
||||
|
||||
proc readBootstrapNodes*(path: string): seq[string] {.raises: [IOError, Defect].} =
|
||||
# Read a list of ENR values from a YAML file containing a flat list of entries
|
||||
|
@ -115,6 +117,7 @@ proc loadEth2NetworkMetadata*(path: string, eth1Network = none(Eth1Network)): Et
|
|||
genesisPath = path & "/genesis.ssz"
|
||||
genesisDepositsSnapshotPath = path & "/genesis_deposit_contract_snapshot.ssz"
|
||||
configPath = path & "/config.yaml"
|
||||
deployBlockPath = path & "/deploy_block.txt"
|
||||
depositContractBlockPath = path & "/deposit_contract_block.txt"
|
||||
bootstrapNodesPath = path & "/bootstrap_nodes.txt"
|
||||
bootEnrPath = path & "/boot_enr.yaml"
|
||||
|
@ -134,8 +137,16 @@ proc loadEth2NetworkMetadata*(path: string, eth1Network = none(Eth1Network)): Et
|
|||
readFile(depositContractBlockPath).strip
|
||||
else:
|
||||
""
|
||||
|
||||
deployBlock = if fileExists(deployBlockPath):
|
||||
readFile(deployBlockPath).strip
|
||||
else:
|
||||
""
|
||||
|
||||
depositContractDeployedAt = if depositContractBlock.len > 0:
|
||||
BlockHashOrNumber.init(depositContractBlock)
|
||||
elif deployBlock.len > 0:
|
||||
BlockHashOrNumber.init(deployBlock)
|
||||
else:
|
||||
BlockHashOrNumber(isHash: false, number: 1)
|
||||
|
||||
|
@ -217,11 +228,16 @@ template eth2Network(path: string, eth1Network: Eth1Network): Eth2NetworkMetadat
|
|||
loadCompileTimeNetworkMetadata(eth2NetworksDir & "/" & path,
|
||||
some eth1Network)
|
||||
|
||||
template mergeTestnet(path: string, eth1Network: Eth1Network): Eth2NetworkMetadata =
|
||||
loadCompileTimeNetworkMetadata(mergeTestnetsDir & "/" & path,
|
||||
some eth1Network)
|
||||
|
||||
when not defined(gnosisChainBinary):
|
||||
when const_preset == "mainnet":
|
||||
const
|
||||
mainnetMetadata* = eth2Network("shared/mainnet", mainnet)
|
||||
praterMetadata* = eth2Network("shared/prater", goerli)
|
||||
ropstenMetadata = mergeTestnet("ropsten-beacon-chain", ropsten)
|
||||
|
||||
proc getMetadataForNetwork*(networkName: string): Eth2NetworkMetadata {.raises: [Defect, IOError].} =
|
||||
template loadRuntimeMetadata: auto =
|
||||
|
@ -242,6 +258,8 @@ when not defined(gnosisChainBinary):
|
|||
mainnetMetadata
|
||||
of "prater":
|
||||
praterMetadata
|
||||
of "ropsten":
|
||||
ropstenMetadata
|
||||
else:
|
||||
loadRuntimeMetadata()
|
||||
else:
|
||||
|
|
|
@ -429,7 +429,8 @@ proc init*(T: type BeaconNode,
|
|||
if snapshotRes.isErr:
|
||||
fatal "Failed to locate the deposit contract deployment block",
|
||||
depositContract = cfg.DEPOSIT_CONTRACT_ADDRESS,
|
||||
deploymentBlock = $depositContractDeployedAt
|
||||
deploymentBlock = $depositContractDeployedAt,
|
||||
err = snapshotRes.error
|
||||
quit 1
|
||||
else:
|
||||
some snapshotRes.get
|
||||
|
|
|
@ -169,6 +169,7 @@ when const_preset == "mainnet":
|
|||
# canonical network names include:
|
||||
# * 'mainnet' - there can be only one
|
||||
# * 'prater' - testnet
|
||||
# * 'ropsten' - testnet
|
||||
# Must match the regex: [a-z0-9\-]
|
||||
CONFIG_NAME: "mainnet",
|
||||
|
||||
|
@ -271,6 +272,7 @@ elif const_preset == "minimal":
|
|||
# canonical network names include:
|
||||
# * 'mainnet' - there can be only one
|
||||
# * 'prater' - testnet
|
||||
# * 'ropsten' - testnet
|
||||
# Must match the regex: [a-z0-9\-]
|
||||
CONFIG_NAME: "minimal",
|
||||
|
||||
|
|
|
@ -67,5 +67,5 @@ The `prater` testnet runs on
|
|||
|
||||
```bash
|
||||
# using a local Goerli instance
|
||||
WEB3_URL="ws://localhost:8545" ./run-mainnet-node.sh --max-peers=150
|
||||
WEB3_URL="ws://localhost:8545" ./run-prater-node.sh --max-peers=150
|
||||
```
|
||||
|
|
|
@ -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`, etc)
|
||||
* `config-name` is the `CONFIG_NAME` field of the runtime configation (`mainnet`, `prater`, `ropsten`, 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`
|
||||
|
|
|
@ -32,9 +32,9 @@ The following options are available:
|
|||
|
||||
Where:
|
||||
|
||||
- The `network` can either be `mainnet` or `prater`
|
||||
- The `network` can either be `mainnet`, `prater` or `ropsten`
|
||||
|
||||
- The default location of the `db` is either `build/data/shared_mainnet_0/db` or `build/data/shared_prater_0/db`
|
||||
- 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`
|
||||
|
||||
|
||||
Near the bottom, you should see
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2020-2021 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 ropsten $@
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 5b1b44aa912dd3433ba30d381345659c53918955
|
Loading…
Reference in New Issue