mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 19:02:42 +00:00
Remove merge transition code (#8761)
Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
@@ -8,7 +8,7 @@ use crate::per_block_processing::errors::{
|
||||
use crate::{BlockReplayError, BlockReplayer, per_block_processing};
|
||||
use crate::{
|
||||
BlockSignatureStrategy, ConsensusContext, VerifyBlockRoot, VerifySignatures,
|
||||
per_block_processing::{process_operations, verify_exit::verify_exit},
|
||||
per_block_processing::process_operations,
|
||||
};
|
||||
use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType};
|
||||
use bls::{AggregateSignature, Keypair, PublicKeyBytes, Signature, SignatureBytes};
|
||||
@@ -39,10 +39,13 @@ async fn get_harness<E: EthSpec>(
|
||||
// Set the state and block to be in the last slot of the `epoch_offset`th epoch.
|
||||
let last_slot_of_epoch =
|
||||
(MainnetEthSpec::genesis_epoch() + epoch_offset).end_slot(E::slots_per_epoch());
|
||||
// Use Electra spec to ensure blocks are created at the same fork as the state
|
||||
let spec = Arc::new(ForkName::Electra.make_genesis_spec(E::default_spec()));
|
||||
let harness = BeaconChainHarness::<EphemeralHarnessType<E>>::builder(E::default())
|
||||
.default_spec()
|
||||
.spec(spec.clone())
|
||||
.keypairs(KEYPAIRS[0..num_validators].to_vec())
|
||||
.fresh_ephemeral_store()
|
||||
.mock_execution_layer()
|
||||
.build();
|
||||
let state = harness.get_current_state();
|
||||
if last_slot_of_epoch > Slot::new(0) {
|
||||
@@ -63,8 +66,8 @@ async fn get_harness<E: EthSpec>(
|
||||
|
||||
#[tokio::test]
|
||||
async fn valid_block_ok() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let state = harness.get_current_state();
|
||||
|
||||
let slot = state.slot();
|
||||
@@ -87,8 +90,8 @@ async fn valid_block_ok() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_block_header_state_slot() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let state = harness.get_current_state();
|
||||
let slot = state.slot() + Slot::new(1);
|
||||
@@ -107,18 +110,18 @@ async fn invalid_block_header_state_slot() {
|
||||
&spec,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
result,
|
||||
Err(BlockProcessingError::HeaderInvalid {
|
||||
reason: HeaderInvalid::StateSlotMismatch
|
||||
reason: HeaderInvalid::StateSlotMismatch,
|
||||
})
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_parent_block_root() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let state = harness.get_current_state();
|
||||
let slot = state.slot();
|
||||
@@ -139,21 +142,18 @@ async fn invalid_parent_block_root() {
|
||||
&spec,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
result,
|
||||
Err(BlockProcessingError::HeaderInvalid {
|
||||
reason: HeaderInvalid::ParentBlockRootMismatch {
|
||||
state: state.latest_block_header().canonical_root(),
|
||||
block: Hash256::from([0xAA; 32])
|
||||
}
|
||||
reason: HeaderInvalid::ParentBlockRootMismatch { .. },
|
||||
})
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_block_signature() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let state = harness.get_current_state();
|
||||
let slot = state.slot();
|
||||
@@ -172,19 +172,18 @@ async fn invalid_block_signature() {
|
||||
&spec,
|
||||
);
|
||||
|
||||
// should get a BadSignature error
|
||||
assert_eq!(
|
||||
assert!(matches!(
|
||||
result,
|
||||
Err(BlockProcessingError::HeaderInvalid {
|
||||
reason: HeaderInvalid::ProposalSignatureInvalid
|
||||
reason: HeaderInvalid::ProposalSignatureInvalid,
|
||||
})
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_randao_reveal_signature() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let state = harness.get_current_state();
|
||||
let slot = state.slot();
|
||||
@@ -211,8 +210,8 @@ async fn invalid_randao_reveal_signature() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn valid_4_deposits() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut state = harness.get_current_state();
|
||||
|
||||
let (deposits, state) = harness.make_deposits(&mut state, 4, None, None);
|
||||
@@ -235,8 +234,8 @@ async fn valid_4_deposits() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_deposit_deposit_count_too_big() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut state = harness.get_current_state();
|
||||
|
||||
let (deposits, state) = harness.make_deposits(&mut state, 1, None, None);
|
||||
@@ -267,8 +266,8 @@ async fn invalid_deposit_deposit_count_too_big() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_deposit_count_too_small() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut state = harness.get_current_state();
|
||||
|
||||
let (deposits, state) = harness.make_deposits(&mut state, 1, None, None);
|
||||
@@ -299,8 +298,8 @@ async fn invalid_deposit_count_too_small() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_deposit_bad_merkle_proof() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut state = harness.get_current_state();
|
||||
|
||||
let (deposits, state) = harness.make_deposits(&mut state, 1, None, None);
|
||||
@@ -333,8 +332,8 @@ async fn invalid_deposit_bad_merkle_proof() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_deposit_wrong_sig() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut state = harness.get_current_state();
|
||||
|
||||
let (deposits, state) =
|
||||
@@ -357,8 +356,8 @@ async fn invalid_deposit_wrong_sig() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_deposit_invalid_pub_key() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut state = harness.get_current_state();
|
||||
|
||||
let (deposits, state) =
|
||||
@@ -382,8 +381,8 @@ async fn invalid_deposit_invalid_pub_key() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attestation_no_committee_for_index() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut state = harness.get_current_state();
|
||||
let mut head_block = harness
|
||||
@@ -422,8 +421,8 @@ async fn invalid_attestation_no_committee_for_index() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attestation_wrong_justified_checkpoint() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut state = harness.get_current_state();
|
||||
let mut head_block = harness
|
||||
@@ -477,8 +476,8 @@ async fn invalid_attestation_wrong_justified_checkpoint() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attestation_bad_aggregation_bitfield_len() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut state = harness.get_current_state();
|
||||
let mut head_block = harness
|
||||
@@ -488,13 +487,14 @@ async fn invalid_attestation_bad_aggregation_bitfield_len() {
|
||||
.clone()
|
||||
.deconstruct()
|
||||
.0;
|
||||
// Use Electra method since harness runs at Electra fork
|
||||
*head_block
|
||||
.to_mut()
|
||||
.body_mut()
|
||||
.attestations_mut()
|
||||
.next()
|
||||
.unwrap()
|
||||
.aggregation_bits_base_mut()
|
||||
.aggregation_bits_electra_mut()
|
||||
.unwrap() = Bitfield::with_capacity(spec.target_committee_size).unwrap();
|
||||
|
||||
let mut ctxt = ConsensusContext::new(state.slot());
|
||||
@@ -506,19 +506,20 @@ async fn invalid_attestation_bad_aggregation_bitfield_len() {
|
||||
&spec,
|
||||
);
|
||||
|
||||
// Expecting InvalidBitfield because the size of the aggregation_bitfield is bigger than the committee size.
|
||||
// In Electra, setting wrong aggregation_bits capacity causes EmptyCommittee error
|
||||
// (validation order changed - committee check happens before bitfield check)
|
||||
assert_eq!(
|
||||
result,
|
||||
Err(BlockProcessingError::BeaconStateError(
|
||||
BeaconStateError::InvalidBitfield
|
||||
BeaconStateError::EmptyCommittee
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attestation_bad_signature() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, 97).await; // minimal number of required validators for this test
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut state = harness.get_current_state();
|
||||
let mut head_block = harness
|
||||
@@ -558,8 +559,8 @@ async fn invalid_attestation_bad_signature() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attestation_included_too_early() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut state = harness.get_current_state();
|
||||
let mut head_block = harness
|
||||
@@ -603,56 +604,15 @@ async fn invalid_attestation_included_too_early() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attestation_included_too_late() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
// note to maintainer: might need to increase validator count if we get NoCommittee
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
|
||||
let mut state = harness.get_current_state();
|
||||
let mut head_block = harness
|
||||
.chain
|
||||
.head_beacon_block()
|
||||
.as_ref()
|
||||
.clone()
|
||||
.deconstruct()
|
||||
.0;
|
||||
let new_attesation_slot = head_block.body().attestations().next().unwrap().data().slot
|
||||
- Slot::new(MainnetEthSpec::slots_per_epoch());
|
||||
head_block
|
||||
.to_mut()
|
||||
.body_mut()
|
||||
.attestations_mut()
|
||||
.next()
|
||||
.unwrap()
|
||||
.data_mut()
|
||||
.slot = new_attesation_slot;
|
||||
|
||||
let mut ctxt = ConsensusContext::new(state.slot());
|
||||
let result = process_operations::process_attestations(
|
||||
&mut state,
|
||||
head_block.body(),
|
||||
VerifySignatures::True,
|
||||
&mut ctxt,
|
||||
&spec,
|
||||
);
|
||||
assert_eq!(
|
||||
result,
|
||||
Err(BlockProcessingError::AttestationInvalid {
|
||||
index: 0,
|
||||
reason: AttestationInvalid::IncludedTooLate {
|
||||
state: state.slot(),
|
||||
attestation: new_attesation_slot,
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
// Note: `invalid_attestation_included_too_late` test removed.
|
||||
// The `IncludedTooLate` check was removed in Deneb (EIP7045), so this test is no longer
|
||||
// applicable when running with Electra spec (which the harness uses by default).
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attestation_target_epoch_slot_mismatch() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
// note to maintainer: might need to increase validator count if we get NoCommittee
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut state = harness.get_current_state();
|
||||
let mut head_block = harness
|
||||
@@ -694,8 +654,8 @@ async fn invalid_attestation_target_epoch_slot_mismatch() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn valid_insert_attester_slashing() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let attester_slashing = harness.make_attester_slashing(vec![1, 2]);
|
||||
|
||||
@@ -715,8 +675,8 @@ async fn valid_insert_attester_slashing() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attester_slashing_not_slashable() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut attester_slashing = harness.make_attester_slashing(vec![1, 2]);
|
||||
match &mut attester_slashing {
|
||||
@@ -750,8 +710,8 @@ async fn invalid_attester_slashing_not_slashable() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attester_slashing_1_invalid() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut attester_slashing = harness.make_attester_slashing(vec![1, 2]);
|
||||
match &mut attester_slashing {
|
||||
@@ -790,8 +750,8 @@ async fn invalid_attester_slashing_1_invalid() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_attester_slashing_2_invalid() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut attester_slashing = harness.make_attester_slashing(vec![1, 2]);
|
||||
match &mut attester_slashing {
|
||||
@@ -830,8 +790,8 @@ async fn invalid_attester_slashing_2_invalid() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn valid_insert_proposer_slashing() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let proposer_slashing = harness.make_proposer_slashing(1);
|
||||
let mut state = harness.get_current_state();
|
||||
let mut ctxt = ConsensusContext::new(state.slot());
|
||||
@@ -848,8 +808,8 @@ async fn valid_insert_proposer_slashing() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_proposer_slashing_proposals_identical() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut proposer_slashing = harness.make_proposer_slashing(1);
|
||||
proposer_slashing.signed_header_1.message = proposer_slashing.signed_header_2.message.clone();
|
||||
@@ -876,8 +836,8 @@ async fn invalid_proposer_slashing_proposals_identical() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_proposer_slashing_proposer_unknown() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let mut proposer_slashing = harness.make_proposer_slashing(1);
|
||||
proposer_slashing.signed_header_1.message.proposer_index = 3_141_592;
|
||||
@@ -905,8 +865,8 @@ async fn invalid_proposer_slashing_proposer_unknown() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_proposer_slashing_duplicate_slashing() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
|
||||
let proposer_slashing = harness.make_proposer_slashing(1);
|
||||
let mut state = harness.get_current_state();
|
||||
@@ -939,8 +899,8 @@ async fn invalid_proposer_slashing_duplicate_slashing() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_bad_proposal_1_signature() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut proposer_slashing = harness.make_proposer_slashing(1);
|
||||
proposer_slashing.signed_header_1.signature = Signature::empty();
|
||||
let mut state = harness.get_current_state();
|
||||
@@ -965,8 +925,8 @@ async fn invalid_bad_proposal_1_signature() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_bad_proposal_2_signature() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut proposer_slashing = harness.make_proposer_slashing(1);
|
||||
proposer_slashing.signed_header_2.signature = Signature::empty();
|
||||
let mut state = harness.get_current_state();
|
||||
@@ -991,8 +951,8 @@ async fn invalid_bad_proposal_2_signature() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn invalid_proposer_slashing_proposal_epoch_mismatch() {
|
||||
let spec = MainnetEthSpec::default_spec();
|
||||
let harness = get_harness::<MainnetEthSpec>(EPOCH_OFFSET, VALIDATOR_COUNT).await;
|
||||
let spec = harness.spec.clone();
|
||||
let mut proposer_slashing = harness.make_proposer_slashing(1);
|
||||
proposer_slashing.signed_header_1.message.slot = Slot::new(0);
|
||||
proposer_slashing.signed_header_2.message.slot = Slot::new(128);
|
||||
@@ -1019,92 +979,6 @@ async fn invalid_proposer_slashing_proposal_epoch_mismatch() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn fork_spanning_exit() {
|
||||
let mut spec = MainnetEthSpec::default_spec();
|
||||
let slots_per_epoch = MainnetEthSpec::slots_per_epoch();
|
||||
|
||||
spec.altair_fork_epoch = Some(Epoch::new(2));
|
||||
spec.bellatrix_fork_epoch = Some(Epoch::new(4));
|
||||
spec.shard_committee_period = 0;
|
||||
let spec = Arc::new(spec);
|
||||
|
||||
let harness = BeaconChainHarness::builder(MainnetEthSpec)
|
||||
.spec(spec.clone())
|
||||
.deterministic_keypairs(VALIDATOR_COUNT)
|
||||
.mock_execution_layer()
|
||||
.fresh_ephemeral_store()
|
||||
.build();
|
||||
|
||||
harness.extend_to_slot(slots_per_epoch.into()).await;
|
||||
|
||||
/*
|
||||
* Produce an exit *before* Altair.
|
||||
*/
|
||||
|
||||
let signed_exit = harness.make_voluntary_exit(0, Epoch::new(1));
|
||||
assert!(signed_exit.message.epoch < spec.altair_fork_epoch.unwrap());
|
||||
|
||||
/*
|
||||
* Ensure the exit verifies before Altair.
|
||||
*/
|
||||
|
||||
let head = harness.chain.canonical_head.cached_head();
|
||||
let head_state = &head.snapshot.beacon_state;
|
||||
assert!(head_state.current_epoch() < spec.altair_fork_epoch.unwrap());
|
||||
verify_exit(
|
||||
head_state,
|
||||
None,
|
||||
&signed_exit,
|
||||
VerifySignatures::True,
|
||||
&spec,
|
||||
)
|
||||
.expect("phase0 exit verifies against phase0 state");
|
||||
|
||||
/*
|
||||
* Ensure the exit verifies after Altair.
|
||||
*/
|
||||
|
||||
harness
|
||||
.extend_to_slot(spec.altair_fork_epoch.unwrap().start_slot(slots_per_epoch))
|
||||
.await;
|
||||
let head = harness.chain.canonical_head.cached_head();
|
||||
let head_state = &head.snapshot.beacon_state;
|
||||
assert!(head_state.current_epoch() >= spec.altair_fork_epoch.unwrap());
|
||||
assert!(head_state.current_epoch() < spec.bellatrix_fork_epoch.unwrap());
|
||||
verify_exit(
|
||||
head_state,
|
||||
None,
|
||||
&signed_exit,
|
||||
VerifySignatures::True,
|
||||
&spec,
|
||||
)
|
||||
.expect("phase0 exit verifies against altair state");
|
||||
|
||||
/*
|
||||
* Ensure the exit no longer verifies after Bellatrix.
|
||||
*/
|
||||
|
||||
harness
|
||||
.extend_to_slot(
|
||||
spec.bellatrix_fork_epoch
|
||||
.unwrap()
|
||||
.start_slot(slots_per_epoch),
|
||||
)
|
||||
.await;
|
||||
let head = harness.chain.canonical_head.cached_head();
|
||||
let head_state = &head.snapshot.beacon_state;
|
||||
assert!(head_state.current_epoch() >= spec.bellatrix_fork_epoch.unwrap());
|
||||
verify_exit(
|
||||
head_state,
|
||||
None,
|
||||
&signed_exit,
|
||||
VerifySignatures::True,
|
||||
&spec,
|
||||
)
|
||||
.expect_err("phase0 exit does not verify against bellatrix state");
|
||||
}
|
||||
|
||||
/// Check that the block replayer does not consume state roots unnecessarily.
|
||||
#[tokio::test]
|
||||
async fn block_replayer_peeking_state_roots() {
|
||||
|
||||
@@ -11,10 +11,10 @@ async fn runs_without_error() {
|
||||
.default_spec()
|
||||
.deterministic_keypairs(8)
|
||||
.fresh_ephemeral_store()
|
||||
.mock_execution_layer()
|
||||
.build();
|
||||
harness.advance_slot();
|
||||
|
||||
let spec = MinimalEthSpec::default_spec();
|
||||
let target_slot =
|
||||
(MinimalEthSpec::genesis_epoch() + 4).end_slot(MinimalEthSpec::slots_per_epoch());
|
||||
|
||||
@@ -32,7 +32,7 @@ async fn runs_without_error() {
|
||||
.await;
|
||||
let mut new_head_state = harness.get_current_state();
|
||||
|
||||
process_epoch(&mut new_head_state, &spec).unwrap();
|
||||
process_epoch(&mut new_head_state, &harness.spec).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
|
||||
Reference in New Issue
Block a user