Rename Merge to Bellatrix (#5601)

* Rename Merge to Bellatrix

* Remove tree-hash-cache which got readded from the rebase
This commit is contained in:
Mac L
2024-04-26 06:19:41 +10:00
committed by GitHub
parent 320345695d
commit 13f94ef0f3
104 changed files with 808 additions and 714 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);
}

View File

@@ -217,8 +217,8 @@ impl<T, E> SszStaticHandler<T, E> {
Self::for_forks(vec![ForkName::Altair])
}
pub fn merge_only() -> Self {
Self::for_forks(vec![ForkName::Merge])
pub fn bellatrix_only() -> Self {
Self::for_forks(vec![ForkName::Bellatrix])
}
pub fn capella_only() -> Self {
@@ -558,7 +558,7 @@ impl<E: EthSpec + TypeName> Handler for ForkChoiceHandler<E> {
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
// Merge block tests are only enabled for Bellatrix.
if self.handler_name == "on_merge_block" && fork_name != ForkName::Merge {
if self.handler_name == "on_merge_block" && fork_name != ForkName::Bellatrix {
return false;
}
@@ -823,7 +823,7 @@ impl<E: EthSpec + TypeName> Handler for KzgInclusionMerkleProofValidityHandler<E
// Enabled in Deneb
fork_name != ForkName::Base
&& fork_name != ForkName::Altair
&& fork_name != ForkName::Merge
&& fork_name != ForkName::Bellatrix
&& fork_name != ForkName::Capella
}
}

View File

@@ -46,7 +46,7 @@ type_name_generic!(BeaconBlock);
type_name_generic!(BeaconBlockBody);
type_name_generic!(BeaconBlockBodyBase, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyAltair, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyMerge, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyBellatrix, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyCapella, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyDeneb, "BeaconBlockBody");
type_name!(BeaconBlockHeader);
@@ -60,12 +60,12 @@ type_name!(DepositData);
type_name!(DepositMessage);
type_name!(Eth1Data);
type_name_generic!(ExecutionPayload);
type_name_generic!(ExecutionPayloadMerge, "ExecutionPayload");
type_name_generic!(ExecutionPayloadBellatrix, "ExecutionPayload");
type_name_generic!(ExecutionPayloadCapella, "ExecutionPayload");
type_name_generic!(ExecutionPayloadDeneb, "ExecutionPayload");
type_name_generic!(FullPayload, "ExecutionPayload");
type_name_generic!(ExecutionPayloadHeader);
type_name_generic!(ExecutionPayloadHeaderMerge, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderBellatrix, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderCapella, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderDeneb, "ExecutionPayloadHeader");
type_name_generic!(BlindedPayload, "ExecutionPayloadHeader");

View File

@@ -258,9 +258,9 @@ mod ssz_static {
.run();
SszStaticHandler::<BeaconBlockBodyAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only()
.run();
SszStaticHandler::<BeaconBlockBodyMerge<MinimalEthSpec>, MinimalEthSpec>::merge_only()
SszStaticHandler::<BeaconBlockBodyBellatrix<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<BeaconBlockBodyMerge<MainnetEthSpec>, MainnetEthSpec>::merge_only()
SszStaticHandler::<BeaconBlockBodyBellatrix<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<BeaconBlockBodyCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only()
.run();
@@ -290,10 +290,10 @@ mod ssz_static {
.run();
SszStaticHandler::<LightClientBootstrapAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only()
.run();
SszStaticHandler::<LightClientBootstrapAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only(
SszStaticHandler::<LightClientBootstrapAltair<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only(
)
.run();
SszStaticHandler::<LightClientBootstrapAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only(
SszStaticHandler::<LightClientBootstrapAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only(
)
.run();
SszStaticHandler::<LightClientBootstrapCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only()
@@ -313,9 +313,9 @@ mod ssz_static {
.run();
SszStaticHandler::<LightClientHeaderAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only()
.run();
SszStaticHandler::<LightClientHeaderAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only()
SszStaticHandler::<LightClientHeaderAltair<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<LightClientHeaderAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only()
SszStaticHandler::<LightClientHeaderAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<LightClientHeaderCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
@@ -340,10 +340,10 @@ mod ssz_static {
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only(
)
.run();
SszStaticHandler::<LightClientOptimisticUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only(
SszStaticHandler::<LightClientOptimisticUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only(
)
.run();
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only(
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only(
)
.run();
SszStaticHandler::<LightClientOptimisticUpdateCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
@@ -369,10 +369,10 @@ mod ssz_static {
SszStaticHandler::<LightClientFinalityUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only(
)
.run();
SszStaticHandler::<LightClientFinalityUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only(
SszStaticHandler::<LightClientFinalityUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only(
)
.run();
SszStaticHandler::<LightClientFinalityUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only(
SszStaticHandler::<LightClientFinalityUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only(
)
.run();
SszStaticHandler::<LightClientFinalityUpdateCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
@@ -396,9 +396,9 @@ mod ssz_static {
.run();
SszStaticHandler::<LightClientUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only()
.run();
SszStaticHandler::<LightClientUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::merge_only()
SszStaticHandler::<LightClientUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<LightClientUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::merge_only()
SszStaticHandler::<LightClientUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<LightClientUpdateCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
)
@@ -448,12 +448,12 @@ mod ssz_static {
SszStaticHandler::<SyncAggregatorSelectionData, MainnetEthSpec>::altair_and_later().run();
}
// Merge and later
// Bellatrix and later
#[test]
fn execution_payload() {
SszStaticHandler::<ExecutionPayloadMerge<MinimalEthSpec>, MinimalEthSpec>::merge_only()
SszStaticHandler::<ExecutionPayloadBellatrix<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<ExecutionPayloadMerge<MainnetEthSpec>, MainnetEthSpec>::merge_only()
SszStaticHandler::<ExecutionPayloadBellatrix<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<ExecutionPayloadCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only()
.run();
@@ -467,9 +467,9 @@ mod ssz_static {
#[test]
fn execution_payload_header() {
SszStaticHandler::<ExecutionPayloadHeaderMerge<MinimalEthSpec>, MinimalEthSpec>::merge_only()
SszStaticHandler::<ExecutionPayloadHeaderBellatrix<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<ExecutionPayloadHeaderMerge<MainnetEthSpec>, MainnetEthSpec>::merge_only()
SszStaticHandler::<ExecutionPayloadHeaderBellatrix<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only()
.run();
SszStaticHandler::<ExecutionPayloadHeaderCapella<MinimalEthSpec>, MinimalEthSpec>
::capella_only().run();