Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimbus initial commit #3036

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018-2024 Status Research & Development GmbH. Licensed under
# Copyright (c) 2018-2025 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
Expand Down Expand Up @@ -104,6 +104,7 @@ VERIF_PROXY_OUT_PATH ?= build/libverifproxy/
update \
nimbus \
nimbus_execution_client \
nimbus_unified \
fluffy \
Copy link
Member

Choose a reason for hiding this comment

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

why not name it nimbus?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the target nimbus is on rampdown:
https://github.com/status-im/nimbus-eth1/blob/dev/pedro/kikof/Makefile#L217
image

and we need to solve issue #2738 and update some README make commands refs

Given that this is a project in development yet to be released (https://nimbus.guide/execution-client.html), how much time should we wait for the rampdown period?

Agree that it would be nice to get the renaming before starting landing this.

nimbus_verified_proxy \
libverifproxy \
Expand Down Expand Up @@ -359,13 +360,24 @@ txparse: | build deps

# usual cleaning
clean: | clean-common
rm -rf build/{nimbus,nimbus_execution_client,fluffy,libverifproxy,nimbus_verified_proxy,$(TOOLS_CSV),$(FLUFFY_TOOLS_CSV),all_tests,test_kvstore_rocksdb,test_rpc,all_fluffy_tests,all_history_network_custom_chain_tests,test_portal_testnet,utp_test_app,utp_test,*.dSYM}
rm -rf build/{nimbus_unified,nimbus,nimbus_execution_client,fluffy,libverifproxy,nimbus_verified_proxy,$(TOOLS_CSV),$(FLUFFY_TOOLS_CSV),all_tests,test_kvstore_rocksdb,test_rpc,all_fluffy_tests,all_history_network_custom_chain_tests,test_portal_testnet,utp_test_app,utp_test,nimbus_unified_test,*.dSYM}
rm -rf tools/t8n/{t8n,t8n_test}
rm -rf tools/evmstate/{evmstate,evmstate_test}
ifneq ($(USE_LIBBACKTRACE), 0)
+ $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT)
endif

# Nimbus unified related targets

# builds the unified client
nimbus_unified: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:release --parallelBuild:1 -d:libp2p_pki_schemes=secp256k1 -u:metrics -o:build/$@ "nimbus_unified/[email protected]"

all_tests_unified: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim c -r $(NIM_PARAMS) --threads:on -d:chronicles_log_level=ERROR -o:build/$@ "nimbus_unified/tests/[email protected]"

# Note about building Nimbus as a library:
#
# There were `wrappers`, `wrappers-static`, `libnimbus.so` and `libnimbus.a`
Expand Down
10 changes: 9 additions & 1 deletion nimbus.nimble
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# nimbus
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Copyright (c) 2018-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
Expand Down Expand Up @@ -129,3 +129,11 @@ task nimbus_verified_proxy, "Build Nimbus verified proxy":

task nimbus_verified_proxy_test, "Run Nimbus verified proxy tests":
test "nimbus_verified_proxy/tests", "test_proof_validation", "-d:chronicles_log_level=ERROR -d:nimbus_db_backend=sqlite"

## nimbus unified tasks

task nimbus_unified, "Build Nimbus":
buildBinary "nimbus_unified", "nimbus_unified/", "-d:chronicles_log_level=TRACE"

task nimbus_unified_test, "Run Nimbus tests":
test "nimbus_unified/tests/","all_tests_unified", "-d:chronicles_log_level=ERROR"
45 changes: 45 additions & 0 deletions nimbus_unified/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Nimbus Unified

