Add --trusted-setup-file command line option

This commit is contained in:
jangko 2023-10-01 21:00:32 +07:00
parent b7365085ae
commit e3041347fd
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 20 additions and 0 deletions

View File

@ -521,6 +521,12 @@ type
defaultValue: ""
name: "stateless-data-source-url" .}: string
trustedSetupFile* {.
desc: "Load EIP-4844 trusted setup file"
defaultValue: none(string)
defaultValueDesc: "Baked in trusted setup"
name: "trusted-setup-file" .}: Option[string]
of `import`:
blocksFile* {.

View File

@ -21,6 +21,8 @@ import
metrics/[chronos_httpserver, chronicles_support],
stew/shims/net as stewNet,
websock/websock as ws,
kzg4844/kzg_ex as kzg,
./core/eip4844,
"."/[config, constants, version, rpc, common],
./db/[core_db/persistent, select_backend],
./graphql/ethapi,
@ -426,6 +428,18 @@ proc start(nimbus: NimbusNode, conf: NimbusConf) =
let protocols = conf.getProtocolFlags()
if conf.trustedSetupFile.isSome:
let fileName = conf.trustedSetupFile.get()
let res = Kzg.loadTrustedSetup(fileName)
if res.isErr:
fatal "Cannot load Kzg trusted setup from file", msg=res.error
quit(QuitFailure)
else:
let res = loadKzgTrustedSetup()
if res.isErr:
fatal "Cannot load baked in Kzg trusted setup", msg=res.error
quit(QuitFailure)
case conf.cmd
of NimbusCmd.`import`:
importBlocks(conf, com)