add ability to load KZG trusted setup via runtime flag (#5075)
This commit is contained in:
parent
927180f36f
commit
c27a65129b
|
@ -7,7 +7,6 @@
|
|||
|
||||
{.push raises: [].}
|
||||
|
||||
|
||||
import
|
||||
std/[strutils, os, options, unicode, uri],
|
||||
metrics,
|
||||
|
@ -605,6 +604,14 @@ type
|
|||
defaultValue: HistoryMode.Archive
|
||||
name: "history".}: HistoryMode
|
||||
|
||||
# https://notes.ethereum.org/@bbusa/dencun-devnet-6
|
||||
# "Please ensure that there is a way for us to specify the file through a
|
||||
# runtime flag such as --trusted-setup-file (or similar)."
|
||||
trustedSetupFile* {.
|
||||
hidden
|
||||
desc: "Experimental, debug option; could disappear at any time without warning"
|
||||
name: "temporary-debug-trusted-setup-file" .}: Option[string]
|
||||
|
||||
of BNStartUpCmd.wallets:
|
||||
case walletsCmd* {.command.}: WalletsCmd
|
||||
of WalletsCmd.create:
|
||||
|
@ -1374,3 +1381,9 @@ proc loadKzgTrustedSetup*(): Result[void, string] =
|
|||
Kzg.loadTrustedSetupFromString(trustedSetup)
|
||||
else:
|
||||
ok()
|
||||
|
||||
proc loadKzgTrustedSetup*(trustedSetupPath: string): Result[void, string] =
|
||||
try:
|
||||
Kzg.loadTrustedSetupFromString(readFile(trustedSetupPath))
|
||||
except IOError as err:
|
||||
err(err.msg)
|
||||
|
|
|
@ -1893,7 +1893,11 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai
|
|||
let node = BeaconNode.init(rng, config, metadata)
|
||||
|
||||
if node.dag.cfg.DENEB_FORK_EPOCH != FAR_FUTURE_EPOCH:
|
||||
let res = conf.loadKzgTrustedSetup()
|
||||
let res =
|
||||
if config.trustedSetupFile.isNone:
|
||||
conf.loadKzgTrustedSetup()
|
||||
else:
|
||||
conf.loadKzgTrustedSetup(config.trustedSetupFile.get)
|
||||
if res.isErr():
|
||||
raiseAssert res.error()
|
||||
|
||||
|
|
Loading…
Reference in New Issue