Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions execution_chain/conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@ func getLogLevels(): string =

const
defaultExecutionPort* = 30303
defaultMetricsServerPort = 9093
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MetricsConf use port 8008. If this is ok, then this needs updating

defaultHttpPort = 8545
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/authentication.md#jwt-specifications
defaultEngineApiPort* = 8551
defaultAdminListenAddress = (static parseIpAddress("127.0.0.1"))
defaultAdminListenAddressDesc = $defaultAdminListenAddress & ", meaning local host only"
logLevelDesc = getLogLevels()

let
Expand Down Expand Up @@ -180,22 +177,7 @@ type
defaultValue: StdoutLogKind.Auto
name: "log-format" .}: StdoutLogKind

metricsEnabled* {.
desc: "Enable the built-in metrics HTTP server"
defaultValue: false
name: "metrics" .}: bool

metricsPort* {.
desc: "Listening port of the built-in metrics HTTP server"
defaultValue: defaultMetricsServerPort
defaultValueDesc: $defaultMetricsServerPort
name: "metrics-port" .}: Port

metricsAddress* {.
desc: "Listening IP address of the built-in metrics HTTP server"
defaultValue: defaultAdminListenAddress
defaultValueDesc: $defaultAdminListenAddressDesc
name: "metrics-address" .}: IpAddress
metrics* {.flatten.}: MetricsConf

bootstrapNodes {.
separator: "\pNETWORKING OPTIONS:"
Expand Down
24 changes: 4 additions & 20 deletions execution_chain/nimbus.nim
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import
]

const
defaultMetricsServerPort = 8008
copyright = "Copyright (c) " & compileYear & " Status Research & Development GmbH"

type NStartUpCmd* {.pure.} = enum
Expand Down Expand Up @@ -87,22 +86,7 @@ type
defaultValue: StdoutLogKind.Auto
name: "log-format" .}: StdoutLogKind

metricsEnabled* {.
desc: "Enable the built-in metrics HTTP server"
defaultValue: false
name: "metrics" .}: bool

metricsPort* {.
desc: "Listening port of the built-in metrics HTTP server"
defaultValue: defaultMetricsServerPort
defaultValueDesc: $defaultMetricsServerPort
name: "metrics-port" .}: Port

metricsAddress* {.
desc: "Listening IP address of the built-in metrics HTTP server"
defaultValue: defaultAdminListenAddress
defaultValueDesc: $defaultAdminListenAddressDesc
name: "metrics-address" .}: IpAddress
metrics* {.flatten.}: MetricsConf

numThreads* {.
defaultValue: 0,
Expand Down Expand Up @@ -212,7 +196,7 @@ proc runBeaconNode(p: BeaconThreadConfig) {.thread.} =
&"http://127.0.0.1:{defaultEngineApiPort}/", Opt.some(@(distinctBase(jwtKey)))
)

