Skip to content

Commit 6fb971e

Browse files
authored
Merge branch 'unstable' into vm-voluntary-exit
2 parents d327c59 + f51a292 commit 6fb971e

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

.github/workflows/test-suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ jobs:
350350
- name: Check formatting with cargo fmt
351351
run: make cargo-fmt
352352
- name: Lint code for quality and style with Clippy
353-
run: make lint
353+
run: make lint-full
354354
- name: Certify Cargo.lock freshness
355355
run: git diff --exit-code Cargo.lock
356356
- name: Typecheck benchmark code without running it

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ test-full: cargo-fmt test-release test-debug test-ef test-exec-engine
204204
# Lints the code for bad style and potentially unsafe arithmetic using Clippy.
205205
# Clippy lints are opt-in per-crate for now. By default, everything is allowed except for performance and correctness lints.
206206
lint:
207-
RUSTFLAGS="-C debug-assertions=no $(RUSTFLAGS)" cargo clippy --workspace --benches --tests $(EXTRA_CLIPPY_OPTS) --features "$(TEST_FEATURES)" -- \
207+
cargo clippy --workspace --benches --tests $(EXTRA_CLIPPY_OPTS) --features "$(TEST_FEATURES)" -- \
208208
-D clippy::fn_to_numeric_cast_any \
209209
-D clippy::manual_let_else \
210210
-D clippy::large_stack_frames \
@@ -220,6 +220,10 @@ lint:
220220
lint-fix:
221221
EXTRA_CLIPPY_OPTS="--fix --allow-staged --allow-dirty" $(MAKE) lint
222222

223+
# Also run the lints on the optimized-only tests
224+
lint-full:
225+
RUSTFLAGS="-C debug-assertions=no $(RUSTFLAGS)" $(MAKE) lint
226+
223227
# Runs the makefile in the `ef_tests` repo.
224228
#
225229
# May download and extract an archive of test vectors from the ethereum

beacon_node/lighthouse_network/gossipsub/src/behaviour.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,9 +679,15 @@ where
679679
// Gossipsub peers
680680
None => {
681681
tracing::debug!(topic=%topic_hash, "Topic not in the mesh");
682+
// `fanout_peers` is always non-empty if it's `Some`.
683+
let fanout_peers = self
684+
.fanout
685+
.get(&topic_hash)
686+
.map(|peers| if peers.is_empty() { None } else { Some(peers) })
687+
.unwrap_or(None);
682688
// If we have fanout peers add them to the map.
683-
if self.fanout.contains_key(&topic_hash) {
684-
for peer in self.fanout.get(&topic_hash).expect("Topic must exist") {
689+
if let Some(peers) = fanout_peers {
690+
for peer in peers {
685691
recipient_peers.insert(*peer);
686692
}
687693
} else {

consensus/state_processing/src/common/get_attesting_indices.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ pub mod attesting_indices_electra {
103103

104104
let committee_count_per_slot = committees.len() as u64;
105105
let mut participant_count = 0;
106-
for index in committee_indices {
106+
for committee_index in committee_indices {
107107
let beacon_committee = committees
108-
.get(index as usize)
109-
.ok_or(Error::NoCommitteeFound(index))?;
108+
.get(committee_index as usize)
109+
.ok_or(Error::NoCommitteeFound(committee_index))?;
110110

111111
// This check is new to the spec's `process_attestation` in Electra.
112-
if index >= committee_count_per_slot {
113-
return Err(BeaconStateError::InvalidCommitteeIndex(index));
112+
if committee_index >= committee_count_per_slot {
113+
return Err(BeaconStateError::InvalidCommitteeIndex(committee_index));
114114
}
115115
participant_count.safe_add_assign(beacon_committee.committee.len() as u64)?;
116116
let committee_attesters = beacon_committee
@@ -127,6 +127,12 @@ pub mod attesting_indices_electra {
127127
})
128128
.collect::<HashSet<u64>>();
129129

130+
// Require at least a single non-zero bit for each attesting committee bitfield.
131+
// This check is new to the spec's `process_attestation` in Electra.
132+
if committee_attesters.is_empty() {
133+
return Err(BeaconStateError::EmptyCommittee);
134+
}
135+
130136
attesting_indices.extend(committee_attesters);
131137
committee_offset.safe_add_assign(beacon_committee.committee.len())?;
132138
}

consensus/types/src/beacon_state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pub enum Error {
5959
UnknownValidator(usize),
6060
UnableToDetermineProducer,
6161
InvalidBitfield,
62+
EmptyCommittee,
6263
ValidatorIsWithdrawable,
6364
ValidatorIsInactive {
6465
val_index: usize,

0 commit comments

Comments
 (0)