Skip to content

Commit

Permalink
Merge branch 'unstable' into refactor-mock-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Jan 15, 2025
2 parents 8c93b11 + 93f9c2c commit 6f8ec54
Show file tree
Hide file tree
Showing 296 changed files with 4,632 additions and 2,517 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[env]
# Set the number of arenas to 16 when using jemalloc.
JEMALLOC_SYS_WITH_MALLOC_CONF = "abort_conf:true,narenas:16"

2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
beacon_node/network/ @jxs
beacon_node/lighthouse_network/ @jxs
22 changes: 21 additions & 1 deletion .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ jobs:
- name: Check formatting with cargo fmt
run: make cargo-fmt
- name: Lint code for quality and style with Clippy
run: make lint
run: make lint-full
- name: Certify Cargo.lock freshness
run: git diff --exit-code Cargo.lock
- name: Typecheck benchmark code without running it
Expand Down Expand Up @@ -392,6 +392,10 @@ jobs:
cache: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch libssl1.1
run: wget https://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
- name: Install libssl1.1
run: sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
- name: Create Cargo config dir
run: mkdir -p .cargo
- name: Install custom Cargo config
Expand Down Expand Up @@ -428,6 +432,21 @@ jobs:
cache-target: release
- name: Run Makefile to trigger the bash script
run: make cli-local
cargo-sort:
name: cargo-sort
needs: [check-labels]
if: needs.check-labels.outputs.skip_ci != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get latest version of stable Rust
uses: moonrepo/setup-rust@v1
with:
channel: stable
cache-target: release
bins: cargo-sort
- name: Run cargo sort to check if Cargo.toml files are sorted
run: cargo sort --check --workspace
# This job succeeds ONLY IF all others succeed. It is used by the merge queue to determine whether
# a PR is safe to merge. New jobs should be added here.
test-suite-success:
Expand Down Expand Up @@ -455,6 +474,7 @@ jobs:
'compile-with-beta-compiler',
'cli-check',
'lockbud',
'cargo-sort',
]
steps:
- uses: actions/checkout@v4
Expand Down
52 changes: 36 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ members = [
"beacon_node/builder_client",
"beacon_node/client",
"beacon_node/eth1",
"beacon_node/lighthouse_network",
"beacon_node/lighthouse_network/gossipsub",
"beacon_node/execution_layer",
"beacon_node/genesis",
"beacon_node/http_api",
"beacon_node/http_metrics",
"beacon_node/lighthouse_network",
"beacon_node/lighthouse_network/gossipsub",
"beacon_node/network",
"beacon_node/operation_pool",
"beacon_node/store",
"beacon_node/timer",

Expand All @@ -30,40 +32,43 @@ members = [
"common/eth2_interop_keypairs",
"common/eth2_network_config",
"common/eth2_wallet_manager",
"common/metrics",
"common/filesystem",
"common/lighthouse_version",
"common/lockfile",
"common/logging",
"common/lru_cache",
"common/malloc_utils",
"common/metrics",
"common/monitoring_api",
"common/oneshot_broadcast",
"common/pretty_reqwest_error",
"common/sensitive_url",
"common/slot_clock",
"common/system_health",
"common/task_executor",
"common/target_check",
"common/task_executor",
"common/test_random_derive",
"common/unused_port",
"common/validator_dir",
"common/warp_utils",
"common/monitoring_api",

"database_manager",

"consensus/int_to_bytes",
"consensus/fixed_bytes",
"consensus/fork_choice",
"consensus/int_to_bytes",
"consensus/merkle_proof",
"consensus/proto_array",
"consensus/safe_arith",
"consensus/state_processing",
"consensus/swap_or_not_shuffle",
"consensus/types",

"crypto/bls",
"crypto/kzg",
"crypto/eth2_key_derivation",
"crypto/eth2_keystore",
"crypto/eth2_wallet",
"crypto/kzg",

"database_manager",

"lcli",

Expand All @@ -78,8 +83,8 @@ members = [
"testing/execution_engine_integration",
"testing/node_test_rig",
"testing/simulator",
"testing/test-test_logger",
"testing/state_transition_vectors",
"testing/test-test_logger",
"testing/web3signer_tests",

"validator_client",
Expand Down Expand Up @@ -126,8 +131,8 @@ delay_map = "0.4"
derivative = "2"
dirs = "3"
either = "1.9"
# TODO: rust_eth_kzg is pinned for now while a perf regression is investigated
# The crate_crypto_* dependencies can be removed from this file completely once we update
# TODO: rust_eth_kzg is pinned for now while a perf regression is investigated
# The crate_crypto_* dependencies can be removed from this file completely once we update
rust_eth_kzg = "=0.5.1"
crate_crypto_internal_eth_kzg_bls12_381 = "=0.5.1"
crate_crypto_internal_eth_kzg_erasure_codes = "=0.5.1"
Expand Down Expand Up @@ -167,7 +172,13 @@ r2d2 = "0.8"
rand = "0.8"
rayon = "1.7"
regex = "1"
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "stream", "rustls-tls", "native-tls-vendored"] }
reqwest = { version = "0.11", default-features = false, features = [
"blocking",
"json",
"stream",
"rustls-tls",
"native-tls-vendored",
] }
ring = "0.16"
rpds = "0.11"
rusqlite = { version = "0.28", features = ["bundled"] }
Expand All @@ -176,7 +187,11 @@ serde_json = "1"
serde_repr = "0.1"
serde_yaml = "0.9"
sha2 = "0.9"
slog = { version = "2", features = ["max_level_debug", "release_max_level_debug", "nested-values"] }
slog = { version = "2", features = [
"max_level_debug",
"release_max_level_debug",
"nested-values",
] }
slog-async = "2"
slog-term = "2"
sloggers = { version = "2", features = ["json"] }
Expand All @@ -188,7 +203,12 @@ superstruct = "0.8"
syn = "1"
sysinfo = "0.26"
tempfile = "3"
tokio = { version = "1", features = ["rt-multi-thread", "sync", "signal", "macros"] }
tokio = { version = "1", features = [
"rt-multi-thread",
"sync",
"signal",
"macros",
] }
tokio-stream = { version = "0.1", features = ["sync"] }
tokio-util = { version = "0.7", features = ["codec", "compat", "time"] }
tracing = "0.1.40"
Expand Down Expand Up @@ -267,7 +287,7 @@ validator_dir = { path = "common/validator_dir" }
validator_http_api = { path = "validator_client/http_api" }
validator_http_metrics = { path = "validator_client/http_metrics" }
validator_metrics = { path = "validator_client/validator_metrics" }
validator_store= { path = "validator_client/validator_store" }
validator_store = { path = "validator_client/validator_store" }
warp_utils = { path = "common/warp_utils" }
xdelta3 = { git = "http://github.com/sigp/xdelta3-rs", rev = "50d63cdf1878e5cf3538e9aae5eed34a22c64e4a" }
zstd = "0.13"
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PROFILE ?= release

# List of all hard forks. This list is used to set env variables for several tests so that
# they run for different forks.
FORKS=phase0 altair bellatrix capella deneb electra
FORKS=phase0 altair bellatrix capella deneb electra fulu

# Extra flags for Cargo
CARGO_INSTALL_EXTRA_FLAGS?=
Expand Down Expand Up @@ -204,7 +204,7 @@ test-full: cargo-fmt test-release test-debug test-ef test-exec-engine
# Lints the code for bad style and potentially unsafe arithmetic using Clippy.
# Clippy lints are opt-in per-crate for now. By default, everything is allowed except for performance and correctness lints.
lint:
RUSTFLAGS="-C debug-assertions=no $(RUSTFLAGS)" cargo clippy --workspace --benches --tests $(EXTRA_CLIPPY_OPTS) --features "$(TEST_FEATURES)" -- \
cargo clippy --workspace --benches --tests $(EXTRA_CLIPPY_OPTS) --features "$(TEST_FEATURES)" -- \
-D clippy::fn_to_numeric_cast_any \
-D clippy::manual_let_else \
-D clippy::large_stack_frames \
Expand All @@ -220,6 +220,10 @@ lint:
lint-fix:
EXTRA_CLIPPY_OPTS="--fix --allow-staged --allow-dirty" $(MAKE) lint

# Also run the lints on the optimized-only tests
lint-full:
RUSTFLAGS="-C debug-assertions=no $(RUSTFLAGS)" $(MAKE) lint

# Runs the makefile in the `ef_tests` repo.
#
# May download and extract an archive of test vectors from the ethereum
Expand Down
22 changes: 11 additions & 11 deletions account_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ authors = [
edition = { workspace = true }

[dependencies]
account_utils = { workspace = true }
bls = { workspace = true }
clap = { workspace = true }
types = { workspace = true }
environment = { workspace = true }
eth2_network_config = { workspace = true }
clap_utils = { workspace = true }
directory = { workspace = true }
environment = { workspace = true }
eth2 = { workspace = true }
eth2_keystore = { workspace = true }
eth2_network_config = { workspace = true }
eth2_wallet = { workspace = true }
eth2_wallet_manager = { path = "../common/eth2_wallet_manager" }
validator_dir = { workspace = true }
tokio = { workspace = true }
eth2_keystore = { workspace = true }
account_utils = { workspace = true }
slashing_protection = { workspace = true }
eth2 = { workspace = true }
safe_arith = { workspace = true }
slot_clock = { workspace = true }
filesystem = { workspace = true }
safe_arith = { workspace = true }
sensitive_url = { workspace = true }
slashing_protection = { workspace = true }
slot_clock = { workspace = true }
tokio = { workspace = true }
types = { workspace = true }
validator_dir = { workspace = true }
zeroize = { workspace = true }

[dev-dependencies]
Expand Down
32 changes: 16 additions & 16 deletions beacon_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ write_ssz_files = [
] # Writes debugging .ssz files to /tmp during block processing.

[dependencies]
eth2_config = { workspace = true }
account_utils = { workspace = true }
beacon_chain = { workspace = true }
types = { workspace = true }
store = { workspace = true }
client = { path = "client" }
clap = { workspace = true }
slog = { workspace = true }
dirs = { workspace = true }
clap_utils = { workspace = true }
client = { path = "client" }
directory = { workspace = true }
dirs = { workspace = true }
environment = { workspace = true }
task_executor = { workspace = true }
genesis = { workspace = true }
eth2_config = { workspace = true }
execution_layer = { workspace = true }
lighthouse_network = { workspace = true }
serde_json = { workspace = true }
clap_utils = { workspace = true }
hyper = { workspace = true }
genesis = { workspace = true }
hex = { workspace = true }
slasher = { workspace = true }
http_api = { workspace = true }
hyper = { workspace = true }
lighthouse_network = { workspace = true }
monitoring_api = { workspace = true }
sensitive_url = { workspace = true }
http_api = { workspace = true }
unused_port = { workspace = true }
serde_json = { workspace = true }
slasher = { workspace = true }
slog = { workspace = true }
store = { workspace = true }
strum = { workspace = true }
account_utils = { workspace = true }
task_executor = { workspace = true }
types = { workspace = true }
unused_port = { workspace = true }
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ portable = ["bls/supranational-portable"]
test_backfill = []

[dev-dependencies]
criterion = { workspace = true }
maplit = { workspace = true }
serde_json = { workspace = true }
criterion = { workspace = true }

[dependencies]
alloy-primitives = { workspace = true }
Expand All @@ -42,11 +42,11 @@ hex = { workspace = true }
int_to_bytes = { workspace = true }
itertools = { workspace = true }
kzg = { workspace = true }
metrics = { workspace = true }
lighthouse_version = { workspace = true }
logging = { workspace = true }
lru = { workspace = true }
merkle_proof = { workspace = true }
metrics = { workspace = true }
oneshot_broadcast = { path = "../../common/oneshot_broadcast/" }
operation_pool = { workspace = true }
parking_lot = { workspace = true }
Expand Down
11 changes: 4 additions & 7 deletions beacon_node/beacon_chain/src/attestation_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.get_state(&state_root, Some(state_slot))?
.ok_or(BeaconChainError::MissingBeaconState(state_root))?;

match state {
BeaconState::Base(_) => self.compute_attestation_rewards_base(state, validators),
BeaconState::Altair(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => self.compute_attestation_rewards_altair(state, validators),
if state.fork_name_unchecked().altair_enabled() {
self.compute_attestation_rewards_altair(state, validators)
} else {
self.compute_attestation_rewards_base(state, validators)
}
}

Expand Down
9 changes: 6 additions & 3 deletions beacon_node/beacon_chain/src/beacon_block_streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use types::{
};
use types::{
ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadElectra,
ExecutionPayloadHeader,
ExecutionPayloadFulu, ExecutionPayloadHeader,
};

#[derive(PartialEq)]
Expand Down Expand Up @@ -99,6 +99,7 @@ fn reconstruct_default_header_block<E: EthSpec>(
ForkName::Capella => ExecutionPayloadCapella::default().into(),
ForkName::Deneb => ExecutionPayloadDeneb::default().into(),
ForkName::Electra => ExecutionPayloadElectra::default().into(),
ForkName::Fulu => ExecutionPayloadFulu::default().into(),
ForkName::Base | ForkName::Altair => {
return Err(Error::PayloadReconstruction(format!(
"Block with fork variant {} has execution payload",
Expand Down Expand Up @@ -742,13 +743,14 @@ mod tests {
}

#[tokio::test]
async fn check_all_blocks_from_altair_to_electra() {
async fn check_all_blocks_from_altair_to_fulu() {
let slots_per_epoch = MinimalEthSpec::slots_per_epoch() as usize;
let num_epochs = 10;
let num_epochs = 12;
let bellatrix_fork_epoch = 2usize;
let capella_fork_epoch = 4usize;
let deneb_fork_epoch = 6usize;
let electra_fork_epoch = 8usize;
let fulu_fork_epoch = 10usize;
let num_blocks_produced = num_epochs * slots_per_epoch;

let mut spec = test_spec::<MinimalEthSpec>();
Expand All @@ -757,6 +759,7 @@ mod tests {
spec.capella_fork_epoch = Some(Epoch::new(capella_fork_epoch as u64));
spec.deneb_fork_epoch = Some(Epoch::new(deneb_fork_epoch as u64));
spec.electra_fork_epoch = Some(Epoch::new(electra_fork_epoch as u64));
spec.fulu_fork_epoch = Some(Epoch::new(fulu_fork_epoch as u64));
let spec = Arc::new(spec);

let harness = get_harness(VALIDATOR_COUNT, spec.clone());
Expand Down
Loading

0 comments on commit 6f8ec54

Please sign in to comment.