config.metricsEnabled = false
config.metrics.enabled = false
config.elUrls =
@[
EngineApiUrlConfigValue(
Expand Down Expand Up @@ -258,7 +242,7 @@ proc runBeaconNode(p: BeaconThreadConfig) {.thread.} =

proc runExecutionClient(p: ExecutionThreadConfig) {.thread.} =
var config = makeConfig(ignoreUnknown = true)
config.metricsEnabled = false
config.metrics.enabled = false
config.engineApiEnabled = true
config.engineApiPort = Port(defaultEngineApiPort)
config.engineApiAddress = defaultAdminListenAddress
Expand Down Expand Up @@ -303,7 +287,7 @@ proc runCombinedClient() =
# permissions are insecure.
quit QuitFailure

let metricsServer = (waitFor config.initMetricsServer()).valueOr:
let metricsServer = (waitFor initMetricsServer(config.metrics)).valueOr:
quit 1

# Nim GC metrics (for the main thread) will be collected in onSecond(), but
Expand Down
2 changes: 1 addition & 1 deletion execution_chain/nimbus_execution_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ proc main*(config = makeConfig(), nimbus = NimbusNode(nil)) {.noinline.} =
# Metrics are useful not just when running node but also during import
let metricsServer =
try:
waitFor(initMetricsServer(config)).valueOr:
waitFor(initMetricsServer(config.metrics)).valueOr:
quit(QuitFailure)
except CancelledError:
raiseAssert "Never cancelled"
Expand Down
2 changes: 1 addition & 1 deletion portal/client/nimbus_portal_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ proc run(portalClient: PortalClient, config: PortalConf) {.raises: [CatchableErr
quit QuitFailure

## Start metrics HTTP server
let metricsServer = waitFor(initMetricsServer(config)).valueOr:
let metricsServer = waitFor(initMetricsServer(config.metrics)).valueOr:
quit QuitFailure # Logged in initMetricsServer

## Start the Portal node.
Expand Down
19 changes: 1 addition & 18 deletions portal/client/nimbus_portal_client_conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import

const
defaultListenAddress* = (static parseIpAddress("0.0.0.0"))
defaultAdminListenAddress* = (static parseIpAddress("127.0.0.1"))
defaultListenAddressDesc = $defaultListenAddress
defaultAdminListenAddressDesc = $defaultAdminListenAddress

defaultStorageCapacity* = 2000'u32 # 2 GB default
defaultStorageCapacityDesc* = $defaultStorageCapacity
Expand Down Expand Up @@ -166,22 +164,7 @@ type
name: "debug-netkey-nodeid-prefix-unsafe"
.}: Option[string]

metricsEnabled* {.
defaultValue: false, desc: "Enable the metrics server", name: "metrics"
.}: bool

metricsAddress* {.
defaultValue: defaultAdminListenAddress,
defaultValueDesc: $defaultAdminListenAddressDesc,
desc: "Listening address of the metrics server",
name: "metrics-address"
.}: IpAddress

metricsPort* {.
defaultValue: 8008,
desc: "Listening HTTP port of the metrics server",
name: "metrics-port"
.}: Port
metrics* {.flatten.}: MetricsConf

rpcEnabled* {.
desc: "Enable the HTTP JSON-RPC server", defaultValue: false, name: "rpc"
Expand Down
43 changes: 7 additions & 36 deletions portal/tools/portalcli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import
eth/[common/keys, net/nat],
eth/p2p/discoveryv5/node,
eth/p2p/discoveryv5/protocol as discv5_protocol,
beacon_chain/nimbus_binary_common,
../common/common_utils,
../database/content_db,
../network/wire/
Expand All @@ -27,10 +28,7 @@ import

const
defaultListenAddress* = (static parseIpAddress("0.0.0.0"))
defaultAdminListenAddress* = (static parseIpAddress("127.0.0.1"))

defaultListenAddressDesc = $defaultListenAddress
defaultAdminListenAddressDesc = $defaultAdminListenAddress
# 100mb seems a bit smallish we may consider increasing defaults after some
# network measurements
defaultStorageSize* = uint32(1000 * 1000 * 100)
Expand Down Expand Up @@ -101,22 +99,7 @@ type
name: "network-key"
.}: PrivateKey

metricsEnabled* {.
defaultValue: false, desc: "Enable the metrics server", name: "metrics"
.}: bool

metricsAddress* {.
defaultValue: defaultAdminListenAddress,
defaultValueDesc: $defaultAdminListenAddressDesc,
desc: "Listening address of the metrics server",
name: "metrics-address"
.}: IpAddress

metricsPort* {.
defaultValue: 8008,
desc: "Listening HTTP port of the metrics server",
name: "metrics-port"
.}: Port
metrics* {.flatten.}: MetricsConf

protocolId* {.
defaultValue: getProtocolId(PortalSubnetwork.history),
Expand Down Expand Up @@ -271,23 +254,11 @@ proc run(config: PortalCliConf) =
bootstrapRecords = bootstrapRecords,
)

if config.metricsEnabled:
let
address = config.metricsAddress
port = config.metricsPort
url = "http://" & $address & ":" & $port & "/metrics"

server = MetricsHttpServerRef.new($address, port).valueOr:
error "Could not instantiate metrics HTTP server", url, error
quit QuitFailure

info "Starting metrics HTTP server", url
try:
waitFor server.start()
except MetricsError as exc:
fatal "Could not start metrics HTTP server",
url, error_msg = exc.msg, error_name = exc.name
quit QuitFailure
let metricsServer = (waitFor initMetricsServer(config.metrics)).valueOr:
quit QuitFailure
defer:
if metricsServer.isSome():
waitFor metricsServer.stopMetricsServer()

case config.cmd
of ping:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_configuration.nim
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ proc configurationMain*() =
check config.logLevel == "DEBUG"
check config.logStdout == StdoutLogKind.Json

check config.metricsEnabled == true
check config.metricsPort == 127.Port
check config.metricsAddress == parseIpAddress("111.222.33.203")
check config.metrics.enabled == true
check config.metrics.port == 127.Port
check config.metrics.address == parseIpAddress("111.222.33.203")

privateAccess(ExecutionClientConf)
check config.bootstrapNodes.len == 3
Expand Down
2 changes: 1 addition & 1 deletion vendor/nimbus-eth2
Submodule nimbus-eth2 updated 38 files
+2 −2 .github/workflows/ci.yml
+1 −0 AllTests-mainnet.md
+6 −119 beacon_chain/conf.nim
+2 −1 beacon_chain/consensus_object_pools/attestation_pool.nim
+2 −1 beacon_chain/fork_choice/fork_choice.nim
+6 −3 beacon_chain/gossip_processing/eth2_processor.nim
+4 −4 beacon_chain/nimbus_beacon_node.nim
+128 −36 beacon_chain/nimbus_binary_common.nim
+2 −2 beacon_chain/nimbus_validator_client.nim
+26 −0 beacon_chain/spec/beacon_time.nim
+32 −0 beacon_chain/spec/helpers.nim
+1 −1 beacon_chain/trusted_node_sync.nim
+23 −10 beacon_chain/validator_client/attestation_service.nim
+3 −1 beacon_chain/validator_client/block_service.nim
+25 −21 beacon_chain/validator_client/common.nim
+24 −10 beacon_chain/validator_client/sync_committee_service.nim
+7 −4 beacon_chain/validators/beacon_validators.nim
+12 −5 beacon_chain/validators/message_router.nim
+3 −1 beacon_chain/validators/validator_duties.nim
+16 −9 beacon_chain/validators/validator_monitor.nim
+15 −0 beacon_chain/validators/validator_pool.nim
+5 −5 ncli/ncli_db.nim
+4 −3 research/block_sim.nim
+1 −1 tests/consensus_spec/test_fixture_fork_choice.nim
+1 −1 tests/consensus_spec/test_fixture_light_client_data_collection.nim
+1 −1 tests/test_attestation_pool.nim
+2 −2 tests/test_beacon_chain_db.nim
+2 −2 tests/test_block_processor.nim
+25 −25 tests/test_blockchain_dag.nim
+1 −1 tests/test_execution_payload_pool.nim
+2 −2 tests/test_gossip_validation.nim
+1 −1 tests/test_light_client.nim
+1 −1 tests/test_light_client_processor.nim
+24 −0 tests/test_signing_node.nim
+1 −1 tests/test_statediff.nim
+1 −1 tests/test_validator_change_pool.nim
+1 −1 vendor/gnosis-chain-configs
+1 −1 vendor/nim-confutils