Skip to content

Commit eefa6e5

Browse files
committed
Merge remote-tracking branch 'origin/unstable' into anchor_slot_pruning
2 parents 7c414cc + a244aa3 commit eefa6e5

File tree

71 files changed

+354
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+354
-186
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
beacon_node/network/ @jxs
2+
beacon_node/lighthouse_network/ @jxs

.github/workflows/test-suite.yml

Lines changed: 5 additions & 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
@@ -392,6 +392,10 @@ jobs:
392392
cache: false
393393
env:
394394
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
395+
- name: Fetch libssl1.1
396+
run: wget https://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
397+
- name: Install libssl1.1
398+
run: sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
395399
- name: Create Cargo config dir
396400
run: mkdir -p .cargo
397401
- name: Install custom Cargo config

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/beacon_chain/src/beacon_chain.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
573573
.start_slot(T::EthSpec::slots_per_epoch());
574574
let is_canonical = self
575575
.block_root_at_slot(block_slot, WhenSlotSkipped::None)?
576-
.map_or(false, |canonical_root| block_root == &canonical_root);
576+
.is_some_and(|canonical_root| block_root == &canonical_root);
577577
Ok(block_slot <= finalized_slot && is_canonical)
578578
}
579579

@@ -604,7 +604,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
604604
let slot_is_finalized = state_slot <= finalized_slot;
605605
let canonical = self
606606
.state_root_at_slot(state_slot)?
607-
.map_or(false, |canonical_root| state_root == &canonical_root);
607+
.is_some_and(|canonical_root| state_root == &canonical_root);
608608
Ok(FinalizationAndCanonicity {
609609
slot_is_finalized,
610610
canonical,
@@ -5118,9 +5118,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
51185118
.start_of(slot)
51195119
.unwrap_or_else(|| Duration::from_secs(0)),
51205120
);
5121-
block_delays.observed.map_or(false, |delay| {
5122-
delay >= self.slot_clock.unagg_attestation_production_delay()
5123-
})
5121+
block_delays
5122+
.observed
5123+
.is_some_and(|delay| delay >= self.slot_clock.unagg_attestation_production_delay())
51245124
}
51255125

51265126
/// Produce a block for some `slot` upon the given `state`.

beacon_node/beacon_chain/src/canonical_head.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,11 +1254,7 @@ pub fn find_reorg_slot<E: EthSpec>(
12541254
($state: ident, $block_root: ident) => {
12551255
std::iter::once(Ok(($state.slot(), $block_root)))
12561256
.chain($state.rev_iter_block_roots(spec))
1257-
.skip_while(|result| {
1258-
result
1259-
.as_ref()
1260-
.map_or(false, |(slot, _)| *slot > lowest_slot)
1261-
})
1257+
.skip_while(|result| result.as_ref().is_ok_and(|(slot, _)| *slot > lowest_slot))
12621258
};
12631259
}
12641260

beacon_node/beacon_chain/src/data_availability_checker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,13 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
519519
/// Returns true if the given epoch lies within the da boundary and false otherwise.
520520
pub fn da_check_required_for_epoch(&self, block_epoch: Epoch) -> bool {
521521
self.data_availability_boundary()
522-
.map_or(false, |da_epoch| block_epoch >= da_epoch)
522+
.is_some_and(|da_epoch| block_epoch >= da_epoch)
523523
}
524524

525525
/// Returns `true` if the current epoch is greater than or equal to the `Deneb` epoch.
526526
pub fn is_deneb(&self) -> bool {
527-
self.slot_clock.now().map_or(false, |slot| {
528-
self.spec.deneb_fork_epoch.map_or(false, |deneb_epoch| {
527+
self.slot_clock.now().is_some_and(|slot| {
528+
self.spec.deneb_fork_epoch.is_some_and(|deneb_epoch| {
529529
let now_epoch = slot.epoch(T::EthSpec::slots_per_epoch());
530530
now_epoch >= deneb_epoch
531531
})

beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,10 @@ impl<E: EthSpec> PendingComponents<E> {
228228
);
229229

230230
let all_blobs_received = block_kzg_commitments_count_opt
231-
.map_or(false, |num_expected_blobs| {
232-
num_expected_blobs == num_received_blobs
233-
});
231+
.is_some_and(|num_expected_blobs| num_expected_blobs == num_received_blobs);
234232

235-
let all_columns_received = expected_columns_opt.map_or(false, |num_expected_columns| {
236-
num_expected_columns == num_received_columns
237-
});
233+
let all_columns_received = expected_columns_opt
234+
.is_some_and(|num_expected_columns| num_expected_columns == num_received_columns);
238235

239236
all_blobs_received || all_columns_received
240237
}

beacon_node/beacon_chain/src/early_attester_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<E: EthSpec> EarlyAttesterCache<E> {
145145
self.item
146146
.read()
147147
.as_ref()
148-
.map_or(false, |item| item.beacon_block_root == block_root)
148+
.is_some_and(|item| item.beacon_block_root == block_root)
149149
}
150150

151151
/// Returns the block, if `block_root` matches the cached item.

beacon_node/beacon_chain/src/eth1_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fn get_sync_status<E: EthSpec>(
153153
// Lighthouse is "cached and ready" when it has cached enough blocks to cover the start of the
154154
// current voting period.
155155
let lighthouse_is_cached_and_ready =
156-
latest_cached_block_timestamp.map_or(false, |t| t >= voting_target_timestamp);
156+
latest_cached_block_timestamp.is_some_and(|t| t >= voting_target_timestamp);
157157

158158
Some(Eth1SyncStatusData {
159159
head_block_number,

beacon_node/beacon_chain/src/execution_payload.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ impl<T: BeaconChainTypes> PayloadNotifier<T> {
127127
/// contains a few extra checks by running `partially_verify_execution_payload` first:
128128
///
129129
/// https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#notify_new_payload
130-
async fn notify_new_payload<'a, T: BeaconChainTypes>(
130+
async fn notify_new_payload<T: BeaconChainTypes>(
131131
chain: &Arc<BeaconChain<T>>,
132-
block: BeaconBlockRef<'a, T::EthSpec>,
132+
block: BeaconBlockRef<'_, T::EthSpec>,
133133
) -> Result<PayloadVerificationStatus, BlockError> {
134134
let execution_layer = chain
135135
.execution_layer
@@ -230,9 +230,9 @@ async fn notify_new_payload<'a, T: BeaconChainTypes>(
230230
/// Equivalent to the `validate_merge_block` function in the merge Fork Choice Changes:
231231
///
232232
/// https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/fork-choice.md#validate_merge_block
233-
pub async fn validate_merge_block<'a, T: BeaconChainTypes>(
233+
pub async fn validate_merge_block<T: BeaconChainTypes>(
234234
chain: &Arc<BeaconChain<T>>,
235-
block: BeaconBlockRef<'a, T::EthSpec>,
235+
block: BeaconBlockRef<'_, T::EthSpec>,
236236
allow_optimistic_import: AllowOptimisticImport,
237237
) -> Result<(), BlockError> {
238238
let spec = &chain.spec;

0 commit comments

Comments
 (0)