initialize KZG crypto before starting network (#5543)

Move KZG trusted setup initialization before `BeaconNode.init` to avoid
edge case where network message is received and processed before crypto
library has been properly initialized. Followup from #4870.
This commit is contained in:
Etan Kissling 2023-10-31 13:43:46 +01:00 committed by GitHub
parent 8c81515bf6
commit 173582ad70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -2066,9 +2066,7 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai
bnStatus = BeaconNodeStatus.Stopping
c_signal(ansi_c.SIGTERM, SIGTERMHandler)
let node = waitFor BeaconNode.init(rng, config, metadata)
if node.dag.cfg.DENEB_FORK_EPOCH != FAR_FUTURE_EPOCH:
if metadata.cfg.DENEB_FORK_EPOCH != FAR_FUTURE_EPOCH:
let res =
if config.trustedSetupFile.isNone:
conf.loadKzgTrustedSetup()
@ -2077,6 +2075,8 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai
if res.isErr():
raiseAssert res.error()
let node = waitFor BeaconNode.init(rng, config, metadata)
if bnStatus == BeaconNodeStatus.Stopping:
return