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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ tests/fixtures/eest_static
tests/fixtures/eest_stable
tests/fixtures/eest_develop
tests/fixtures/eest_devnet

execution_chain/nimbus
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ nimbus_execution_client: | build deps rocksdb
check_revision: nimbus_execution_client
scripts/check_revision.sh

nimbus: nimbus_execution_client
echo "The nimbus target is deprecated and will soon change meaning, use 'nimbus_execution_client' instead"
nimbus: | build deps rocksdb
echo -e $(BUILD_MSG) "build/nimbus" && \
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:chronicles_log_level=TRACE -o:build/nimbus "execution_chain/nimbus.nim"

# symlink
nimbus.nims:
Expand Down
2 changes: 1 addition & 1 deletion execution_chain/beacon/api_handler/api_newpayload.nim
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ proc newPayload*(ben: BeaconEngineRef,
# If we already have the block locally, ignore the entire execution and just
# return a fake success.
if chain.haveBlockAndState(blockHash):
notice "Ignoring already known beacon payload",
debug "Ignoring already known beacon payload",
number = header.number, hash = blockHash.short
return validStatus(blockHash)

Expand Down
6 changes: 3 additions & 3 deletions execution_chain/common.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2022 Status Research & Development GmbH
# Copyright (c) 2022-2025 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
Expand All @@ -10,9 +10,9 @@
import
./common/common,
./common/genesis,
./common/context
./common/manager

export
common,
genesis,
context
manager
82 changes: 0 additions & 82 deletions execution_chain/common/context.nim

This file was deleted.

5 changes: 1 addition & 4 deletions execution_chain/common/manager.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2021-2024 Status Research & Development GmbH
# Copyright (c) 2021-2025 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
Expand Down Expand Up @@ -27,9 +27,6 @@ type
AccountsManager* = object
accounts: Table[Address, NimbusAccount]

proc init*(_: type AccountsManager): AccountsManager =
discard

proc loadKeystores*(am: var AccountsManager, path: string):
Result[void, string] =
try:
Expand Down
74 changes: 18 additions & 56 deletions execution_chain/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,8 @@ import

export net, defs, jsdefs, jsnet, nimbus_binary_common

const
# e.g.: Copyright (c) 2018-2025 Status Research & Development GmbH
NimbusCopyright* = "Copyright (c) 2018-" &
CompileDate.split('-')[0] &
" Status Research & Development GmbH"

# e.g.:
# nimbus_execution_client/v0.1.0-abcdef/os-cpu/nim-a.b.c/emvc
# Copyright (c) 2018-2025 Status Research & Development GmbH
NimbusBuild* = "$#\p$#" % [
ClientId,
NimbusCopyright,
]

NimbusHeader* = "$#\p\pNim version $#" % [
NimbusBuild,
nimBanner()
]
const NimbusCopyright* =
"Copyright (c) 2018-" & compileYear & " Status Research & Development GmbH"

func getLogLevels(): string =
var logLevels: seq[string]
Expand All @@ -67,7 +51,7 @@ func getLogLevels(): string =
join(logLevels, ", ")

const
defaultPort = 30303
defaultExecutionPort* = 30303
defaultMetricsServerPort = 9093
defaultHttpPort = 8545
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/authentication.md#jwt-specifications
Expand Down Expand Up @@ -196,16 +180,6 @@ type
defaultValue: StdoutLogKind.Auto
name: "log-format" .}: StdoutLogKind

logMetricsEnabled* {.
desc: "Enable metrics logging"
defaultValue: false
name: "log-metrics" .}: bool

logMetricsInterval* {.
desc: "Interval at which to log metrics, in seconds"
defaultValue: 10
name: "log-metrics-interval" .}: int

metricsEnabled* {.
desc: "Enable the built-in metrics HTTP server"
defaultValue: false
Expand Down Expand Up @@ -268,8 +242,8 @@ type

tcpPort* {.
desc: "Ethereum P2P network listening TCP port"
defaultValue: defaultPort
defaultValueDesc: $defaultPort
defaultValue: defaultExecutionPort
defaultValueDesc: $defaultExecutionPort
name: "tcp-port" }: Port

udpPort* {.
Expand Down Expand Up @@ -320,7 +294,7 @@ type
separator: "\pPERFORMANCE OPTIONS",
defaultValue: 0,
desc: "Number of worker threads (\"0\" = use as many threads as there are CPU cores available)"
name: "num-threads" .}: uint
name: "num-threads" .}: int

