Support for Gnosis Chain (#3415)

* Support for Gnosis Chain

`make gnosis-chain-build` will build the Nimbus gnosis chain binary,
stored in `build/nimbus_beacon_node_for_gnosis_chain`.

`make gnosis-chain` will connect to the network.

Other changes:

* Restore compilation with -d:has_genesis_detection
* Removed Makefile target related to testnet0 and testnet1
* Added more debug logging for failed peer handshakes
* Report misconfigured builds which try to embed network metadata
that is incompatible with the currently selected const preset.
* Don't bundle network metadata in minimal builds, as they are not compatible
This commit is contained in:
zah 2022-02-25 10:22:44 +02:00 committed by GitHub
parent ebba093362
commit c29aa9d846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 253 additions and 178 deletions

View File

@ -25,7 +25,10 @@ NODE_ID := 0
BASE_PORT := 9000
BASE_REST_PORT := 5052
BASE_METRICS_PORT := 8008
WEB3_URL := "wss://goerli.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"
VALIDATORS := 1
CPU_LIMIT := 0
BUILD_END_MSG := "\\x1B[92mBuild completed successfully:\\x1B[39m"
@ -77,10 +80,6 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
test \
clean_eth2_network_simulation_all \
eth2_network_simulation \
clean-testnet0 \
testnet0 \
clean-testnet1 \
testnet1 \
clean \
libbacktrace \
book \
@ -272,7 +271,6 @@ clean_eth2_network_simulation_all:
rm -rf tests/simulation/{data,validators}
GOERLI_TESTNETS_PARAMS := \
--web3-url=$(WEB3_URL) \
--tcp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
--udp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
--metrics \
@ -284,19 +282,6 @@ eth2_network_simulation: | build deps clean_eth2_network_simulation_all
+ GIT_ROOT="$$PWD" NIMFLAGS="$(NIMFLAGS)" LOG_LEVEL="$(LOG_LEVEL)" tests/simulation/start-in-tmux.sh
killall prometheus &>/dev/null
clean-testnet0:
rm -rf build/data/testnet0*
clean-testnet1:
rm -rf build/data/testnet1*
testnet0 testnet1: | nimbus_beacon_node
build/nimbus_beacon_node \
--network=$@ \
--log-level="$(RUNTIME_LOG_LEVEL)" \
--data-dir=build/data/$@_$(NODE_ID) \
$(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS)
#- https://www.gnu.org/software/make/manual/html_node/Multi_002dLine.html
#- macOS doesn't support "=" at the end of "define FOO": https://stackoverflow.com/questions/13260396/gnu-make-3-81-eval-function-not-working
define CONNECT_TO_NETWORK
@ -307,14 +292,12 @@ define CONNECT_TO_NETWORK
--base-metrics-port $$(($(BASE_METRICS_PORT) + $(NODE_ID))) \
--config-file "build/data/shared_$(1)_$(NODE_ID)/prometheus.yml"
[ "$(3)" == "FastSync" ] && { export CHECKPOINT_PARAMS="--finalized-checkpoint-state=vendor/eth2-networks/shared/$(1)/recent-finalized-state.ssz \
--finalized-checkpoint-block=vendor/eth2-network/shared/$(1)/recent-finalized-block.ssz" ; }; \
$(CPU_LIMIT_CMD) build/$(2) \
--network=$(1) \
--network=$(1) $(3) $(GOERLI_TESTNETS_PARAMS) \
--log-level="$(RUNTIME_LOG_LEVEL)" \
--log-file=build/data/shared_$(1)_$(NODE_ID)/nbc_bn_$$(date +"%Y%m%d%H%M%S").log \
--data-dir=build/data/shared_$(1)_$(NODE_ID) \
$$CHECKPOINT_PARAMS $(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS)
$(NODE_PARAMS)
endef
define CONNECT_TO_NETWORK_IN_DEV_MODE
@ -326,10 +309,10 @@ define CONNECT_TO_NETWORK_IN_DEV_MODE
--config-file "build/data/shared_$(1)_$(NODE_ID)/prometheus.yml"
$(CPU_LIMIT_CMD) build/$(2) \
--network=$(1) \
--network=$(1) $(3) $(GOERLI_TESTNETS_PARAMS) \
--log-level="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" \
--data-dir=build/data/shared_$(1)_$(NODE_ID) \
$(GOERLI_TESTNETS_PARAMS) --dump $(NODE_PARAMS)
--dump $(NODE_PARAMS)
endef
define CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT
@ -343,13 +326,13 @@ define CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT
--config-file "build/data/shared_$(1)_$(NODE_ID)/prometheus.yml"
$(CPU_LIMIT_CMD) build/$(2) \
--network=$(1) \
--network=$(1) $(3) $(GOERLI_TESTNETS_PARAMS) \
--log-level="$(RUNTIME_LOG_LEVEL)" \
--log-file=build/data/shared_$(1)_$(NODE_ID)/nbc_bn_$$(date +"%Y%m%d%H%M%S").log \
--data-dir=build/data/shared_$(1)_$(NODE_ID) \
--validators-dir=build/data/shared_$(1)_$(NODE_ID)/empty_dummy_folder \
--secrets-dir=build/data/shared_$(1)_$(NODE_ID)/empty_dummy_folder \
$(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS) &
$(NODE_PARAMS) &
sleep 4
@ -380,7 +363,7 @@ define MAKE_DEPOSIT
--count=$(VALIDATORS)
build/deposit_contract sendDeposits \
--web3-url=$(WEB3_URL) \
$(2) \
--deposit-contract=$$(cat vendor/eth2-network/shared/$(1)/deposit_contract.txt) \
--deposits-file=nbc-$(1)-deposits.json \
--min-delay=$(DEPOSITS_DELAY) \
@ -400,26 +383,25 @@ pyrmont-build: | nimbus_beacon_node nimbus_signing_node
# https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
pyrmont: | pyrmont-build
$(call CONNECT_TO_NETWORK,pyrmont,nimbus_beacon_node)
$(call CONNECT_TO_NETWORK,pyrmont,nimbus_beacon_node,$(GOERLI_WEB3_URL))
pyrmont-vc: | pyrmont-build nimbus_validator_client
$(call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,pyrmont,nimbus_beacon_node)
$(call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,pyrmont,nimbus_beacon_node,$(GOERLI_WEB3_URL))
ifneq ($(LOG_LEVEL), TRACE)
pyrmont-dev:
+ "$(MAKE)" LOG_LEVEL=TRACE $@
else
pyrmont-dev: | pyrmont-build
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,pyrmont,nimbus_beacon_node)
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,pyrmont,nimbus_beacon_node,$(GOERLI_WEB3_URL))
endif
pyrmont-dev-deposit: | pyrmont-build deposit_contract
$(call MAKE_DEPOSIT,pyrmont)
$(call MAKE_DEPOSIT,pyrmont,$(GOERLI_WEB3_URL))
clean-pyrmont:
$(call CLEAN_NETWORK,pyrmont)
###
### Prater
###
@ -427,25 +409,64 @@ prater-build: | nimbus_beacon_node nimbus_signing_node
# https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
prater: | prater-build
$(call CONNECT_TO_NETWORK,prater,nimbus_beacon_node)
$(call CONNECT_TO_NETWORK,prater,nimbus_beacon_node,$(GOERLI_WEB3_URL))
prater-vc: | prater-build nimbus_validator_client
$(call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,prater,nimbus_beacon_node)
$(call CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT,prater,nimbus_beacon_node,$(GOERLI_WEB3_URL))
ifneq ($(LOG_LEVEL), TRACE)
prater-dev:
+ "$(MAKE)" LOG_LEVEL=TRACE $@
else
prater-dev: | prater-build
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,prater,nimbus_beacon_node)
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,prater,nimbus_beacon_node,$(GOERLI_WEB3_URL))
endif
prater-dev-deposit: | prater-build deposit_contract
$(call MAKE_DEPOSIT,prater)
$(call MAKE_DEPOSIT,prater,$(GOERLI_WEB3_URL))
clean-prater:
$(call CLEAN_NETWORK,prater)
###
### Gnosis chain binary
###
# TODO The constants overrides below should not be necessary if we restrore
# the support for compiling with custom const presets.
# See the prepared preset file in media/gnosis-chain/preset.yaml
#
# The `-d:gnosisChainBinary` override can be removed if the web3 library
# gains support for multiple "Chain Profiles" that consist of a set of
# consensus object (such as blocks and transactions) that are specific
# to the chain.
gnosis-chain-build:
+ $(ENV_SCRIPT) nim $(NIM_PARAMS) \
-d:gnosisChainBinary \
-d:has_genesis_detection \
-d:SLOTS_PER_EPOCH=16 \
-d:SECONDS_PER_SLOT=5 \
-d:BASE_REWARD_FACTOR=25 \
-d:EPOCHS_PER_SYNC_COMMITTEE_PERIOD=512 \
-o:build/nimbus_beacon_node_gnosis c beacon_chain/nimbus_beacon_node.nim
gnosis-chain: | gnosis-chain-build
$(call CONNECT_TO_NETWORK,gnosis-chain,nimbus_beacon_node_gnosis,$(GNOSIS_WEB3_URLS))
ifneq ($(LOG_LEVEL), TRACE)
gnosis-chain-dev:
+ "$(MAKE)" LOG_LEVEL=TRACE $@
else
gnosis-chain-dev: | gnosis-chain-build
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,gnosis-chain,nimbus_beacon_node_gnosis,$(GNOSIS_WEB3_URLS))
endif
gnosis-chain-dev-deposit: | gnosis-chain-build deposit_contract
$(call MAKE_DEPOSIT,gnosis-chain,$(GNOSIS_WEB3_URLS))
clean-gnosis-chain:
$(call CLEAN_NETWORK,gnosis-chain)
###
### Other
###

