Skip to content

Commit

Permalink
Merge of #5937
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 22, 2024
2 parents 677f96a + 1e95ab6 commit ce69c5d
Show file tree
Hide file tree
Showing 42 changed files with 874 additions and 624 deletions.
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/src/beacon_block_streamer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{metrics, BeaconChain, BeaconChainError, BeaconChainTypes, BlockProcessStatus};
use execution_layer::{ExecutionLayer, ExecutionPayloadBodyV1};
use execution_layer::{ExecutionLayer, ExecutionPayloadBody};
use slog::{crit, debug, error, Logger};
use std::collections::HashMap;
use std::sync::Arc;
Expand Down Expand Up @@ -57,7 +57,7 @@ struct BodiesByRange<E: EthSpec> {
struct BlockParts<E: EthSpec> {
blinded_block: Box<SignedBlindedBeaconBlock<E>>,
header: Box<ExecutionPayloadHeader<E>>,
body: Option<Box<ExecutionPayloadBodyV1<E>>>,
body: Option<Box<ExecutionPayloadBody<E>>>,
}

impl<E: EthSpec> BlockParts<E> {
Expand Down
2 changes: 0 additions & 2 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5531,8 +5531,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
bls_to_execution_changes: bls_to_execution_changes.into(),
blob_kzg_commitments: kzg_commitments
.ok_or(BlockProductionError::InvalidPayloadFork)?,
// TODO(electra): finish consolidations when they're more spec'd out
consolidations: Vec::new().into(),
},
}),
maybe_blobs_and_proofs,
Expand Down
12 changes: 4 additions & 8 deletions beacon_node/beacon_chain/tests/store_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1437,18 +1437,16 @@ fn check_shuffling_compatible(
head_state.current_epoch(),
|committee_cache, _| {
let state_cache = head_state.committee_cache(RelativeEpoch::Current).unwrap();
// We used to check for false negatives here, but had to remove that check
// because `shuffling_is_compatible` does not guarantee their absence.
//
// See: https://github.com/sigp/lighthouse/issues/6269
if current_epoch_shuffling_is_compatible {
assert_eq!(
committee_cache,
state_cache.as_ref(),
"block at slot {slot}"
);
} else {
assert_ne!(
committee_cache,
state_cache.as_ref(),
"block at slot {slot}"
);
}
Ok(())
},
Expand Down Expand Up @@ -1479,8 +1477,6 @@ fn check_shuffling_compatible(
let state_cache = head_state.committee_cache(RelativeEpoch::Previous).unwrap();
if previous_epoch_shuffling_is_compatible {
assert_eq!(committee_cache, state_cache.as_ref());
} else {
assert_ne!(committee_cache, state_cache.as_ref());
}
Ok(())
},
Expand Down
42 changes: 18 additions & 24 deletions beacon_node/beacon_chain/tests/validator_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use beacon_chain::test_utils::{
use beacon_chain::validator_monitor::{ValidatorMonitorConfig, MISSED_BLOCK_LAG_SLOTS};
use logging::test_logger;
use std::sync::LazyLock;
use types::{Epoch, EthSpec, Keypair, MainnetEthSpec, PublicKeyBytes, Slot};
use types::{Epoch, EthSpec, ForkName, Keypair, MainnetEthSpec, PublicKeyBytes, Slot};

// Should ideally be divisible by 3.
pub const VALIDATOR_COUNT: usize = 48;
Expand Down Expand Up @@ -128,7 +128,7 @@ async fn produces_missed_blocks() {
let initial_blocks = slots_per_epoch * nb_epoch_to_simulate.as_u64() - 1;

// The validator index of the validator that is 'supposed' to miss a block
let mut validator_index_to_monitor = 1;
let validator_index_to_monitor = 1;

// 1st scenario //
//
Expand Down Expand Up @@ -201,34 +201,22 @@ async fn produces_missed_blocks() {
// Missed block happens when slot and prev_slot are not in the same epoch
// making sure that the cache reloads when the epoch changes
// in that scenario the slot that missed a block is the first slot of the epoch
validator_index_to_monitor = 7;
// We are adding other validators to monitor as these ones will miss a block depending on
// the fork name specified when running the test as the proposer cache differs depending on
// the fork name (cf. seed)
//
// If you are adding a new fork and seeing errors, print
// `validator_indexes[slot_in_epoch.as_usize()]` and add it below.
let validator_index_to_monitor_altair = 2;
// Same as above but for the merge upgrade
let validator_index_to_monitor_bellatrix = 4;
// Same as above but for the capella upgrade
let validator_index_to_monitor_capella = 11;
// Same as above but for the deneb upgrade
let validator_index_to_monitor_deneb = 3;
// Same as above but for the electra upgrade
let validator_index_to_monitor_electra = 6;

let harness2 = get_harness(
validator_count,
vec![
validator_index_to_monitor,
validator_index_to_monitor_altair,
validator_index_to_monitor_bellatrix,
validator_index_to_monitor_capella,
validator_index_to_monitor_deneb,
validator_index_to_monitor_electra,
],
);
let validator_index_to_monitor = match harness1.spec.fork_name_at_slot::<E>(Slot::new(0)) {
ForkName::Base => 7,
ForkName::Altair => 2,
ForkName::Bellatrix => 4,
ForkName::Capella => 11,
ForkName::Deneb => 3,
ForkName::Electra => 1,
};

let harness2 = get_harness(validator_count, vec![validator_index_to_monitor]);
let advance_slot_by = 9;
harness2
.extend_chain(
Expand Down Expand Up @@ -300,6 +288,12 @@ async fn produces_missed_blocks() {
duplicate_block_root = *_state2.block_roots().get(idx as usize).unwrap();
validator_indexes = _state2.get_beacon_proposer_indices(&harness2.spec).unwrap();
let not_monitored_validator_index = validator_indexes[slot_in_epoch.as_usize()];
// This could do with a refactor: https://github.com/sigp/lighthouse/issues/6293
assert_ne!(
not_monitored_validator_index,
validator_index_to_monitor,
"this test has a fragile dependency on hardcoded indices. you need to tweak some settings or rewrite this"
);

assert_eq!(
_state2.set_block_root(prev_slot, duplicate_block_root),
Expand Down
Loading

0 comments on commit ce69c5d

Please sign in to comment.