<!-- [![Github Actions CI](tbd) -->
[![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

[![Discord: Nimbus](https://img.shields.io/badge/discord-nimbus-orange.svg)](https://discord.gg/XRxWahP)
[![Status: #nimbus-general](https://img.shields.io/badge/status-nimbus--general-orange.svg)](https://join.status.im/nimbus-general)


# description
tbd
For in-depth configuration and functionality of Nimbus execution and consensus layer refer to:
- [Nimbus-eth1 - Execution layer client](https://github.com/status-im/nimbus-eth1) Documentation
- [Nimbus-eth2 - Consensus layer client](https://github.com/status-im/nimbus-eth2) Documentation

tbc
# dependencies
tbd
# how to
## configuration
todo
## commands
todo
## compile
tbd
- mac os, windows, and linux

]$ make nimbus_unified
## colaborate
We welcome contributions to Nimbus Unified! Please adhere to the following guidelines:

- Use the [Status Nim style guide](https://status-im.github.io/nim-style-guide/) to maintain code consistency.
- Format your code using the [Nim Pretty Printer (nph)](https://github.com/nim-lang/nimpretty) to ensure consistency across the codebase. Run it as part of your pull request process.
## License

Licensed and distributed under either of

* MIT license: [LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT

or

* Apache License, Version 2.0: [LICENSE-APACHEv2](LICENSE-APACHEv2) or https://www.apache.org/licenses/LICENSE-2.0

at your option. These files may not be copied, modified, or distributed except according to those terms.
70 changes: 70 additions & 0 deletions nimbus_unified/configs/nimbus_configs.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# nimbus_unified
# Copyright (c) 2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import
std/[os, atomics],
chronicles,
options,
#eth2-configs
beacon_chain/nimbus_binary_common,
#eth1-configs
../../nimbus/nimbus_desc

export BeaconNodeConf, NimbusConf

## Exceptions
type NimbusServiceError* = object of CatchableError

## Constants
## TODO: evaluate the proposed timeouts
const cNimbusMaxServices* = 2
const cNimbusServiceTimeoutMs* = 3000

## log
logScope:
topics = "Service manager"

## Nimbus service arguments
type
ConfigKind* = enum
Execution
Consensus

LayerConfig* = object
case kind*: ConfigKind
of Consensus:
consensusConfig*: BeaconNodeConf
of Execution:
executionConfig*: NimbusConf

ServiceParameters* = object
name*: string
layerConfig*: LayerConfig

NimbusService* = ref object
name*: string
timeoutMs*: uint32
serviceHandler*: Thread[ServiceParameters]

Nimbus* = ref object
serviceList*: array[cNimbusMaxServices, Option[NimbusService]]

## Service shutdown
var isShutDownRequired*: Atomic[bool]
isShutDownRequired.store(false)

# filesystem specs
proc defaultDataDir*(): string =
let dataDir =
when defined(windows):
"AppData" / "Roaming" / "Nimbus_unified"
elif defined(macosx):
"Library" / "Application Support" / "Nimbus_unified"
else:
".cache" / "nimbus_unified"

getHomeDir() / dataDir
31 changes: 31 additions & 0 deletions nimbus_unified/consensus/consensus_layer.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# nimbus_unified
# Copyright (c) 2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import std/[atomics, os], chronicles, ../configs/nimbus_configs

export nimbus_configs

logScope:
topics = "Consensus layer"

proc consensusLayer*(params: ServiceParameters) {.raises: [CatchableError].} =
var config = params.layerConfig

doAssert config.kind == Consensus

try:
while isShutDownRequired.load() == false:
info "consensus ..."
sleep(cNimbusServiceTimeoutMs + 1000)

isShutDownRequired.store(true)
except CatchableError as e:
fatal "error", message = e.msg
isShutDownRequired.store(true)

isShutDownRequired.store(true)
warn "\tExiting consensus layer"
31 changes: 31 additions & 0 deletions nimbus_unified/execution/execution_layer.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# nimbus_unified
# Copyright (c) 2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import std/[atomics, os], chronicles, ../configs/nimbus_configs

export nimbus_configs

logScope:
topics = "Execution layer"

proc executionLayer*(params: ServiceParameters) {.raises: [CatchableError].} =
var config = params.layerConfig

doAssert config.kind == Execution

try:
while isShutDownRequired.load() == false:
info "execution ..."
sleep(cNimbusServiceTimeoutMs)

isShutDownRequired.store(true)
except CatchableError as e:
fatal "error", message = e.msg
isShutDownRequired.store(true)

isShutDownRequired.store(true)
warn "\tExiting execution layer"
17 changes: 17 additions & 0 deletions nimbus_unified/nimbus_unified.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# nimbus_unified
# Copyright (c) 2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

-d:"libp2p_pki_schemes=secp256k1"

-d:"chronicles_sinks=textlines[dynamic],json[dynamic]"
-d:"chronicles_runtime_filtering=on"
-d:"chronicles_disable_thread_id"

@if release:
-d:"chronicles_line_numbers:0"
@end

Loading
Loading