diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index da0f5bdfc1..1de2e6e12c 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -194,7 +194,7 @@ type name: "era-dir" .}: Option[InputDir] web3ForcePolling* {. - hidden + obsolete name: "web3-force-polling" .}: Option[bool] web3Urls* {. @@ -211,12 +211,12 @@ type name: "no-el" .}: bool optimistic* {. - hidden # deprecated > 22.12 + obsolete # deprecated > 22.12 desc: "Run the node in optimistic mode, allowing it to optimistically sync without an execution client (flag deprecated, always on)" name: "optimistic".}: Option[bool] requireEngineAPI* {. - hidden # Deprecated > 22.9 + obsolete # Deprecated > 22.9 desc: "Require Nimbus to be configured with an Engine API end-point after the Bellatrix fork epoch" name: "require-engine-api-in-bellatrix" .}: Option[bool] @@ -370,11 +370,11 @@ type name: "genesis-state-url" .}: Option[Uri] finalizedDepositTreeSnapshot* {. - hidden + obsolete name: "finalized-deposit-tree-snapshot" .}: Option[InputFile] finalizedCheckpointBlock* {. - hidden + obsolete desc: "SSZ file specifying a recent finalized block" name: "finalized-checkpoint-block" .}: Option[InputFile] @@ -562,7 +562,7 @@ type name: "debug-long-range-sync".}: LongRangeSyncMode inProcessValidators* {. - hidden + obsolete desc: "Deprecated for removal" name: "in-process-validators" .}: Option[bool] @@ -619,7 +619,7 @@ type name: "sync-horizon" .}: Option[uint64] terminalTotalDifficultyOverride* {. - hidden + obsolete desc: "Deprecated for removal" name: "terminal-total-difficulty-override" .}: Option[string] @@ -638,13 +638,13 @@ type name: "validator-monitor-details" .}: bool validatorMonitorTotals* {. - hidden + obsolete: "Use --validator-monitor-details instead" desc: "Deprecated in favour of --validator-monitor-details" name: "validator-monitor-totals" .}: Option[bool] safeSlotsToImportOptimistically* {. # Never unhidden or documented, and deprecated > 22.9.1 - hidden + obsolete desc: "Deprecated for removal" name: "safe-slots-to-import-optimistically" .}: Option[uint16] diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 14fb6e6f08..0018d425c7 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -2862,20 +2862,6 @@ proc doRunBeaconNode( if config.rpcEnabled.isSome: warn "Nimbus's JSON-RPC server has been removed. This includes the --rpc, --rpc-port, and --rpc-address configuration options. https://nimbus.guide/rest-api.html shows how to enable and configure the REST Beacon API server which replaces it." - template ignoreDeprecatedOption(option: untyped): untyped = - if config.option.isSome: - warn "Ignoring deprecated configuration option", option = config.option.get - - ignoreDeprecatedOption requireEngineAPI - ignoreDeprecatedOption safeSlotsToImportOptimistically - ignoreDeprecatedOption terminalTotalDifficultyOverride - ignoreDeprecatedOption optimistic - ignoreDeprecatedOption validatorMonitorTotals - ignoreDeprecatedOption web3ForcePolling - ignoreDeprecatedOption finalizedDepositTreeSnapshot - ignoreDeprecatedOption finalizedCheckpointBlock - ignoreDeprecatedOption inProcessValidators - # Trusted setup is needed for Cancun+ blocks and is shared between threads, # so it needs to be initalized from the main thread before anything else tries # to use it @@ -3040,11 +3026,12 @@ proc main*() {.noinline, raises: [CatchableError].} = const copyright = "Copyright (c) 2019-" & compileYear & " Status Research & Development GmbH" - var config = BeaconNodeConf.loadWithBanners(clientId, copyright, [specBanner]).valueOr: + var config = BeaconNodeConf.loadWithBanners( + clientId, copyright, [specBanner], setupLogger = true + ).valueOr: writePanicLine error # Logging not yet set up quit QuitFailure - setupLogging(config.logLevel, config.logStdout, config.logFile) setupFileLimits() if not (checkAndCreateDataDir(string(config.dataDir))): diff --git a/beacon_chain/nimbus_binary_common.nim b/beacon_chain/nimbus_binary_common.nim index 03fbe13edc..0e2e591dec 100644 --- a/beacon_chain/nimbus_binary_common.nim +++ b/beacon_chain/nimbus_binary_common.nim @@ -192,12 +192,23 @@ proc setupTaskpool*(numThreads: int): Taskpool = taskpool +proc obsoleteCmdOpt*(ConfType: type object, opt, msg: string) = + if msg.len == 0: + warn "Ignoring deprecated configuration option", opt + else: + warn "Ignoring deprecated configuration option", opt, msg + +template loggerSetup(ConfType: type): untyped = + proc (config: ConfType) {.raises: [], gcsafe.} = + setupLogging(config.logLevel, config.logStdout, config.logFile) + proc loadWithBanners*( ConfType: type, helpBanner, copyright: string, versions: openArray[string], ignoreUnknown = false, environment: openArray[string] = [], + setupLogger = false ): Result[ConfType, string] = let version = @@ -227,6 +238,7 @@ proc loadWithBanners*( if config.configFile.isSome: sources.addConfigFile(Toml, config.configFile.get) , + loggerSetup = if setupLogger: loggerSetup(ConfType) else: nil ) except CatchableError as exc: # Logging not configured yet! diff --git a/beacon_chain/nimbus_light_client.nim b/beacon_chain/nimbus_light_client.nim index 5063609b45..77da00e7a4 100644 --- a/beacon_chain/nimbus_light_client.nim +++ b/beacon_chain/nimbus_light_client.nim @@ -32,12 +32,12 @@ proc main() {.noinline, raises: [CatchableError].} = copyright = "Copyright (c) 2022-" & compileYear & " Status Research & Development GmbH" - var config = LightClientConf.loadWithBanners(banner, copyright, [specBanner]).valueOr: + var config = LightClientConf.loadWithBanners( + banner, copyright, [specBanner], setupLogger = true + ).valueOr: writePanicLine error # Logging not yet set up quit QuitFailure - setupLogging(config.logLevel, config.logStdout, config.logFile) - notice "Launching light client", version = fullVersionStr, cmdParams = commandLineParams(), config diff --git a/beacon_chain/nimbus_signing_node.nim b/beacon_chain/nimbus_signing_node.nim index 56a7a2b005..047fd34d19 100644 --- a/beacon_chain/nimbus_signing_node.nim +++ b/beacon_chain/nimbus_signing_node.nim @@ -500,12 +500,12 @@ proc main() {.noinline, raises: [CatchableError].} = copyright = "Copyright (c) 2021-" & compileYear & " Status Research & Development GmbH" - let config = SigningNodeConf.loadWithBanners(banner, copyright, [specBanner]).valueOr: + let config = SigningNodeConf.loadWithBanners( + banner, copyright, [specBanner], setupLogger = true + ).valueOr: writePanicLine error # Logging not yet set up quit QuitFailure - setupLogging(config.logLevel, config.logStdout, config.logFile) - waitFor runSigningNode(config) when isMainModule: diff --git a/beacon_chain/nimbus_validator_client.nim b/beacon_chain/nimbus_validator_client.nim index 2560bca318..9c447607a8 100644 --- a/beacon_chain/nimbus_validator_client.nim +++ b/beacon_chain/nimbus_validator_client.nim @@ -646,7 +646,9 @@ proc main() {.noinline, raises: [CatchableError].} = "Copyright (c) 2020-" & compileYear & " Status Research & Development GmbH" let - config = ValidatorClientConf.loadWithBanners(banner, copyright, [specBanner]).valueOr: + config = ValidatorClientConf.loadWithBanners( + banner, copyright, [specBanner], setupLogger = true + ).valueOr: writePanicLine error # Logging not yet set up quit QuitFailure @@ -654,7 +656,6 @@ proc main() {.noinline, raises: [CatchableError].} = # and avoid using system resources (such as urandom) after that rng = HmacDrbgContext.new() - setupLogging(config.logLevel, config.logStdout, config.logFile) setupFileLimits() waitFor runValidatorClient(config, rng) diff --git a/beacon_chain/winservice.nim b/beacon_chain/winservice.nim index 4ecba30773..64b43fcc4f 100644 --- a/beacon_chain/winservice.nim +++ b/beacon_chain/winservice.nim @@ -148,13 +148,13 @@ when defined(windows): reportServiceStatus(SERVICE_STOPPED, ERROR_INVALID_PARAMETER, 0) quit QuitFailure - var config = loadWithBanners(argConfigType, argHelpBanner, argCopyright, - argVersions, false, environment).valueOr: + var config = loadWithBanners( + argConfigType, argHelpBanner, argCopyright, + argVersions, false, environment, setupLogger = true + ).valueOr: reportServiceStatus(SERVICE_STOPPED, ERROR_BAD_CONFIGURATION, 0) quit QuitFailure - setupLogging(config.logLevel, config.logStdout, config.logFile) - try: argEntryPoint(config) info "Service thread stopped" diff --git a/docs/the_nimbus_book/src/options.md b/docs/the_nimbus_book/src/options.md index 2bb9b6a626..ed5cbfe85f 100644 --- a/docs/the_nimbus_book/src/options.md +++ b/docs/the_nimbus_book/src/options.md @@ -26,6 +26,8 @@ nimbus_beacon_node [OPTIONS]... command The following options are available: + --help Show this help message and exit. + --version Show program's version and exit. --config-file Loads the configuration from a TOML file. --log-level Sets the log level for process and topics (e.g. "DEBUG; TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none") [=INFO]. diff --git a/vendor/nim-confutils b/vendor/nim-confutils index f7e25d9d86..5286ed67d3 160000 --- a/vendor/nim-confutils +++ b/vendor/nim-confutils @@ -1 +1 @@ -Subproject commit f7e25d9d86991eba0ff9f30b1c6e797b0aea143c +Subproject commit 5286ed67d363a3630ece85a0e8c1141d1d52b434