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

cl+el proof of concept [WiP] #2804

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ VERIF_PROXY_OUT_PATH ?= build/libverifproxy/
deps \
update \
nimbus \
nimbus_unified \
fluffy \
nimbus_verified_proxy \
libverifproxy \
Expand Down Expand Up @@ -366,6 +367,13 @@ ifneq ($(USE_LIBBACKTRACE), 0)
+ $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT)
endif

# Nimbus unified related targets

# builds the unified client
# NIM_PARAMS := -d:release --parallelBuild:1 -d:libp2p_agents_metrics -d:KnownLibP2PAgents=nimbus,lighthouse,lodestar,prysm,teku,grandine $(NIM_PARAMS)
nimbus_unified: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:disable_libbacktrace -d:libp2p_pki_schemes=secp256k1 -d:unified -o:build/$@ "nimbus_unified/[email protected]"
# Note about building Nimbus as a library:
#
# There were `wrappers`, `wrappers-static`, `libnimbus.so` and `libnimbus.a`
Expand Down
4 changes: 3 additions & 1 deletion config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ if not defined(windows):
--opt:speed
--excessiveStackTrace:on
# enable metric collection
--define:metrics
when not defined(unified):
--define:metrics

# for heap-usage-by-instance-type metrics and object base-type strings
--define:nimTypeNames
--styleCheck:usages
Expand Down
10 changes: 9 additions & 1 deletion nimbus.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ requires "nim >= 1.6.0",
"blscurve",
"evmc",
"web3",
"minilru"
"minilru",
"secp256k1"

binDir = "build"

Expand All @@ -40,6 +41,7 @@ when declared(namedBin):
"nimbus/nimbus_execution_client": "nimbus_execution_client",
"fluffy/fluffy": "fluffy",
"nimbus_verified_proxy/nimbus_verified_proxy": "nimbus_verified_proxy",
"nimbus_unified":"nimbus_unified"
}.toTable()

import std/os
Expand Down Expand Up @@ -129,3 +131,9 @@ 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 unified":
buildBinary "nimbus_unified", "nimbus_unified/", "-d:chronicles_log_level=TRACE"
50 changes: 50 additions & 0 deletions nimbus_unified/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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)


# NOTE - whole document to be concluded...

# description
Nimbus Unified combines Ethereum execution and consensus layer functionalities, featuring a fully integrated beacon node, validator duties, and execution layer support. This setup allows the Nimbus client to handle both Ethereum consensus (Eth2) and execution (Eth1) tasks within a single package.

--> meh, requires improvement
# documentation
For in-depth configuration and functionality of Nimbus Eth1 and Nimbus Eth2, 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

--- to be concluded
# dependencies
tbd
# how to
## configuration
todo
## commands
todo
## compile
tbd
- mac os, windows, and linux
## colaborate
We welcome contributions to Nimbus Unified! Please adhere to the following guidelines:

- Follow the [Nimbus Code of Conduct](https://github.com/status-im/nimbus-eth2/blob/master/CODE_OF_CONDUCT.md).
- Use the [Nimbus Code Style Guide](https://github.com/status-im/nimbus-eth2/blob/master/docs/code_style.md) 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

These files may not be copied, modified, or distributed except according to those terms.
51 changes: 51 additions & 0 deletions nimbus_unified/configs/nimbus_configs.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# nimbus_unified
# Copyright (c) 2024 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, tables], beacon_chain/nimbus_binary_common

## Exceptions
type NimbusTasksError* = object of CatchableError

## Configuration
## TODO: implement a json (or other format like yaml) config reader for config reading (file config scenarios)
## 1) implement a command line reader to read arguments
## 2) good option to adhere to other projects conventions and use the in place support to read and load
type NimbusConfig* = object
configTable: Table[string, string]

## Nimbus workers arguments (thread arguments)
type TaskParameters* = object
name*: string
configs*: string
beaconNodeConfigs*: BeaconNodeConf

## Task shutdown flag
##
## The behaviour required: this thread needs to atomically change the flag value when
## a shutdown is required or when detects a stopped thread.
##
## Given the behaviour wanted, atomic operations are sufficient without barriers or fences. Compilers
## may reorder instructions, but given that the order is not important, this does not affect
## the semantic wanted: If instructions are reordered, the worker will fail to read on the current iteration
## but will read it correctly on the next iteration ( this thread is the only on which changes the flag behaviour,
## and will always change it to true)
##
## With this we avoid the overhead of locks
var isShutDownRequired*: Atomic[bool]
isShutDownRequired.store(false)

# TODO: move this into config.nim file once we have the file in place
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
Loading
Loading