View File

@ -982,13 +982,17 @@ template writeValue*(writer: var JsonWriter,
proc loadEth2Network*(config: BeaconNodeConf): Eth2NetworkMetadata {.raises: [Defect, IOError].} =
network_name.set(2, labelValues = [config.eth2Network.get(otherwise = "mainnet")])
if config.eth2Network.isSome:
getMetadataForNetwork(config.eth2Network.get)
else:
when const_preset == "mainnet":
mainnetMetadata
when not defined(gnosisChainBinary):
if config.eth2Network.isSome:
getMetadataForNetwork(config.eth2Network.get)
else:
# Presumably other configurations can have other defaults, but for now
# this simplifies the flow
echo "Must specify network on non-mainnet node"
quit 1
when const_preset == "mainnet":
mainnetMetadata
else:
# Presumably other configurations can have other defaults, but for now
# this simplifies the flow
echo "Must specify network on non-mainnet node"
quit 1
else:
checkNetworkParameterUse config.eth2Network
gnosisChainMetadata

View File

@ -1406,71 +1406,11 @@ proc testWeb3Provider*(web3Url: Uri,
echo "Deposit root: ", depositRoot
except CatchableError as err:
echo "Web3 provider is not archive mode: ", err.msg
when hasGenesisDetection:
proc init*(T: type Eth1Monitor,
cfg: RuntimeConfig,
db: BeaconChainDB,
web3Urls: seq[string],
depositContractDeployedAt: BlockHashOrNumber,
eth1Network: Option[Eth1Network],
forcePolling: bool): Future[Result[T, string]] {.async.} =
doAssert web3Urls.len > 0
try:
var urlIdx = 0
let dataProviderRes = await Web3DataProvider.new(cfg.DEPOSIT_CONTRACT_ADDRESS, web3Urls[urlIdx])
if dataProviderRes.isErr:
return err(dataProviderRes.error)
var dataProvider = dataProviderRes.get
let knownStartBlockHash =
if depositContractDeployedAt.isHash:
depositContractDeployedAt.hash
else:
var blk: BlockObject
while true:
try:
blk = awaitWithRetries(
dataProvider.getBlockByNumber(depositContractDeployedAt.number))
break
except CatchableError as err:
error "Failed to obtain details for the starting block " &
"of the deposit contract sync. The Web3 provider " &
"may still be not fully synced", error = err.msg
await sleepAsync(chronos.seconds(10))
# TODO: After a single failure, the web3 object may enter a state
# where it's no longer possible to make additional requests.
# Until this is fixed upstream, we'll just try to recreate
# the web3 provider before retrying. In case this fails,
# the Eth1Monitor will be restarted.
inc urlIdx
dataProvider = block:
let v = await Web3DataProvider.new(
cfg.DEPOSIT_CONTRACT_ADDRESS,
web3Urls[urlIdx mod web3Urls.len])
if v.isErr(): raise (ref CatchableError)(msg: v.error())
v.get()
blk.hash.asEth2Digest
let depositContractSnapshot = DepositContractSnapshot(
eth1Block: knownStartBlockHash)
var monitor = Eth1Monitor.init(
cfg,
db,
web3Urls,
depositContractSnapshot,
eth1Network,
forcePolling)
for i in 0 ..< db.genesisDeposits.len:
monitor.produceDerivedData db.genesisDeposits.get(i)
return ok monitor
except CatchableError as err:
return err("Failed to initialize the Eth1 monitor")
proc loadPersistedDeposits*(monitor: Eth1Monitor) =
for i in 0 ..< monitor.depositsChain.db.genesisDeposits.len:
monitor.produceDerivedData monitor.depositsChain.db.genesisDeposits.get(i)
proc findGenesisBlockInRange(m: Eth1Monitor, startBlock, endBlock: Eth1Block):
Future[Eth1Block] {.async.} =

View File

@ -28,19 +28,16 @@ proc parseBootstrapAddress*(address: TaintedString):
logScope:
address = string(address)
if address[0] == '/':
return err "MultiAddress bootstrap addresses are not supported"
let lowerCaseAddress = toLowerAscii(string address)
if lowerCaseAddress.startsWith("enr:"):
var enrRec: enr.Record
if enrRec.fromURI(string address):
return ok enrRec
return err "Invalid ENR bootstrap record"
elif lowerCaseAddress.startsWith("enode:"):
return err "ENode bootstrap addresses are not supported"
else:
let lowerCaseAddress = toLowerAscii(string address)
if lowerCaseAddress.startsWith("enr:"):
var enrRec: enr.Record
if enrRec.fromURI(string address):
return ok enrRec
return err "Invalid ENR bootstrap record"
elif lowerCaseAddress.startsWith("enode:"):
return err "ENode bootstrap addresses are not supported"
else:
return err "Ignoring unrecognized bootstrap address type"
return err "Ignoring unrecognized bootstrap address type"
iterator strippedLines(filename: string): string {.raises: [ref IOError].} =
for line in lines(filename):

View File

@ -149,12 +149,15 @@ proc readResponseChunk(conn: Connection, peer: Peer,
let responseCode = ResponseCode responseCodeByte
case responseCode:
of InvalidRequest, ServerError:
let errorMsgChunk = await readChunkPayload(conn, peer, ErrorMsg)
let errorMsg = if errorMsgChunk.isOk: errorMsgChunk.value
else: return err(errorMsgChunk.error)
let
errorMsgChunk = await readChunkPayload(conn, peer, ErrorMsg)
errorMsg = if errorMsgChunk.isOk: errorMsgChunk.value
else: return err(errorMsgChunk.error)
errorMsgStr = toPrettyString(errorMsg.asSeq)
debug "Error response from peer", responseCode, errMsg = errorMsgStr
return err Eth2NetworkingError(kind: ReceivedErrorResponse,
responseCode: responseCode,
errorMsg: toPrettyString(errorMsg.asSeq))
errorMsg: errorMsgStr)
of Success:
discard

View File

@ -95,7 +95,7 @@ proc readBootEnr*(path: string): seq[string] {.raises: [IOError, Defect].} =
else:
@[]
proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata
proc loadEth2NetworkMetadata*(path: string, eth1Network = none(Eth1Network)): Eth2NetworkMetadata
{.raises: [CatchableError, Defect].} =
# Load data in eth2-networks format
# https://github.com/eth2-clients/eth2-networks/
@ -108,7 +108,6 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata
depositContractBlockPath = path & "/deposit_contract_block.txt"
bootstrapNodesPath = path & "/bootstrap_nodes.txt"
bootEnrPath = path & "/boot_enr.yaml"
runtimeConfig = if fileExists(configPath):
let (cfg, unknowns) = readRuntimeConfig(configPath)
if unknowns.len > 0:
@ -125,7 +124,6 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata
readFile(depositContractBlockPath).strip
else:
""
depositContractDeployedAt = if depositContractBlock.len > 0:
BlockHashOrNumber.init(depositContractBlock)
else:
@ -147,8 +145,7 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata
Eth2NetworkMetadata(
incompatible: false,
eth1Network: some(
if "mainnet" in path: Eth1Network.mainnet else: Eth1Network.goerli),
eth1Network: eth1Network,
cfg: runtimeConfig,
bootstrapNodes: bootstrapNodes,
depositContractDeployedAt: depositContractDeployedAt,
@ -159,45 +156,80 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata
Eth2NetworkMetadata(incompatible: true,
incompatibilityDesc: err.msg)
template eth2Network(path: string): Eth2NetworkMetadata =
loadEth2NetworkMetadata(eth2NetworksDir & "/" & path)
proc loadCompileTimeNetworkMetadata(
path: string,
eth1Network = none(Eth1Network)): Eth2NetworkMetadata {.raises: [Defect].} =
try:
result = loadEth2NetworkMetadata(path, eth1Network)
if result.incompatible:
macros.error "The current build is miscondigured. " &
"Attempt to load an incompatible network metadata: " &
result.incompatibilityDesc
except CatchableError as err:
macros.error "Failed to load network metadata at '" & path & "': " & err.msg
const
mainnetMetadata* = eth2Network "shared/mainnet"
pyrmontMetadata* = eth2Network "shared/pyrmont"
praterMetadata* = eth2Network "shared/prater"
template eth2Network(path: string, eth1Network: Eth1Network): Eth2NetworkMetadata =
loadCompileTimeNetworkMetadata(eth2NetworksDir & "/" & path,
some eth1Network)
proc getMetadataForNetwork*(networkName: string): Eth2NetworkMetadata {.raises: [Defect, IOError].} =
var
metadata = case toLowerAscii(networkName)
of "mainnet":
mainnetMetadata
of "pyrmont":
pyrmontMetadata
of "prater":
praterMetadata
else:
if fileExists(networkName / "config.yaml"):
try:
loadEth2NetworkMetadata(networkName)
except CatchableError as exc:
fatal "Cannot load network", msg = exc.msg, networkName
quit 1
else:
fatal "config.yaml not found for network", networkName
when not defined(gnosisChainBinary):
when const_preset == "mainnet":
const
mainnetMetadata* = eth2Network("shared/mainnet", mainnet)
pyrmontMetadata* = eth2Network("shared/pyrmont", goerli)
praterMetadata* = eth2Network("shared/prater", goerli)
proc getMetadataForNetwork*(networkName: string): Eth2NetworkMetadata {.raises: [Defect, IOError].} =
template loadRuntimeMetadata: auto =
if fileExists(networkName / "config.yaml"):
try:
loadEth2NetworkMetadata(networkName)
except CatchableError as exc:
fatal "Cannot load network", msg = exc.msg, networkName
quit 1
else:
fatal "config.yaml not found for network", networkName
quit 1
if metadata.incompatible:
fatal "The selected network is not compatible with the current build",
reason = metadata.incompatibilityDesc
quit 1
metadata
var
metadata = when const_preset == "mainnet":
case toLowerAscii(networkName)
of "mainnet":
mainnetMetadata
of "pyrmont":
pyrmontMetadata
of "prater":
praterMetadata
else:
loadRuntimeMetadata()
else:
loadRuntimeMetadata()
proc getRuntimeConfig*(
eth2Network: Option[string]): RuntimeConfig {.raises: [Defect, IOError].} =
if eth2Network.isSome:
return getMetadataForNetwork(eth2Network.get).cfg
defaultRuntimeConfig
if metadata.incompatible:
fatal "The selected network is not compatible with the current build",
reason = metadata.incompatibilityDesc
quit 1
metadata
proc getRuntimeConfig*(
eth2Network: Option[string]): RuntimeConfig {.raises: [Defect, IOError].} =
if eth2Network.isSome:
return getMetadataForNetwork(eth2Network.get).cfg
defaultRuntimeConfig
else:
const
gnosisChainMetadata* = loadCompileTimeNetworkMetadata(
currentSourcePath.parentDir.replace('\\', '/') & "/../../media/gnosis-chain")
proc checkNetworkParameterUse*(eth2Network: Option[string]) =
if eth2Network.isSome and eth2Network.get != "gnosis-chain":
fatal "The only supported value for the --network parameter is 'gnosis-chain'"
quit 1
proc getRuntimeConfig*(eth2Network: Option[string]): RuntimeConfig {.raises: [Defect, IOError].} =
checkNetworkParameterUse eth2Network
gnosisChainMetadata.cfg
proc extractGenesisValidatorRootFromSnapshot*(
snapshot: string): Eth2Digest {.raises: [Defect, IOError, SszError].} =

View File

@ -234,7 +234,7 @@ proc init*(T: type BeaconNode,
# TODO Could move this to a separate "GenesisMonitor" process or task
# that would do only this - see Paul's proposal for this.
let eth1MonitorRes = waitFor Eth1Monitor.init(
let eth1Monitor = Eth1Monitor.init(
cfg,
db,
config.web3Urls,
@ -242,14 +242,7 @@ proc init*(T: type BeaconNode,
eth1Network,
config.web3ForcePolling)
if eth1MonitorRes.isErr:
fatal "Failed to start Eth1 monitor",
reason = eth1MonitorRes.error,
web3Urls = config.web3Urls,
depositContractDeployedAt
quit 1
else:
eth1Monitor = eth1MonitorRes.get
eth1Monitor.loadPersistedDeposits()
let phase0Genesis = waitFor eth1Monitor.waitGenesis()
genesisState = newClone ForkedHashedBeaconState.init(

View File

@ -16,7 +16,7 @@ const
# 2**9 (= 512)
SYNC_COMMITTEE_SIZE* = 512
# 2**8 (= 256)
EPOCHS_PER_SYNC_COMMITTEE_PERIOD*: uint64 = 256
EPOCHS_PER_SYNC_COMMITTEE_PERIOD* {.intdefine.}: uint64 = 256
# Sync protocol

View File

@ -70,7 +70,7 @@ const
# Reward and penalty quotients
# ---------------------------------------------------------------
# 2**6 (= 64)
BASE_REWARD_FACTOR*: uint64 = 64
BASE_REWARD_FACTOR* {.intdefine.}: uint64 = 64
# 2**9 (= 512)
WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 512
# 2**3 (= 8)

View File

@ -16,7 +16,7 @@ const
# customized
SYNC_COMMITTEE_SIZE* = 32
# customized
EPOCHS_PER_SYNC_COMMITTEE_PERIOD*: uint64 = 8
EPOCHS_PER_SYNC_COMMITTEE_PERIOD* {.intdefine.}: uint64 = 8
# Sync protocol

View File

@ -70,7 +70,7 @@ const
# Reward and penalty quotients
# ---------------------------------------------------------------
# 2**6 (= 64)
BASE_REWARD_FACTOR*: uint64 = 64
BASE_REWARD_FACTOR* {.intdefine.}: uint64 = 64
# 2**9 (= 512)
WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 512
# 2**3 (= 8)

View File

@ -0,0 +1,4 @@
- enr:-IS4QGmLwm7gFd0L0CEisllrb1op3v-wAGSc7_pwSMGgN3bOS9Fz7m1dWbwuuPHKqeETz9MbhjVuoWk0ohkyRv98kVoBgmlkgnY0gmlwhGjtlgaJc2VjcDI1NmsxoQLMdh0It9fJbuiLydZ9fpF6MRzgNle0vODaDiMqhbC7WIN1ZHCCIyg
- enr:-IS4QFUVG3dvLPCUEI7ycRvFm0Ieg_ITa5tALmJ9LI7dJ6ieT3J4fF9xLRjOoB4ApV-Rjp7HeLKzyTWG1xRdbFBNZPQBgmlkgnY0gmlwhErP5weJc2VjcDI1NmsxoQOBbaJBvx0-w_pyZUhQl9A510Ho2T0grE0K8JevzES99IN1ZHCCIyg
- enr:-Ku4QOQk8V-Hu2gxFzRXmLYIO4AvWDZhoMFwTf3n3DYm_mbsWv0ZitoqiN6JZUUj6Li6e1Jk1w2zFSVHKPMUP1g5tsgBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD5Jd3FAAAAZP__________gmlkgnY0gmlwhC1PTpmJc2VjcDI1NmsxoQL1Ynt5PoA0UOcHa1Rfn98rmnRlLzNuWTePPP4m4qHVroN1ZHCCKvg
- enr:-Ku4QFaTwgoms-EiiRIfHUH3FXprWUFgjHg4UuWvilqoUQtDbmTszVIxUEOwQUmA2qkiP-T9wXjc_rVUuh9cU7WgwbgBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD5Jd3FAAAAZP__________gmlkgnY0gmlwhC0hBmCJc2VjcDI1NmsxoQOpsg1XCrXmCwZKcSTcycLwldoKUMHPUpMEVGeg_EEhuYN1ZHCCKvg

View File

@ -0,0 +1,63 @@
# TODO:
# Re-implement the support for custom const presets and load the Gnosis
# const preset properly. Right now, we cannot set this because it will
# result in failures to load the config.
# PRESET_BASE: gnosis
PRESET_BASE: mainnet
CONFIG_NAME: gnosis
# Misc
# ---------------------------------------------------------------
# 2**2 (= 4)
MIN_PER_EPOCH_CHURN_LIMIT: 4
# 2**12 (= 4096)
CHURN_LIMIT_QUOTIENT: 4096
# `2**12` (= 4096)
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 4096
# Dec 08, 2021, 13:00 UTC
MIN_GENESIS_TIME: 1638968400
# Validator
# ---------------------------------------------------------------
# 2**10 (= 1024) ~1.4 hour
ETH1_FOLLOW_DISTANCE: 1024
# 6 (estimate from xDai mainnet)
SECONDS_PER_ETH1_BLOCK: 6
# Deposit contract
# ---------------------------------------------------------------
# xDai Mainnet
DEPOSIT_CHAIN_ID: 100
DEPOSIT_NETWORK_ID: 100
# GBC deposit contract on xDai Mainnet
DEPOSIT_CONTRACT_ADDRESS: 0x0B98057eA310F4d31F2a452B414647007d1645d9
# Gwei values
# ---------------------------------------------------------------
# 2**4 * 10**9 (= 16,000,000,000) Gwei
EJECTION_BALANCE: 16000000000
# Initial values
# ---------------------------------------------------------------
# GBC area code
GENESIS_FORK_VERSION: 0x00000064
# Time parameters
# ---------------------------------------------------------------
# Customized for GBC: ~1 hour
GENESIS_DELAY: 6000
# 5 seconds
SECONDS_PER_SLOT: 5
# 2**8 (= 256) epochs ~8 hours
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
# 2**8 (= 256) epochs ~8 hours
SHARD_COMMITTEE_PERIOD: 256
ALTAIR_FORK_VERSION: 0x01000064
ALTAIR_FORK_EPOCH: 512
INACTIVITY_SCORE_BIAS: 4
# 2**4 (= 16)
INACTIVITY_SCORE_RECOVERY_RATE: 16

View File

@ -0,0 +1 @@
19469077

View File

@ -0,0 +1,17 @@
PRESET_NAME: gnosis
PRESET_BASE: mainnet
# Time parameters
# ---------------------------------------------------------------
# 2**4 (= 16) slots 1.87 minutes
SLOTS_PER_EPOCH: 16
# Reward and penalty quotients
# ---------------------------------------------------------------
BASE_REWARD_FACTOR: 25
# Sync committee
# ---------------------------------------------------------------
# assert EPOCHS_PER_SYNC_COMMITTEE_PERIOD * SLOTS_PER_EPOCH <= SLOTS_PER_HISTORICAL_ROOT
EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 512