persistBatchSize* {.
hidden
Expand Down Expand Up @@ -490,6 +464,12 @@ type
defaultValueDesc: "\"jwt.hex\" in the data directory (see --data-dir)"
name: "jwt-secret" .}: Option[InputFile]

jwtSecretValue* {.
hidden
desc: "Hex string with jwt secret"
defaultValueDesc: "\"jwt.hex\" in the data directory (see --data-dir)"
name: "debug-jwt-secret-value" .}: Option[string]

beaconSyncTarget* {.
hidden
desc: "Manually set the initial sync target specified by its 32 byte" &
Expand Down Expand Up @@ -802,31 +782,13 @@ func dbOptions*(conf: NimbusConf, noKeyCache = false): DbOptions =
# Constructor
#-------------------------------------------------------------------

proc makeConfig*(cmdLine = commandLineParams()): NimbusConf =
proc makeConfig*(cmdLine = commandLineParams(), ignoreUnknown = false): NimbusConf =
## Note: this function is not gc-safe
try:
result = NimbusConf.load(
cmdLine,
version = NimbusBuild,
copyrightBanner = NimbusHeader,
secondarySources = proc (
conf: NimbusConf, sources: ref SecondarySources
) {.raises: [ConfigurationError].} =
if conf.configFile.isSome:
sources.addConfigFile(Toml, conf.configFile.get)
)
except CatchableError as err:
if err[] of ConfigurationError and err.parent != nil:
if err.parent[] of TomlFieldReadingError:
let fieldName = ((ref TomlFieldReadingError)(err.parent)).field
echo "Error when parsing ", fieldName, ": ", err.msg
elif err.parent[] of TomlReaderError:
type TT = ref TomlReaderError
echo TT(err).formatMsg("")
else:
echo "Error when parsing config file: ", err.msg
else:
echo "Error when parsing command line params: ", err.msg
result = NimbusConf.loadWithBanners(ClientId, NimbusCopyright, [], ignoreUnknown, cmdLine).valueOr:
try:
stderr.writeLine error # Logging not yet set up
except IOError:
discard
quit QuitFailure

processNetworkParamsAndNetworkId(result)
Expand Down
14 changes: 11 additions & 3 deletions execution_chain/core/chain/forked_chain.nim
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,16 @@ proc updateBase(c: ForkedChainRef, base: BlockRef): uint =
# No update, return
return

block:
# Write block contents to txFrame at the last moment - otherwise, they would
# stay both in BlockRef and TxFrame memory
# TODO probably makes sense to do it the other way around, removing blk
# from BlockRef
var blk = base
while blk.isOk:
c.writeBaggage(blk.blk, blk.hash, blk.txFrame, blk.receipts)
blk = blk.parent

# State root sanity check is performed to verify, before writing to disk,
# that optimistically checked blocks indeed end up being stored with a
# consistent state root.
Expand Down Expand Up @@ -485,9 +495,7 @@ proc validateBlock(c: ForkedChainRef,
txFrame.dispose()
return err(error)

c.writeBaggage(blk, blkHash, txFrame, receipts)

c.updateSnapshot(blk, txFrame)
c.updateSnapshot(blk.header.number, txFrame)

let newBlock = c.appendBlock(parent, blk, blkHash, txFrame, move(receipts))

Expand Down
6 changes: 3 additions & 3 deletions execution_chain/core/chain/forked_chain/chain_private.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ proc writeBaggage*(c: ForkedChainRef,
header.withdrawalsRoot.expect("WithdrawalsRoot should be verified before"),
blk.withdrawals.get)

template updateSnapshot*(c: ForkedChainRef,
blk: Block,
proc updateSnapshot*(c: ForkedChainRef,
number: BlockNumber,
txFrame: CoreDbTxRef) =
let pos = c.lastSnapshotPos
c.lastSnapshotPos = (c.lastSnapshotPos + 1) mod c.lastSnapshots.len
Expand All @@ -51,7 +51,7 @@ template updateSnapshot*(c: ForkedChainRef,
# Checkpoint creates a snapshot of ancestor changes in txFrame - it is an
# expensive operation, specially when creating a new branch (ie when blk
# is being applied to a block that is currently not a head)
txFrame.checkpoint(blk.header.number)
txFrame.checkpoint(number)

c.lastSnapshots[pos] = txFrame

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ proc replayBlock(fc: ForkedChainRef;
return err(error)

fc.writeBaggage(blk.blk, blk.hash, txFrame, receipts)
fc.updateSnapshot(blk.blk, txFrame)
fc.updateSnapshot(blk.blk.header.number, txFrame)

blk.txFrame = txFrame
blk.receipts = move(receipts)
Expand Down
Loading
Loading