3737 ./ common/ chain_config,
3838 ./ db/ opts
3939
40- export net, defs, jsdefs, jsnet, nimbus_binary_common
40+ export net, defs, jsdefs, jsnet, nimbus_binary_common, options
4141
4242const NimbusCopyright * =
4343 " Copyright (c) 2018-" & compileYear & " Status Research & Development GmbH"
8080 V4
8181 V5
8282
83- NimbusConf * = object of RootObj
83+ ExecutionClientConf * = object
8484 # # Main Nimbus configuration object
8585 configFile {.
8686 separator : " ETHEREUM OPTIONS:"
@@ -553,11 +553,11 @@ func parseHexOrDec256(p: string): UInt256 {.raises: [ValueError].} =
553553 else :
554554 parse (p, UInt256 , 10 )
555555
556- proc dataDir * (config: NimbusConf ): string =
556+ proc dataDir * (config: ExecutionClientConf ): string =
557557 # TODO load network name from directory, when using custom network?
558558 string config.dataDirFlag.get (OutDir defaultDataDir (" " , config.networkId.name ()))
559559
560- proc keyStoreDir * (config: NimbusConf ): string =
560+ proc keyStoreDir * (config: ExecutionClientConf ): string =
561561 string config.keyStoreDirFlag.get (OutDir config.dataDir () / " keystore" )
562562
563563func parseCmdArg (T: type NetworkId , p: string ): T
@@ -624,19 +624,19 @@ proc parseNetworkParams(network: string): (NetworkParams, bool) =
624624 quit QuitFailure
625625 (params, true )
626626
627- proc processNetworkParamsAndNetworkId (conf : var NimbusConf ) =
628- if conf .network.len == 0 and conf .customNetwork.isNone:
627+ proc processNetworkParamsAndNetworkId (config : var ExecutionClientConf ) =
628+ if config .network.len == 0 and config .customNetwork.isNone:
629629 # Default value if none is set
630- conf .networkId = MainNet
631- conf .networkParams = networkParams (MainNet )
630+ config .networkId = MainNet
631+ config .networkParams = networkParams (MainNet )
632632 return
633633
634634 var
635635 params: Opt [NetworkParams ]
636636 id: Opt [NetworkId ]
637637 simulatedCustomNetwork = false
638638
639- for network in conf .network:
639+ for network in config .network:
640640 if decOrHex (network):
641641 if id.isSome:
642642 warn " Network ID already set, ignore new value" , id= network
@@ -650,15 +650,15 @@ proc processNetworkParamsAndNetworkId(conf: var NimbusConf) =
650650 params = Opt .some parsedParams
651651 # Simulate --custom-network while it is still not disabled.
652652 if custom:
653- conf .customNetwork = some parsedParams
653+ config .customNetwork = some parsedParams
654654 simulatedCustomNetwork = true
655655
656- if conf .customNetwork.isSome:
656+ if config .customNetwork.isSome:
657657 if params.isNone:
658658 warn " `--custom-network` is deprecated, please use `--network`"
659659 elif not simulatedCustomNetwork:
660660 warn " Network configuration already set by `--network`, `--custom-network` override it"
661- params = if conf .customNetwork.isSome: Opt .some conf .customNetwork.get
661+ params = if config .customNetwork.isSome: Opt .some config .customNetwork.get
662662 else : Opt .none (NetworkParams )
663663 if id.isNone:
664664 # WARNING: networkId and chainId are two distinct things
@@ -672,11 +672,11 @@ proc processNetworkParamsAndNetworkId(conf: var NimbusConf) =
672672 if id.isNone and params.isSome:
673673 id = Opt .some NetworkId (params.value.config.chainId)
674674
675- if conf .customNetwork.isNone and params.isNone:
675+ if config .customNetwork.isNone and params.isNone:
676676 params = Opt .some networkParams (id.value)
677677
678- conf .networkParams = params.expect (" Network params exists" )
679- conf .networkId = id.expect (" Network ID exists" )
678+ config .networkParams = params.expect (" Network params exists" )
679+ config .networkId = id.expect (" Network ID exists" )
680680
681681proc getRpcFlags (api: openArray [string ]): set [RpcFlag ] =
682682 if api.len == 0 :
@@ -691,11 +691,11 @@ proc getRpcFlags(api: openArray[string]): set[RpcFlag] =
691691 error " Unknown RPC API: " , name= item
692692 quit QuitFailure
693693
694- proc getRpcFlags * (conf: NimbusConf ): set [RpcFlag ] =
695- getRpcFlags (conf .rpcApi)
694+ proc getRpcFlags * (config: ExecutionClientConf ): set [RpcFlag ] =
695+ getRpcFlags (config .rpcApi)
696696
697- proc getWsFlags * (conf: NimbusConf ): set [RpcFlag ] =
698- getRpcFlags (conf .wsApi)
697+ proc getWsFlags * (config: ExecutionClientConf ): set [RpcFlag ] =
698+ getRpcFlags (config .wsApi)
699699
700700proc getDiscoveryFlags (api: openArray [string ]): set [DiscoveryType ] =
701701 if api.len == 0 :
@@ -711,73 +711,73 @@ proc getDiscoveryFlags(api: openArray[string]): set[DiscoveryType] =
711711 error " Unknown discovery type: " , name= item
712712 quit QuitFailure
713713
714- proc getDiscoveryFlags * (conf: NimbusConf ): set [DiscoveryType ] =
715- getDiscoveryFlags (conf .discovery)
714+ proc getDiscoveryFlags * (config: ExecutionClientConf ): set [DiscoveryType ] =
715+ getDiscoveryFlags (config .discovery)
716716
717- proc getBootstrapNodes * (conf: NimbusConf ): BootstrapNodes =
717+ proc getBootstrapNodes * (config: ExecutionClientConf ): BootstrapNodes =
718718 # Ignore standard bootnodes if customNetwork is loaded
719- if conf .customNetwork.isNone:
720- if conf .networkId == MainNet :
719+ if config .customNetwork.isNone:
720+ if config .networkId == MainNet :
721721 getBootstrapNodes (" mainnet" , result ).expect (" no error" )
722- elif conf .networkId == SepoliaNet :
722+ elif config .networkId == SepoliaNet :
723723 getBootstrapNodes (" sepolia" , result ).expect (" no error" )
724- elif conf .networkId == HoleskyNet :
724+ elif config .networkId == HoleskyNet :
725725 getBootstrapNodes (" holesky" , result ).expect (" no error" )
726- elif conf .networkId == HoodiNet :
726+ elif config .networkId == HoodiNet :
727727 getBootstrapNodes (" hoodi" , result ).expect (" no error" )
728728
729- let list = breakRepeatingList (conf .bootstrapNodes)
729+ let list = breakRepeatingList (config .bootstrapNodes)
730730 parseBootstrapNodes (list, result ).isOkOr:
731731 warn " Error when parsing bootstrap nodes" , msg= error
732732
733- if conf .bootstrapFile.string .len > 0 :
734- loadBootstrapNodes (conf .bootstrapFile.string , result ).isOkOr:
735- warn " Error when parsing bootstrap nodes from file" , msg= error, file= conf .bootstrapFile.string
733+ if config .bootstrapFile.string .len > 0 :
734+ loadBootstrapNodes (config .bootstrapFile.string , result ).isOkOr:
735+ warn " Error when parsing bootstrap nodes from file" , msg= error, file= config .bootstrapFile.string
736736
737- proc getStaticPeers * (conf: NimbusConf ): BootstrapNodes =
738- let list = breakRepeatingList (conf .staticPeers)
737+ proc getStaticPeers * (config: ExecutionClientConf ): BootstrapNodes =
738+ let list = breakRepeatingList (config .staticPeers)
739739 parseBootstrapNodes (list, result ).isOkOr:
740740 warn " Error when parsing static peers" , msg= error
741741
742- if conf .staticPeersFile.string .len > 0 :
743- loadBootstrapNodes (conf .staticPeersFile.string , result ).isOkOr:
744- warn " Error when parsing static peers from file" , msg= error, file= conf .staticPeersFile.string
742+ if config .staticPeersFile.string .len > 0 :
743+ loadBootstrapNodes (config .staticPeersFile.string , result ).isOkOr:
744+ warn " Error when parsing static peers from file" , msg= error, file= config .staticPeersFile.string
745745
746- func getAllowedOrigins * (conf: NimbusConf ): seq [Uri ] =
747- for item in repeatingList (conf .allowedOrigins):
746+ func getAllowedOrigins * (config: ExecutionClientConf ): seq [Uri ] =
747+ for item in repeatingList (config .allowedOrigins):
748748 result .add parseUri (item)
749749
750- func engineApiServerEnabled * (conf: NimbusConf ): bool =
751- conf .engineApiEnabled or conf .engineApiWsEnabled
750+ func engineApiServerEnabled * (config: ExecutionClientConf ): bool =
751+ config .engineApiEnabled or config .engineApiWsEnabled
752752
753- func shareServerWithEngineApi * (conf: NimbusConf ): bool =
754- conf .engineApiServerEnabled and
755- conf .engineApiPort == conf .httpPort
753+ func shareServerWithEngineApi * (config: ExecutionClientConf ): bool =
754+ config .engineApiServerEnabled and
755+ config .engineApiPort == config .httpPort
756756
757- func httpServerEnabled * (conf: NimbusConf ): bool =
758- conf .wsEnabled or conf .rpcEnabled
757+ func httpServerEnabled * (config: ExecutionClientConf ): bool =
758+ config .wsEnabled or config .rpcEnabled
759759
760- proc era1Dir * (conf: NimbusConf ): string =
761- string conf .era1DirFlag.get (OutDir conf .dataDir / " era1" )
760+ proc era1Dir * (config: ExecutionClientConf ): string =
761+ string config .era1DirFlag.get (OutDir config .dataDir / " era1" )
762762
763- proc eraDir * (conf: NimbusConf ): string =
764- string conf .eraDirFlag.get (OutDir conf .dataDir / " era" )
763+ proc eraDir * (config: ExecutionClientConf ): string =
764+ string config .eraDirFlag.get (OutDir config .dataDir / " era" )
765765
766- func dbOptions * (conf: NimbusConf , noKeyCache = false ): DbOptions =
766+ func dbOptions * (config: ExecutionClientConf , noKeyCache = false ): DbOptions =
767767 DbOptions .init (
768- maxOpenFiles = conf .rocksdbMaxOpenFiles,
769- writeBufferSize = conf .rocksdbWriteBufferSize,
770- rowCacheSize = conf .rocksdbRowCacheSize,
771- blockCacheSize = conf .rocksdbBlockCacheSize,
768+ maxOpenFiles = config .rocksdbMaxOpenFiles,
769+ writeBufferSize = config .rocksdbWriteBufferSize,
770+ rowCacheSize = config .rocksdbRowCacheSize,
771+ blockCacheSize = config .rocksdbBlockCacheSize,
772772 rdbKeyCacheSize =
773- if noKeyCache: 0 else : conf .rdbKeyCacheSize,
774- rdbVtxCacheSize = conf .rdbVtxCacheSize,
773+ if noKeyCache: 0 else : config .rdbKeyCacheSize,
774+ rdbVtxCacheSize = config .rdbVtxCacheSize,
775775 rdbBranchCacheSize =
776776 # The import command does not use the key cache - better give it to branch
777- if noKeyCache: conf .rdbKeyCacheSize + conf .rdbBranchCacheSize
778- else : conf .rdbBranchCacheSize,
777+ if noKeyCache: config .rdbKeyCacheSize + config .rdbBranchCacheSize
778+ else : config .rdbBranchCacheSize,
779779
780- rdbPrintStats = conf .rdbPrintStats,
780+ rdbPrintStats = config .rdbPrintStats,
781781 )
782782
783783{.pop .}
@@ -786,9 +786,11 @@ func dbOptions*(conf: NimbusConf, noKeyCache = false): DbOptions =
786786# Constructor
787787# -------------------------------------------------------------------
788788
789- proc makeConfig * (cmdLine = commandLineParams (), ignoreUnknown = false ): NimbusConf =
789+ proc makeConfig * (cmdLine = commandLineParams (), ignoreUnknown = false ): ExecutionClientConf =
790790 # # Note: this function is not gc-safe
791- result = NimbusConf .loadWithBanners (ClientId , NimbusCopyright , [], ignoreUnknown, cmdLine).valueOr:
791+ result = ExecutionClientConf .loadWithBanners (
792+ ClientId , NimbusCopyright , [], ignoreUnknown, cmdLine
793+ ).valueOr:
792794 writePanicLine error # Logging not yet set up
793795 quit QuitFailure
794796
0 commit comments