Merge remote-tracking branch 'upstream/unstable' into electra_attestation_changes

This commit is contained in:
Mark Mackey
2024-05-02 18:22:34 -05:00
156 changed files with 3625 additions and 4082 deletions

View File

@@ -63,8 +63,8 @@ pub fn previous_fork(fork_name: ForkName) -> ForkName {
match fork_name {
ForkName::Base => ForkName::Base,
ForkName::Altair => ForkName::Base,
ForkName::Merge => ForkName::Altair,
ForkName::Capella => ForkName::Merge,
ForkName::Bellatrix => ForkName::Altair,
ForkName::Capella => ForkName::Bellatrix,
ForkName::Deneb => ForkName::Capella,
ForkName::Electra => ForkName::Deneb,
}

View File

@@ -105,7 +105,7 @@ impl<E: EthSpec> EpochTransition<E> for JustificationAndFinalization {
Ok(())
}
BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => {
@@ -128,7 +128,7 @@ impl<E: EthSpec> EpochTransition<E> for RewardsAndPenalties {
base::process_rewards_and_penalties(state, &validator_statuses, spec)
}
BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => altair::process_rewards_and_penalties_slow(state, spec),
@@ -161,7 +161,7 @@ impl<E: EthSpec> EpochTransition<E> for Slashings {
)?;
}
BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => {
@@ -203,7 +203,7 @@ impl<E: EthSpec> EpochTransition<E> for RandaoMixesReset {
impl<E: EthSpec> EpochTransition<E> for HistoricalRootsUpdate {
fn run(state: &mut BeaconState<E>, _spec: &ChainSpec) -> Result<(), EpochProcessingError> {
match state {
BeaconState::Base(_) | BeaconState::Altair(_) | BeaconState::Merge(_) => {
BeaconState::Base(_) | BeaconState::Altair(_) | BeaconState::Bellatrix(_) => {
process_historical_roots_update(state)
}
_ => Ok(()),
@@ -237,7 +237,7 @@ impl<E: EthSpec> EpochTransition<E> for SyncCommitteeUpdates {
match state {
BeaconState::Base(_) => Ok(()),
BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => altair::process_sync_committee_updates(state, spec),
@@ -250,7 +250,7 @@ impl<E: EthSpec> EpochTransition<E> for InactivityUpdates {
match state {
BeaconState::Base(_) => Ok(()),
BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => altair::process_inactivity_updates_slow(state, spec),
@@ -263,7 +263,7 @@ impl<E: EthSpec> EpochTransition<E> for ParticipationFlagUpdates {
match state {
BeaconState::Base(_) => Ok(()),
BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => altair::process_participation_flag_updates(state),
@@ -313,7 +313,7 @@ impl<E: EthSpec, T: EpochTransition<E>> Case for EpochProcessing<E, T> {
&& T::name() != "historical_summaries_update"
}
// No phase0 tests for Altair and later.
ForkName::Altair | ForkName::Merge => {
ForkName::Altair | ForkName::Bellatrix => {
T::name() != "participation_record_updates"
&& T::name() != "historical_summaries_update"
}

View File

@@ -63,7 +63,9 @@ impl<E: EthSpec> Case for ForkTest<E> {
let mut result = match fork_name {
ForkName::Base => panic!("phase0 not supported"),
ForkName::Altair => upgrade_to_altair(&mut result_state, spec).map(|_| result_state),
ForkName::Merge => upgrade_to_bellatrix(&mut result_state, spec).map(|_| result_state),
ForkName::Bellatrix => {
upgrade_to_bellatrix(&mut result_state, spec).map(|_| result_state)
}
ForkName::Capella => upgrade_to_capella(&mut result_state, spec).map(|_| result_state),
ForkName::Deneb => upgrade_to_deneb(&mut result_state, spec).map(|_| result_state),
ForkName::Electra => upgrade_to_electra(&mut result_state, spec).map(|_| result_state),

View File

@@ -92,7 +92,7 @@ pub struct KzgInclusionMerkleProofValidity<E: EthSpec> {
impl<E: EthSpec> LoadCase for KzgInclusionMerkleProofValidity<E> {
fn load_from_dir(path: &Path, fork_name: ForkName) -> Result<Self, Error> {
let block: BeaconBlockBody<E, FullPayload<E>> = match fork_name {
ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => {
ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => {
return Err(Error::InternalError(format!(
"KZG inclusion merkle proof validity test skipped for {:?}",
fork_name

View File

@@ -20,8 +20,8 @@ use state_processing::{
};
use std::fmt::Debug;
use types::{
Attestation, AttesterSlashing, BeaconBlock, BeaconBlockBody, BeaconBlockBodyCapella,
BeaconBlockBodyDeneb, BeaconBlockBodyMerge, BeaconState, BlindedPayload, Deposit,
Attestation, AttesterSlashing, BeaconBlock, BeaconBlockBody, BeaconBlockBodyBellatrix,
BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconState, BlindedPayload, Deposit,
ExecutionPayload, FullPayload, ProposerSlashing, SignedBlsToExecutionChange,
SignedVoluntaryExit, SyncAggregate,
};
@@ -99,7 +99,7 @@ impl<E: EthSpec> Operation<E> for Attestation<E> {
spec,
),
BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => {
@@ -289,7 +289,7 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, FullPayload<E>> {
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
ssz_decode_file_with(path, |bytes| {
Ok(match fork_name {
ForkName::Merge => BeaconBlockBody::Merge(<_>::from_ssz_bytes(bytes)?),
ForkName::Bellatrix => BeaconBlockBody::Bellatrix(<_>::from_ssz_bytes(bytes)?),
ForkName::Capella => BeaconBlockBody::Capella(<_>::from_ssz_bytes(bytes)?),
ForkName::Deneb => BeaconBlockBody::Deneb(<_>::from_ssz_bytes(bytes)?),
_ => panic!(),
@@ -330,9 +330,10 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, BlindedPayload<E>> {
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
ssz_decode_file_with(path, |bytes| {
Ok(match fork_name {
ForkName::Merge => {
let inner = <BeaconBlockBodyMerge<E, FullPayload<E>>>::from_ssz_bytes(bytes)?;
BeaconBlockBody::Merge(inner.clone_as_blinded())
ForkName::Bellatrix => {
let inner =
<BeaconBlockBodyBellatrix<E, FullPayload<E>>>::from_ssz_bytes(bytes)?;
BeaconBlockBody::Bellatrix(inner.clone_as_blinded())
}
ForkName::Capella => {
let inner = <BeaconBlockBodyCapella<E, FullPayload<E>>>::from_ssz_bytes(bytes)?;
@@ -375,7 +376,9 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
}
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
fork_name != ForkName::Base && fork_name != ForkName::Altair && fork_name != ForkName::Merge
fork_name != ForkName::Base
&& fork_name != ForkName::Altair
&& fork_name != ForkName::Bellatrix
}
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
@@ -407,7 +410,9 @@ impl<E: EthSpec> Operation<E> for SignedBlsToExecutionChange {
}
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
fork_name != ForkName::Base && fork_name != ForkName::Altair && fork_name != ForkName::Merge
fork_name != ForkName::Base
&& fork_name != ForkName::Altair
&& fork_name != ForkName::Bellatrix
}
fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {

View File

@@ -38,7 +38,7 @@ impl<E: EthSpec> LoadCase for TransitionTest<E> {
ForkName::Altair => {
spec.altair_fork_epoch = Some(metadata.fork_epoch);
}
ForkName::Merge => {
ForkName::Bellatrix => {
spec.altair_fork_epoch = Some(Epoch::new(0));
spec.bellatrix_fork_epoch = Some(metadata.fork_epoch);
}