From 7803b8aed9b4dca05a3c255e57140b060ec23e0a Mon Sep 17 00:00:00 2001 From: Mac L Date: Thu, 18 Apr 2024 19:07:02 +1000 Subject: [PATCH] Rename Merge to Bellatrix --- Makefile | 2 +- .../beacon_chain/src/attestation_rewards.rs | 2 +- .../src/attestation_verification.rs | 4 +- .../beacon_chain/src/beacon_block_streamer.rs | 6 +- beacon_node/beacon_chain/src/beacon_chain.rs | 16 +-- ...ge_readiness.rs => bellatrix_readiness.rs} | 34 +++--- .../beacon_chain/src/capella_readiness.rs | 2 +- .../overflow_lru_cache.rs | 10 +- .../beacon_chain/src/deneb_readiness.rs | 2 +- .../beacon_chain/src/electra_readiness.rs | 2 +- .../beacon_chain/src/execution_payload.rs | 14 +-- beacon_node/beacon_chain/src/lib.rs | 2 +- beacon_node/beacon_chain/src/test_utils.rs | 4 +- .../tests/attestation_verification.rs | 20 ++-- .../tests/{merge.rs => bellatrix.rs} | 42 ++++---- beacon_node/beacon_chain/tests/capella.rs | 40 +++---- beacon_node/beacon_chain/tests/main.rs | 2 +- .../beacon_chain/tests/validator_monitor.rs | 4 +- beacon_node/client/src/notifier.rs | 24 ++--- beacon_node/execution_layer/src/block_hash.rs | 2 +- beacon_node/execution_layer/src/engine_api.rs | 69 ++++++------ .../execution_layer/src/engine_api/http.rs | 26 ++--- .../src/engine_api/json_structures.rs | 14 +-- .../src/engine_api/new_payload_request.rs | 40 ++++--- beacon_node/execution_layer/src/lib.rs | 44 ++++---- .../test_utils/execution_block_generator.rs | 20 ++-- .../src/test_utils/handle_rpc.rs | 6 +- .../src/test_utils/mock_builder.rs | 30 +++--- .../src/test_utils/mock_execution_layer.rs | 4 +- .../http_api/src/build_block_contents.rs | 2 +- beacon_node/http_api/src/builder_states.rs | 2 +- beacon_node/http_api/src/lib.rs | 2 +- beacon_node/http_api/src/publish_blocks.rs | 10 +- beacon_node/lighthouse_network/src/config.rs | 6 +- .../lighthouse_network/src/rpc/codec/base.rs | 6 +- .../src/rpc/codec/ssz_snappy.rs | 86 ++++++++------- .../lighthouse_network/src/rpc/protocol.rs | 40 ++++--- .../lighthouse_network/src/types/pubsub.rs | 10 +- .../lighthouse_network/src/types/topics.rs | 2 +- .../lighthouse_network/tests/common.rs | 6 +- .../lighthouse_network/tests/rpc_tests.rs | 59 +++++----- .../network_beacon_processor/rpc_methods.rs | 7 +- .../store/src/impls/execution_payload.rs | 9 +- beacon_node/store/src/partial_beacon_state.rs | 30 +++--- common/eth2/src/types.rs | 12 +-- .../gnosis/config.yaml | 2 +- .../holesky/config.yaml | 2 +- .../sepolia/config.yaml | 2 +- common/slot_clock/src/lib.rs | 2 +- consensus/fork_choice/src/fork_choice.rs | 4 +- .../common/get_attestation_participation.rs | 2 +- .../src/common/slash_validator.rs | 2 +- consensus/state_processing/src/genesis.rs | 6 +- .../src/per_block_processing.rs | 10 +- .../process_operations.rs | 2 +- .../per_block_processing/signature_sets.rs | 2 +- .../verify_attestation.rs | 2 +- .../src/per_epoch_processing.rs | 2 +- .../src/per_slot_processing.rs | 2 +- consensus/state_processing/src/upgrade.rs | 4 +- .../src/upgrade/{merge.rs => bellatrix.rs} | 10 +- .../state_processing/src/upgrade/capella.rs | 4 +- consensus/types/src/beacon_block.rs | 24 ++--- consensus/types/src/beacon_block_body.rs | 45 ++++---- consensus/types/src/beacon_state.rs | 38 +++---- .../progressive_balances_cache.rs | 2 +- .../types/src/beacon_state/tree_hash_cache.rs | 2 +- consensus/types/src/builder_bid.rs | 14 +-- consensus/types/src/chain_spec.rs | 22 ++-- consensus/types/src/consts.rs | 2 +- consensus/types/src/eth_spec.rs | 2 +- consensus/types/src/execution_payload.rs | 16 +-- .../types/src/execution_payload_header.rs | 26 +++-- consensus/types/src/fork_context.rs | 6 +- consensus/types/src/fork_name.rs | 28 ++--- .../types/src/fork_versioned_response.rs | 9 +- consensus/types/src/lib.rs | 28 ++--- consensus/types/src/light_client_bootstrap.rs | 6 +- .../types/src/light_client_finality_update.rs | 6 +- consensus/types/src/light_client_header.rs | 8 +- .../src/light_client_optimistic_update.rs | 20 ++-- consensus/types/src/light_client_update.rs | 4 +- consensus/types/src/payload.rs | 102 ++++++++++-------- consensus/types/src/signed_beacon_block.rs | 49 +++++---- consensus/types/src/voluntary_exit.rs | 2 +- lcli/src/create_payload_header.rs | 11 +- lcli/src/main.rs | 2 +- lcli/src/new_testnet.rs | 18 ++-- lcli/src/parse_ssz.rs | 12 ++- .../environment/tests/testnet_dir/config.yaml | 2 +- lighthouse/tests/beacon_node.rs | 14 +-- testing/ef_tests/src/cases/common.rs | 4 +- .../ef_tests/src/cases/epoch_processing.rs | 16 +-- testing/ef_tests/src/cases/fork.rs | 4 +- .../src/cases/merkle_proof_validity.rs | 2 +- testing/ef_tests/src/cases/operations.rs | 23 ++-- testing/ef_tests/src/cases/transition.rs | 2 +- testing/ef_tests/src/handler.rs | 8 +- testing/ef_tests/src/type_name.rs | 6 +- testing/ef_tests/tests/tests.rs | 34 +++--- testing/web3signer_tests/src/lib.rs | 41 ++++--- .../src/signing_method/web3signer.rs | 2 +- validator_client/src/validator_store.rs | 2 +- watch/src/database/mod.rs | 2 +- 104 files changed, 798 insertions(+), 704 deletions(-) rename beacon_node/beacon_chain/src/{merge_readiness.rs => bellatrix_readiness.rs} (91%) rename beacon_node/beacon_chain/tests/{merge.rs => bellatrix.rs} (81%) rename consensus/state_processing/src/upgrade/{merge.rs => bellatrix.rs} (90%) diff --git a/Makefile b/Makefile index 4b2d0f6c5d5..36fda0799d1 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ PROFILE ?= release # List of all hard forks. This list is used to set env variables for several tests so that # they run for different forks. -FORKS=phase0 altair merge capella deneb electra +FORKS=phase0 altair bellatrix capella deneb electra # Extra flags for Cargo CARGO_INSTALL_EXTRA_FLAGS?= diff --git a/beacon_node/beacon_chain/src/attestation_rewards.rs b/beacon_node/beacon_chain/src/attestation_rewards.rs index 491b7ef7da9..d48a83130e6 100644 --- a/beacon_node/beacon_chain/src/attestation_rewards.rs +++ b/beacon_node/beacon_chain/src/attestation_rewards.rs @@ -54,7 +54,7 @@ impl BeaconChain { match state { BeaconState::Base(_) => self.compute_attestation_rewards_base(state, validators), BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => self.compute_attestation_rewards_altair(state, validators), diff --git a/beacon_node/beacon_chain/src/attestation_verification.rs b/beacon_node/beacon_chain/src/attestation_verification.rs index f3bde8678e1..471c43d94f8 100644 --- a/beacon_node/beacon_chain/src/attestation_verification.rs +++ b/beacon_node/beacon_chain/src/attestation_verification.rs @@ -1063,7 +1063,9 @@ pub fn verify_propagation_slot_range( let current_fork = spec.fork_name_at_slot::(slot_clock.now().ok_or(BeaconChainError::UnableToReadSlot)?); let earliest_permissible_slot = match current_fork { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => one_epoch_prior, + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => { + one_epoch_prior + } // EIP-7045 ForkName::Deneb | ForkName::Electra => one_epoch_prior .epoch(E::slots_per_epoch()) diff --git a/beacon_node/beacon_chain/src/beacon_block_streamer.rs b/beacon_node/beacon_chain/src/beacon_block_streamer.rs index 4f413ce2a86..0c92b7c1f62 100644 --- a/beacon_node/beacon_chain/src/beacon_block_streamer.rs +++ b/beacon_node/beacon_chain/src/beacon_block_streamer.rs @@ -14,8 +14,8 @@ use types::{ SignedBlindedBeaconBlock, Slot, }; use types::{ - ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadElectra, ExecutionPayloadHeader, - ExecutionPayloadMerge, + ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadElectra, + ExecutionPayloadHeader, }; #[derive(PartialEq)] @@ -95,7 +95,7 @@ fn reconstruct_default_header_block( .map_err(BeaconChainError::InconsistentFork)?; let payload: ExecutionPayload = match fork { - ForkName::Merge => ExecutionPayloadMerge::default().into(), + ForkName::Bellatrix => ExecutionPayloadBellatrix::default().into(), ForkName::Capella => ExecutionPayloadCapella::default().into(), ForkName::Deneb => ExecutionPayloadDeneb::default().into(), ForkName::Electra => ExecutionPayloadElectra::default().into(), diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index b3790024f81..f054eb91187 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -2541,7 +2541,7 @@ impl BeaconChain { /// Check if the current slot is greater than or equal to the Capella fork epoch. pub fn current_slot_is_post_capella(&self) -> Result { let current_fork = self.spec.fork_name_at_slot::(self.slot()?); - if let ForkName::Base | ForkName::Altair | ForkName::Merge = current_fork { + if let ForkName::Base | ForkName::Altair | ForkName::Bellatrix = current_fork { Ok(false) } else { Ok(true) @@ -4940,7 +4940,7 @@ impl BeaconChain { // allows it to run concurrently with things like attestation packing. let prepare_payload_handle = match &state { BeaconState::Base(_) | BeaconState::Altair(_) => None, - BeaconState::Merge(_) + BeaconState::Bellatrix(_) | BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => { @@ -5206,17 +5206,17 @@ impl BeaconChain { None, Uint256::zero(), ), - BeaconState::Merge(_) => { + BeaconState::Bellatrix(_) => { let block_proposal_contents = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?; let execution_payload_value = block_proposal_contents.block_value().to_owned(); ( - BeaconBlock::Merge(BeaconBlockMerge { + BeaconBlock::Bellatrix(BeaconBlockBellatrix { slot, proposer_index, parent_root, state_root: Hash256::zero(), - body: BeaconBlockBodyMerge { + body: BeaconBlockBodyBellatrix { randao_reveal, eth1_data, graffiti, @@ -5665,7 +5665,7 @@ impl BeaconChain { } else { let prepare_slot_fork = self.spec.fork_name_at_slot::(prepare_slot); let withdrawals = match prepare_slot_fork { - ForkName::Base | ForkName::Altair | ForkName::Merge => None, + ForkName::Base | ForkName::Altair | ForkName::Bellatrix => None, ForkName::Capella | ForkName::Deneb | ForkName::Electra => { let chain = self.clone(); self.spawn_blocking_handle( @@ -5680,7 +5680,7 @@ impl BeaconChain { }; let parent_beacon_block_root = match prepare_slot_fork { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => None, + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => None, ForkName::Deneb | ForkName::Electra => { Some(pre_payload_attributes.parent_beacon_block_root) } @@ -6724,7 +6724,7 @@ impl BeaconChain { match fork_name { ForkName::Altair - | ForkName::Merge + | ForkName::Bellatrix | ForkName::Capella | ForkName::Deneb | ForkName::Electra => { diff --git a/beacon_node/beacon_chain/src/merge_readiness.rs b/beacon_node/beacon_chain/src/bellatrix_readiness.rs similarity index 91% rename from beacon_node/beacon_chain/src/merge_readiness.rs rename to beacon_node/beacon_chain/src/bellatrix_readiness.rs index 52a5ea912e0..bf9e8481261 100644 --- a/beacon_node/beacon_chain/src/merge_readiness.rs +++ b/beacon_node/beacon_chain/src/bellatrix_readiness.rs @@ -11,7 +11,7 @@ use types::*; /// The time before the Bellatrix fork when we will start issuing warnings about preparation. pub const SECONDS_IN_A_WEEK: u64 = 604800; -pub const MERGE_READINESS_PREPARATION_SECONDS: u64 = SECONDS_IN_A_WEEK * 2; +pub const BELLATRIX_READINESS_PREPARATION_SECONDS: u64 = SECONDS_IN_A_WEEK * 2; #[derive(Default, Debug, Serialize, Deserialize)] pub struct MergeConfig { @@ -81,7 +81,7 @@ impl MergeConfig { #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] #[serde(tag = "type")] -pub enum MergeReadiness { +pub enum BellatrixReadiness { /// The node is ready, as far as we can tell. Ready { config: MergeConfig, @@ -94,29 +94,29 @@ pub enum MergeReadiness { NoExecutionEndpoint, } -impl fmt::Display for MergeReadiness { +impl fmt::Display for BellatrixReadiness { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - MergeReadiness::Ready { + BellatrixReadiness::Ready { config: params, current_difficulty, } => { write!( f, - "This node appears ready for the merge. \ + "This node appears ready for Bellatrix \ Params: {}, current_difficulty: {:?}", params, current_difficulty ) } - MergeReadiness::NotSynced => write!( + BellatrixReadiness::NotSynced => write!( f, "The execution endpoint is connected and configured, \ however it is not yet synced" ), - MergeReadiness::NoExecutionEndpoint => write!( + BellatrixReadiness::NoExecutionEndpoint => write!( f, "The --execution-endpoint flag is not specified, this is a \ - requirement for the merge" + requirement for Bellatrix" ), } } @@ -143,12 +143,12 @@ pub enum GenesisExecutionPayloadStatus { impl BeaconChain { /// Returns `true` if user has an EL configured, or if the Bellatrix fork has occurred or will - /// occur within `MERGE_READINESS_PREPARATION_SECONDS`. + /// occur within `BELLATRIX_READINESS_PREPARATION_SECONDS`. pub fn is_time_to_prepare_for_bellatrix(&self, current_slot: Slot) -> bool { if let Some(bellatrix_epoch) = self.spec.bellatrix_fork_epoch { let bellatrix_slot = bellatrix_epoch.start_slot(T::EthSpec::slots_per_epoch()); - let merge_readiness_preparation_slots = - MERGE_READINESS_PREPARATION_SECONDS / self.spec.seconds_per_slot; + let bellatrix_readiness_preparation_slots = + BELLATRIX_READINESS_PREPARATION_SECONDS / self.spec.seconds_per_slot; if self.execution_layer.is_some() { // The user has already configured an execution layer, start checking for readiness @@ -156,7 +156,7 @@ impl BeaconChain { true } else { // Return `true` if Bellatrix has happened or is within the preparation time. - current_slot + merge_readiness_preparation_slots > bellatrix_slot + current_slot + bellatrix_readiness_preparation_slots > bellatrix_slot } } else { // The Bellatrix fork epoch has not been defined yet, no need to prepare. @@ -164,22 +164,22 @@ impl BeaconChain { } } - /// Attempts to connect to the EL and confirm that it is ready for the merge. - pub async fn check_merge_readiness(&self, current_slot: Slot) -> MergeReadiness { + /// Attempts to connect to the EL and confirm that it is ready for Bellatrix. + pub async fn check_bellatrix_readiness(&self, current_slot: Slot) -> BellatrixReadiness { if let Some(el) = self.execution_layer.as_ref() { if !el.is_synced_for_notifier(current_slot).await { // The EL is not synced. - return MergeReadiness::NotSynced; + return BellatrixReadiness::NotSynced; } let params = MergeConfig::from_chainspec(&self.spec); let current_difficulty = el.get_current_difficulty().await.ok(); - MergeReadiness::Ready { + BellatrixReadiness::Ready { config: params, current_difficulty, } } else { // There is no EL configured. - MergeReadiness::NoExecutionEndpoint + BellatrixReadiness::NoExecutionEndpoint } } diff --git a/beacon_node/beacon_chain/src/capella_readiness.rs b/beacon_node/beacon_chain/src/capella_readiness.rs index cde71d462d7..88af7db0aaa 100644 --- a/beacon_node/beacon_chain/src/capella_readiness.rs +++ b/beacon_node/beacon_chain/src/capella_readiness.rs @@ -10,7 +10,7 @@ use std::time::Duration; use types::*; /// The time before the Capella fork when we will start issuing warnings about preparation. -use super::merge_readiness::SECONDS_IN_A_WEEK; +use super::bellatrix_readiness::SECONDS_IN_A_WEEK; pub const CAPELLA_READINESS_PREPARATION_SECONDS: u64 = SECONDS_IN_A_WEEK * 2; pub const ENGINE_CAPABILITIES_REFRESH_INTERVAL: u64 = 300; diff --git a/beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs b/beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs index edd981e6ddb..ba79802d69a 100644 --- a/beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs +++ b/beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs @@ -982,17 +982,17 @@ mod test { // go to bellatrix slot harness.extend_to_slot(bellatrix_fork_slot).await; - let merge_head = &harness.chain.head_snapshot().beacon_block; - assert!(merge_head.as_merge().is_ok()); - assert_eq!(merge_head.slot(), bellatrix_fork_slot); + let bellatrix_head = &harness.chain.head_snapshot().beacon_block; + assert!(bellatrix_head.as_bellatrix().is_ok()); + assert_eq!(bellatrix_head.slot(), bellatrix_fork_slot); assert!( - merge_head + bellatrix_head .message() .body() .execution_payload() .unwrap() .is_default_with_empty_roots(), - "Merge head is default payload" + "Bellatrix head is default payload" ); // Trigger the terminal PoW block. harness diff --git a/beacon_node/beacon_chain/src/deneb_readiness.rs b/beacon_node/beacon_chain/src/deneb_readiness.rs index 1ba6fe3ea6c..e11070a1f4f 100644 --- a/beacon_node/beacon_chain/src/deneb_readiness.rs +++ b/beacon_node/beacon_chain/src/deneb_readiness.rs @@ -10,7 +10,7 @@ use std::time::Duration; use types::*; /// The time before the Deneb fork when we will start issuing warnings about preparation. -use super::merge_readiness::SECONDS_IN_A_WEEK; +use super::bellatrix_readiness::SECONDS_IN_A_WEEK; pub const DENEB_READINESS_PREPARATION_SECONDS: u64 = SECONDS_IN_A_WEEK * 2; pub const ENGINE_CAPABILITIES_REFRESH_INTERVAL: u64 = 300; diff --git a/beacon_node/beacon_chain/src/electra_readiness.rs b/beacon_node/beacon_chain/src/electra_readiness.rs index 0e911bf37ec..42ee743fe6b 100644 --- a/beacon_node/beacon_chain/src/electra_readiness.rs +++ b/beacon_node/beacon_chain/src/electra_readiness.rs @@ -11,7 +11,7 @@ use std::time::Duration; use types::*; /// The time before the Electra fork when we will start issuing warnings about preparation. -use super::merge_readiness::SECONDS_IN_A_WEEK; +use super::bellatrix_readiness::SECONDS_IN_A_WEEK; pub const ELECTRA_READINESS_PREPARATION_SECONDS: u64 = SECONDS_IN_A_WEEK * 2; pub const ENGINE_CAPABILITIES_REFRESH_INTERVAL: u64 = 300; diff --git a/beacon_node/beacon_chain/src/execution_payload.rs b/beacon_node/beacon_chain/src/execution_payload.rs index b3804f0d23a..cbffe363422 100644 --- a/beacon_node/beacon_chain/src/execution_payload.rs +++ b/beacon_node/beacon_chain/src/execution_payload.rs @@ -336,7 +336,7 @@ pub fn validate_execution_payload_for_gossip( block: BeaconBlockRef<'_, T::EthSpec>, chain: &BeaconChain, ) -> Result<(), BlockError> { - // Only apply this validation if this is a merge beacon block. + // Only apply this validation if this is a Bellatrix beacon block. if let Ok(execution_payload) = block.body().execution_payload() { // This logic should match `is_execution_enabled`. We use only the execution block hash of // the parent here in order to avoid loading the parent state during gossip verification. @@ -385,7 +385,7 @@ pub fn validate_execution_payload_for_gossip( /// ## Errors /// /// Will return an error when using a pre-merge fork `state`. Ensure to only run this function -/// after the merge fork. +/// after the Bellatrix fork. /// /// ## Specification /// @@ -415,13 +415,13 @@ pub fn get_execution_payload( &BeaconState::Capella(_) | &BeaconState::Deneb(_) | &BeaconState::Electra(_) => { Some(get_expected_withdrawals(state, spec)?.into()) } - &BeaconState::Merge(_) => None, + &BeaconState::Bellatrix(_) => None, // These shouldn't happen but they're here to make the pattern irrefutable &BeaconState::Base(_) | &BeaconState::Altair(_) => None, }; let parent_beacon_block_root = match state { BeaconState::Deneb(_) | BeaconState::Electra(_) => Some(parent_block_root), - BeaconState::Merge(_) | BeaconState::Capella(_) => None, + BeaconState::Bellatrix(_) | BeaconState::Capella(_) => None, // These shouldn't happen but they're here to make the pattern irrefutable BeaconState::Base(_) | BeaconState::Altair(_) => None, }; @@ -457,12 +457,12 @@ pub fn get_execution_payload( /// Prepares an execution payload for inclusion in a block. /// -/// Will return `Ok(None)` if the merge fork has occurred, but a terminal block has not been found. +/// Will return `Ok(None)` if the Bellatrix fork has occurred, but a terminal block has not been found. /// /// ## Errors /// -/// Will return an error when using a pre-merge fork `state`. Ensure to only run this function -/// after the merge fork. +/// Will return an error when using a pre-Bellatrix fork `state`. Ensure to only run this function +/// after the Bellatrix fork. /// /// ## Specification /// diff --git a/beacon_node/beacon_chain/src/lib.rs b/beacon_node/beacon_chain/src/lib.rs index 71c96d0fd55..fbd12576352 100644 --- a/beacon_node/beacon_chain/src/lib.rs +++ b/beacon_node/beacon_chain/src/lib.rs @@ -8,6 +8,7 @@ mod beacon_chain; mod beacon_fork_choice_store; pub mod beacon_proposer_cache; mod beacon_snapshot; +pub mod bellatrix_readiness; pub mod blob_verification; pub mod block_reward; mod block_times_cache; @@ -34,7 +35,6 @@ pub mod kzg_utils; pub mod light_client_finality_update_verification; pub mod light_client_optimistic_update_verification; mod light_client_server_cache; -pub mod merge_readiness; pub mod metrics; pub mod migrate; mod naive_aggregation_pool; diff --git a/beacon_node/beacon_chain/src/test_utils.rs b/beacon_node/beacon_chain/src/test_utils.rs index 542262487ae..f9f117c3067 100644 --- a/beacon_node/beacon_chain/src/test_utils.rs +++ b/beacon_node/beacon_chain/src/test_utils.rs @@ -889,7 +889,7 @@ where let block_contents: SignedBlockContentsTuple = match *signed_block { SignedBeaconBlock::Base(_) | SignedBeaconBlock::Altair(_) - | SignedBeaconBlock::Merge(_) + | SignedBeaconBlock::Bellatrix(_) | SignedBeaconBlock::Capella(_) => (signed_block, None), SignedBeaconBlock::Deneb(_) | SignedBeaconBlock::Electra(_) => { (signed_block, block_response.blob_items) @@ -953,7 +953,7 @@ where let block_contents: SignedBlockContentsTuple = match *signed_block { SignedBeaconBlock::Base(_) | SignedBeaconBlock::Altair(_) - | SignedBeaconBlock::Merge(_) + | SignedBeaconBlock::Bellatrix(_) | SignedBeaconBlock::Capella(_) => (signed_block, None), SignedBeaconBlock::Deneb(_) | SignedBeaconBlock::Electra(_) => { (signed_block, block_response.blob_items) diff --git a/beacon_node/beacon_chain/tests/attestation_verification.rs b/beacon_node/beacon_chain/tests/attestation_verification.rs index 3432604cc93..1463d1c5c15 100644 --- a/beacon_node/beacon_chain/tests/attestation_verification.rs +++ b/beacon_node/beacon_chain/tests/attestation_verification.rs @@ -336,7 +336,7 @@ impl GossipTester { pub fn earliest_valid_attestation_slot(&self) -> Slot { let offset = match self.harness.spec.fork_name_at_epoch(self.epoch()) { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => { // Subtract an additional slot since the harness will be exactly on the start of the // slot and the propagation tolerance will allow an extra slot. E::slots_per_epoch() + 1 @@ -1382,7 +1382,10 @@ async fn attestation_verification_use_head_state_fork() { .block_at_slot(pre_capella_slot, WhenSlotSkipped::Prev) .expect("should not error getting block at slot") .expect("should find block at slot"); - assert_eq!(pre_capella_block.fork_name(&spec).unwrap(), ForkName::Merge); + assert_eq!( + pre_capella_block.fork_name(&spec).unwrap(), + ForkName::Bellatrix + ); // Advance slot clock to Capella fork. harness.advance_slot(); @@ -1427,7 +1430,7 @@ async fn attestation_verification_use_head_state_fork() { // Scenario 2: other node forgot to update their node and signed attestations using bellatrix fork { let attesters = (VALIDATOR_COUNT / 2..VALIDATOR_COUNT).collect::>(); - let merge_fork = spec.fork_for_name(ForkName::Merge).unwrap(); + let bellatrix_fork = spec.fork_for_name(ForkName::Bellatrix).unwrap(); let committee_attestations = harness .make_unaggregated_attestations_with_opts( attesters.as_slice(), @@ -1436,7 +1439,7 @@ async fn attestation_verification_use_head_state_fork() { pre_capella_block.canonical_root().into(), first_capella_slot, MakeAttestationOptions { - fork: merge_fork, + fork: bellatrix_fork, limit: None, }, ) @@ -1483,7 +1486,10 @@ async fn aggregated_attestation_verification_use_head_state_fork() { .block_at_slot(pre_capella_slot, WhenSlotSkipped::Prev) .expect("should not error getting block at slot") .expect("should find block at slot"); - assert_eq!(pre_capella_block.fork_name(&spec).unwrap(), ForkName::Merge); + assert_eq!( + pre_capella_block.fork_name(&spec).unwrap(), + ForkName::Bellatrix + ); // Advance slot clock to Capella fork. harness.advance_slot(); @@ -1525,7 +1531,7 @@ async fn aggregated_attestation_verification_use_head_state_fork() { // Scenario 2: other node forgot to update their node and signed attestations using bellatrix fork { let attesters = (VALIDATOR_COUNT / 2..VALIDATOR_COUNT).collect::>(); - let merge_fork = spec.fork_for_name(ForkName::Merge).unwrap(); + let bellatrix_fork = spec.fork_for_name(ForkName::Bellatrix).unwrap(); let aggregates = harness .make_attestations_with_opts( attesters.as_slice(), @@ -1534,7 +1540,7 @@ async fn aggregated_attestation_verification_use_head_state_fork() { pre_capella_block.canonical_root().into(), first_capella_slot, MakeAttestationOptions { - fork: merge_fork, + fork: bellatrix_fork, limit: None, }, ) diff --git a/beacon_node/beacon_chain/tests/merge.rs b/beacon_node/beacon_chain/tests/bellatrix.rs similarity index 81% rename from beacon_node/beacon_chain/tests/merge.rs rename to beacon_node/beacon_chain/tests/bellatrix.rs index bff5c4523d1..027082c11c9 100644 --- a/beacon_node/beacon_chain/tests/merge.rs +++ b/beacon_node/beacon_chain/tests/bellatrix.rs @@ -71,9 +71,9 @@ async fn merge_with_terminal_block_hash_override() { .chain .head_snapshot() .beacon_block - .as_merge() + .as_bellatrix() .is_ok(), - "genesis block should be a merge block" + "genesis block should be a bellatrix block" ); let mut execution_payloads = vec![]; @@ -93,11 +93,11 @@ async fn merge_with_terminal_block_hash_override() { } #[tokio::test] -async fn base_altair_merge_with_terminal_block_after_fork() { +async fn base_altair_bellatrix_with_terminal_block_after_fork() { let altair_fork_epoch = Epoch::new(4); let altair_fork_slot = altair_fork_epoch.start_slot(E::slots_per_epoch()); let bellatrix_fork_epoch = Epoch::new(8); - let merge_fork_slot = bellatrix_fork_epoch.start_slot(E::slots_per_epoch()); + let bellatrix_fork_slot = bellatrix_fork_epoch.start_slot(E::slots_per_epoch()); let mut spec = E::default_spec(); spec.altair_fork_epoch = Some(altair_fork_epoch); @@ -130,41 +130,41 @@ async fn base_altair_merge_with_terminal_block_after_fork() { assert_eq!(altair_head.slot(), altair_fork_slot); /* - * Do the merge fork, without a terminal PoW block. + * Do the Bellatrix fork, without a terminal PoW block. */ - harness.extend_to_slot(merge_fork_slot).await; + harness.extend_to_slot(bellatrix_fork_slot).await; - let merge_head = &harness.chain.head_snapshot().beacon_block; - assert!(merge_head.as_merge().is_ok()); - assert_eq!(merge_head.slot(), merge_fork_slot); + let bellatrix_head = &harness.chain.head_snapshot().beacon_block; + assert!(bellatrix_head.as_bellatrix().is_ok()); + assert_eq!(bellatrix_head.slot(), bellatrix_fork_slot); assert!( - merge_head + bellatrix_head .message() .body() .execution_payload() .unwrap() .is_default_with_empty_roots(), - "Merge head is default payload" + "Bellatrix head is default payload" ); /* - * Next merge block shouldn't include an exec payload. + * Next Bellatrix block shouldn't include an exec payload. */ harness.extend_slots(1).await; - let one_after_merge_head = &harness.chain.head_snapshot().beacon_block; + let one_after_bellatrix_head = &harness.chain.head_snapshot().beacon_block; assert!( - one_after_merge_head + one_after_bellatrix_head .message() .body() .execution_payload() .unwrap() .is_default_with_empty_roots(), - "One after merge head is default payload" + "One after bellatrix head is default payload" ); - assert_eq!(one_after_merge_head.slot(), merge_fork_slot + 1); + assert_eq!(one_after_bellatrix_head.slot(), bellatrix_fork_slot + 1); /* * Trigger the terminal PoW block. @@ -188,20 +188,20 @@ async fn base_altair_merge_with_terminal_block_after_fork() { harness.extend_slots(1).await; - let two_after_merge_head = &harness.chain.head_snapshot().beacon_block; + let two_after_bellatrix_head = &harness.chain.head_snapshot().beacon_block; assert!( - two_after_merge_head + two_after_bellatrix_head .message() .body() .execution_payload() .unwrap() .is_default_with_empty_roots(), - "Two after merge head is default payload" + "Two after bellatrix head is default payload" ); - assert_eq!(two_after_merge_head.slot(), merge_fork_slot + 2); + assert_eq!(two_after_bellatrix_head.slot(), bellatrix_fork_slot + 2); /* - * Next merge block should include an exec payload. + * Next Bellatrix block should include an exec payload. */ for _ in 0..4 { harness.extend_slots(1).await; diff --git a/beacon_node/beacon_chain/tests/capella.rs b/beacon_node/beacon_chain/tests/capella.rs index dc40280f530..c8fd2637f0c 100644 --- a/beacon_node/beacon_chain/tests/capella.rs +++ b/beacon_node/beacon_chain/tests/capella.rs @@ -25,11 +25,11 @@ fn verify_execution_payload_chain(chain: &[FullPayload]) { } #[tokio::test] -async fn base_altair_merge_capella() { +async fn base_altair_bellatrix_capella() { let altair_fork_epoch = Epoch::new(4); let altair_fork_slot = altair_fork_epoch.start_slot(E::slots_per_epoch()); let bellatrix_fork_epoch = Epoch::new(8); - let merge_fork_slot = bellatrix_fork_epoch.start_slot(E::slots_per_epoch()); + let bellatrix_fork_slot = bellatrix_fork_epoch.start_slot(E::slots_per_epoch()); let capella_fork_epoch = Epoch::new(12); let capella_fork_slot = capella_fork_epoch.start_slot(E::slots_per_epoch()); @@ -61,39 +61,39 @@ async fn base_altair_merge_capella() { assert_eq!(altair_head.slot(), altair_fork_slot); /* - * Do the merge fork, without a terminal PoW block. + * Do the Bellatrix fork, without a terminal PoW block. */ - harness.extend_to_slot(merge_fork_slot).await; + harness.extend_to_slot(bellatrix_fork_slot).await; - let merge_head = &harness.chain.head_snapshot().beacon_block; - assert!(merge_head.as_merge().is_ok()); - assert_eq!(merge_head.slot(), merge_fork_slot); + let bellatrix_head = &harness.chain.head_snapshot().beacon_block; + assert!(bellatrix_head.as_bellatrix().is_ok()); + assert_eq!(bellatrix_head.slot(), bellatrix_fork_slot); assert!( - merge_head + bellatrix_head .message() .body() .execution_payload() .unwrap() .is_default_with_empty_roots(), - "Merge head is default payload" + "Bellatrix head is default payload" ); /* - * Next merge block shouldn't include an exec payload. + * Next Bellatrix block shouldn't include an exec payload. */ harness.extend_slots(1).await; - let one_after_merge_head = &harness.chain.head_snapshot().beacon_block; + let one_after_bellatrix_head = &harness.chain.head_snapshot().beacon_block; assert!( - one_after_merge_head + one_after_bellatrix_head .message() .body() .execution_payload() .unwrap() .is_default_with_empty_roots(), - "One after merge head is default payload" + "One after bellatrix head is default payload" ); - assert_eq!(one_after_merge_head.slot(), merge_fork_slot + 1); + assert_eq!(one_after_bellatrix_head.slot(), bellatrix_fork_slot + 1); /* * Trigger the terminal PoW block. @@ -114,23 +114,23 @@ async fn base_altair_merge_capella() { }); harness.extend_slots(1).await; - let two_after_merge_head = &harness.chain.head_snapshot().beacon_block; + let two_after_bellatrix_head = &harness.chain.head_snapshot().beacon_block; assert!( - two_after_merge_head + two_after_bellatrix_head .message() .body() .execution_payload() .unwrap() .is_default_with_empty_roots(), - "Two after merge head is default payload" + "Two after bellatrix head is default payload" ); - assert_eq!(two_after_merge_head.slot(), merge_fork_slot + 2); + assert_eq!(two_after_bellatrix_head.slot(), bellatrix_fork_slot + 2); /* - * Next merge block should include an exec payload. + * Next Bellatrix block should include an exec payload. */ let mut execution_payloads = vec![]; - for _ in (merge_fork_slot.as_u64() + 3)..capella_fork_slot.as_u64() { + for _ in (bellatrix_fork_slot.as_u64() + 3)..capella_fork_slot.as_u64() { harness.extend_slots(1).await; let block = &harness.chain.head_snapshot().beacon_block; let full_payload: FullPayload = diff --git a/beacon_node/beacon_chain/tests/main.rs b/beacon_node/beacon_chain/tests/main.rs index e0564e1510b..942ce816846 100644 --- a/beacon_node/beacon_chain/tests/main.rs +++ b/beacon_node/beacon_chain/tests/main.rs @@ -1,9 +1,9 @@ mod attestation_production; mod attestation_verification; +mod bellatrix; mod block_verification; mod capella; mod events; -mod merge; mod op_verification; mod payload_invalidation; mod rewards; diff --git a/beacon_node/beacon_chain/tests/validator_monitor.rs b/beacon_node/beacon_chain/tests/validator_monitor.rs index f595e5037e2..ea9ef73575f 100644 --- a/beacon_node/beacon_chain/tests/validator_monitor.rs +++ b/beacon_node/beacon_chain/tests/validator_monitor.rs @@ -211,7 +211,7 @@ async fn produces_missed_blocks() { // `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_merge = 4; + 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 @@ -224,7 +224,7 @@ async fn produces_missed_blocks() { vec![ validator_index_to_monitor, validator_index_to_monitor_altair, - validator_index_to_monitor_merge, + validator_index_to_monitor_bellatrix, validator_index_to_monitor_capella, validator_index_to_monitor_deneb, validator_index_to_monitor_electra, diff --git a/beacon_node/client/src/notifier.rs b/beacon_node/client/src/notifier.rs index 912babdae31..a6fd07789d8 100644 --- a/beacon_node/client/src/notifier.rs +++ b/beacon_node/client/src/notifier.rs @@ -1,9 +1,9 @@ use crate::metrics; use beacon_chain::{ + bellatrix_readiness::{BellatrixReadiness, GenesisExecutionPayloadStatus, MergeConfig}, capella_readiness::CapellaReadiness, deneb_readiness::DenebReadiness, electra_readiness::ElectraReadiness, - merge_readiness::{GenesisExecutionPayloadStatus, MergeConfig, MergeReadiness}, BeaconChain, BeaconChainTypes, ExecutionStatus, }; use lighthouse_network::{types::SyncState, NetworkGlobals}; @@ -64,7 +64,7 @@ pub fn spawn_notifier( "wait_time" => estimated_time_pretty(Some(next_slot.as_secs() as f64)), ); eth1_logging(&beacon_chain, &log); - merge_readiness_logging(Slot::new(0), &beacon_chain, &log).await; + bellatrix_readiness_logging(Slot::new(0), &beacon_chain, &log).await; capella_readiness_logging(Slot::new(0), &beacon_chain, &log).await; genesis_execution_payload_logging(&beacon_chain, &log).await; sleep(slot_duration).await; @@ -319,7 +319,7 @@ pub fn spawn_notifier( } eth1_logging(&beacon_chain, &log); - merge_readiness_logging(current_slot, &beacon_chain, &log).await; + bellatrix_readiness_logging(current_slot, &beacon_chain, &log).await; capella_readiness_logging(current_slot, &beacon_chain, &log).await; deneb_readiness_logging(current_slot, &beacon_chain, &log).await; electra_readiness_logging(current_slot, &beacon_chain, &log).await; @@ -334,7 +334,7 @@ pub fn spawn_notifier( /// Provides some helpful logging to users to indicate if their node is ready for the Bellatrix /// fork and subsequent merge transition. -async fn merge_readiness_logging( +async fn bellatrix_readiness_logging( current_slot: Slot, beacon_chain: &BeaconChain, log: &Logger, @@ -372,8 +372,8 @@ async fn merge_readiness_logging( return; } - match beacon_chain.check_merge_readiness(current_slot).await { - MergeReadiness::Ready { + match beacon_chain.check_bellatrix_readiness(current_slot).await { + BellatrixReadiness::Ready { config, current_difficulty, } => match config { @@ -384,7 +384,7 @@ async fn merge_readiness_logging( } => { info!( log, - "Ready for the merge"; + "Ready for Bellatrix"; "terminal_total_difficulty" => %ttd, "current_difficulty" => current_difficulty .map(|d| d.to_string()) @@ -398,7 +398,7 @@ async fn merge_readiness_logging( } => { info!( log, - "Ready for the merge"; + "Ready for Bellatrix"; "info" => "you are using override parameters, please ensure that you \ understand these parameters and their implications.", "terminal_block_hash" => ?terminal_block_hash, @@ -411,14 +411,14 @@ async fn merge_readiness_logging( "config" => ?other ), }, - readiness @ MergeReadiness::NotSynced => warn!( + readiness @ BellatrixReadiness::NotSynced => warn!( log, - "Not ready for merge"; + "Not ready Bellatrix"; "info" => %readiness, ), - readiness @ MergeReadiness::NoExecutionEndpoint => warn!( + readiness @ BellatrixReadiness::NoExecutionEndpoint => warn!( log, - "Not ready for merge"; + "Not ready for Bellatrix"; "info" => %readiness, ), } diff --git a/beacon_node/execution_layer/src/block_hash.rs b/beacon_node/execution_layer/src/block_hash.rs index 1f8c29f6b25..0d0cfaf352c 100644 --- a/beacon_node/execution_layer/src/block_hash.rs +++ b/beacon_node/execution_layer/src/block_hash.rs @@ -146,7 +146,7 @@ mod test { } #[test] - fn test_rlp_encode_merge_block() { + fn test_rlp_encode_bellatrix_block() { let header = ExecutionBlockHeader { parent_hash: Hash256::from_str("927ca537f06c783a3a2635b8805eef1c8c2124f7444ad4a3389898dd832f2dbe").unwrap(), ommers_hash: Hash256::from_str("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347").unwrap(), diff --git a/beacon_node/execution_layer/src/engine_api.rs b/beacon_node/execution_layer/src/engine_api.rs index a91f5d6a442..40ea566904d 100644 --- a/beacon_node/execution_layer/src/engine_api.rs +++ b/beacon_node/execution_layer/src/engine_api.rs @@ -26,8 +26,8 @@ pub use types::{ }; use types::{ - ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadMerge, - KzgProofs, + ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb, + ExecutionPayloadElectra, KzgProofs, }; pub mod auth; @@ -36,8 +36,8 @@ pub mod json_structures; mod new_payload_request; pub use new_payload_request::{ - NewPayloadRequest, NewPayloadRequestCapella, NewPayloadRequestDeneb, NewPayloadRequestElectra, - NewPayloadRequestMerge, + NewPayloadRequest, NewPayloadRequestBellatrix, NewPayloadRequestCapella, + NewPayloadRequestDeneb, NewPayloadRequestElectra, }; pub const LATEST_TAG: &str = "latest"; @@ -155,7 +155,7 @@ pub struct ExecutionBlock { /// Representation of an execution block with enough detail to reconstruct a payload. #[superstruct( - variants(Merge, Capella, Deneb, Electra), + variants(Bellatrix, Capella, Deneb, Electra), variant_attributes( derive(Clone, Debug, PartialEq, Serialize, Deserialize,), serde(bound = "E: EthSpec", rename_all = "camelCase"), @@ -204,26 +204,28 @@ impl TryFrom> for ExecutionBlockWithTransactions fn try_from(payload: ExecutionPayload) -> Result { let json_payload = match payload { - ExecutionPayload::Merge(block) => Self::Merge(ExecutionBlockWithTransactionsMerge { - parent_hash: block.parent_hash, - fee_recipient: block.fee_recipient, - state_root: block.state_root, - receipts_root: block.receipts_root, - logs_bloom: block.logs_bloom, - prev_randao: block.prev_randao, - block_number: block.block_number, - gas_limit: block.gas_limit, - gas_used: block.gas_used, - timestamp: block.timestamp, - extra_data: block.extra_data, - base_fee_per_gas: block.base_fee_per_gas, - block_hash: block.block_hash, - transactions: block - .transactions - .iter() - .map(|tx| Transaction::decode(&Rlp::new(tx))) - .collect::, _>>()?, - }), + ExecutionPayload::Bellatrix(block) => { + Self::Bellatrix(ExecutionBlockWithTransactionsBellatrix { + parent_hash: block.parent_hash, + fee_recipient: block.fee_recipient, + state_root: block.state_root, + receipts_root: block.receipts_root, + logs_bloom: block.logs_bloom, + prev_randao: block.prev_randao, + block_number: block.block_number, + gas_limit: block.gas_limit, + gas_used: block.gas_used, + timestamp: block.timestamp, + extra_data: block.extra_data, + base_fee_per_gas: block.base_fee_per_gas, + block_hash: block.block_hash, + transactions: block + .transactions + .iter() + .map(|tx| Transaction::decode(&Rlp::new(tx))) + .collect::, _>>()?, + }) + } ExecutionPayload::Capella(block) => { Self::Capella(ExecutionBlockWithTransactionsCapella { parent_hash: block.parent_hash, @@ -423,7 +425,7 @@ pub struct ProposeBlindedBlockResponse { } #[superstruct( - variants(Merge, Capella, Deneb, Electra), + variants(Bellatrix, Capella, Deneb, Electra), variant_attributes(derive(Clone, Debug, PartialEq),), map_into(ExecutionPayload), map_ref_into(ExecutionPayloadRef), @@ -432,8 +434,11 @@ pub struct ProposeBlindedBlockResponse { )] #[derive(Clone, Debug, PartialEq)] pub struct GetPayloadResponse { - #[superstruct(only(Merge), partial_getter(rename = "execution_payload_merge"))] - pub execution_payload: ExecutionPayloadMerge, + #[superstruct( + only(Bellatrix), + partial_getter(rename = "execution_payload_bellatrix") + )] + pub execution_payload: ExecutionPayloadBellatrix, #[superstruct(only(Capella), partial_getter(rename = "execution_payload_capella"))] pub execution_payload: ExecutionPayloadCapella, #[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))] @@ -482,8 +487,8 @@ impl From> { fn from(response: GetPayloadResponse) -> Self { match response { - GetPayloadResponse::Merge(inner) => ( - ExecutionPayload::Merge(inner.execution_payload), + GetPayloadResponse::Bellatrix(inner) => ( + ExecutionPayload::Bellatrix(inner.execution_payload), inner.block_value, None, ), @@ -529,14 +534,14 @@ impl ExecutionPayloadBodyV1 { header: ExecutionPayloadHeader, ) -> Result, String> { match header { - ExecutionPayloadHeader::Merge(header) => { + ExecutionPayloadHeader::Bellatrix(header) => { if self.withdrawals.is_some() { return Err(format!( "block {} is merge but payload body has withdrawals", header.block_hash )); } - Ok(ExecutionPayload::Merge(ExecutionPayloadMerge { + Ok(ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix { parent_hash: header.parent_hash, fee_recipient: header.fee_recipient, state_root: header.state_root, diff --git a/beacon_node/execution_layer/src/engine_api/http.rs b/beacon_node/execution_layer/src/engine_api/http.rs index ebd6ebeba2a..f66e923330c 100644 --- a/beacon_node/execution_layer/src/engine_api/http.rs +++ b/beacon_node/execution_layer/src/engine_api/http.rs @@ -716,7 +716,7 @@ impl HttpJsonRpc { ) -> Result>, Error> { let params = json!([block_hash, true]); Ok(Some(match fork { - ForkName::Merge => ExecutionBlockWithTransactions::Merge( + ForkName::Bellatrix => ExecutionBlockWithTransactions::Bellatrix( self.rpc_request( ETH_GET_BLOCK_BY_HASH, params, @@ -847,7 +847,7 @@ impl HttpJsonRpc { ) .await?; - Ok(GetPayloadResponse::Merge(GetPayloadResponseMerge { + Ok(GetPayloadResponse::Bellatrix(GetPayloadResponseBellatrix { execution_payload: payload_v1.into(), // Set the V1 payload values from the EE to be zero. This simulates // the pre-block-value functionality of always choosing the builder @@ -864,7 +864,7 @@ impl HttpJsonRpc { let params = json!([JsonPayloadIdRequest::from(payload_id)]); match fork_name { - ForkName::Merge => { + ForkName::Bellatrix => { let response: JsonGetPayloadResponseV1 = self .rpc_request( ENGINE_GET_PAYLOAD_V2, @@ -918,7 +918,7 @@ impl HttpJsonRpc { .await?; Ok(JsonGetPayloadResponse::V4(response).into()) } - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => Err( + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => Err( Error::UnsupportedForkVariant(format!("called get_payload_v3 with {}", fork_name)), ), } @@ -1095,7 +1095,7 @@ impl HttpJsonRpc { ) -> Result { let engine_capabilities = self.get_engine_capabilities(None).await?; match new_payload_request { - NewPayloadRequest::Merge(_) | NewPayloadRequest::Capella(_) => { + NewPayloadRequest::Bellatrix(_) | NewPayloadRequest::Capella(_) => { if engine_capabilities.new_payload_v2 { self.new_payload_v2(new_payload_request.into_execution_payload()) .await @@ -1133,7 +1133,7 @@ impl HttpJsonRpc { ) -> Result, Error> { let engine_capabilities = self.get_engine_capabilities(None).await?; match fork_name { - ForkName::Merge | ForkName::Capella => { + ForkName::Bellatrix | ForkName::Capella => { if engine_capabilities.get_payload_v2 { self.get_payload_v2(fork_name, payload_id).await } else if engine_capabilities.new_payload_v1 { @@ -1574,8 +1574,8 @@ mod test { .assert_request_equals( |client| async move { let _ = client - .new_payload_v1::(ExecutionPayload::Merge( - ExecutionPayloadMerge { + .new_payload_v1::(ExecutionPayload::Bellatrix( + ExecutionPayloadBellatrix { parent_hash: ExecutionBlockHash::repeat_byte(0), fee_recipient: Address::repeat_byte(1), state_root: Hash256::repeat_byte(1), @@ -1621,8 +1621,8 @@ mod test { Tester::new(false) .assert_auth_failure(|client| async move { client - .new_payload_v1::(ExecutionPayload::Merge( - ExecutionPayloadMerge { + .new_payload_v1::(ExecutionPayload::Bellatrix( + ExecutionPayloadBellatrix { parent_hash: ExecutionBlockHash::repeat_byte(0), fee_recipient: Address::repeat_byte(1), state_root: Hash256::repeat_byte(1), @@ -1832,7 +1832,7 @@ mod test { .unwrap() .into(); - let expected = ExecutionPayload::Merge(ExecutionPayloadMerge { + let expected = ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix { parent_hash: ExecutionBlockHash::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(), fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(), state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(), @@ -1857,7 +1857,7 @@ mod test { // engine_newPayloadV1 REQUEST validation |client| async move { let _ = client - .new_payload_v1::(ExecutionPayload::Merge(ExecutionPayloadMerge{ + .new_payload_v1::(ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix{ parent_hash: ExecutionBlockHash::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(), fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(), state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(), @@ -1911,7 +1911,7 @@ mod test { })], |client| async move { let response = client - .new_payload_v1::(ExecutionPayload::Merge(ExecutionPayloadMerge::default())) + .new_payload_v1::(ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix::default())) .await .unwrap(); diff --git a/beacon_node/execution_layer/src/engine_api/json_structures.rs b/beacon_node/execution_layer/src/engine_api/json_structures.rs index 9f2387ae314..370d1069661 100644 --- a/beacon_node/execution_layer/src/engine_api/json_structures.rs +++ b/beacon_node/execution_layer/src/engine_api/json_structures.rs @@ -103,8 +103,8 @@ pub struct JsonExecutionPayload { pub excess_blob_gas: u64, } -impl From> for JsonExecutionPayloadV1 { - fn from(payload: ExecutionPayloadMerge) -> Self { +impl From> for JsonExecutionPayloadV1 { + fn from(payload: ExecutionPayloadBellatrix) -> Self { JsonExecutionPayloadV1 { parent_hash: payload.parent_hash, fee_recipient: payload.fee_recipient, @@ -210,7 +210,7 @@ impl From> for JsonExecutionPayloadV4 impl From> for JsonExecutionPayload { fn from(execution_payload: ExecutionPayload) -> Self { match execution_payload { - ExecutionPayload::Merge(payload) => JsonExecutionPayload::V1(payload.into()), + ExecutionPayload::Bellatrix(payload) => JsonExecutionPayload::V1(payload.into()), ExecutionPayload::Capella(payload) => JsonExecutionPayload::V2(payload.into()), ExecutionPayload::Deneb(payload) => JsonExecutionPayload::V3(payload.into()), ExecutionPayload::Electra(payload) => JsonExecutionPayload::V4(payload.into()), @@ -218,9 +218,9 @@ impl From> for JsonExecutionPayload { } } -impl From> for ExecutionPayloadMerge { +impl From> for ExecutionPayloadBellatrix { fn from(payload: JsonExecutionPayloadV1) -> Self { - ExecutionPayloadMerge { + ExecutionPayloadBellatrix { parent_hash: payload.parent_hash, fee_recipient: payload.fee_recipient, state_root: payload.state_root, @@ -326,7 +326,7 @@ impl From> for ExecutionPayloadElectra impl From> for ExecutionPayload { fn from(json_execution_payload: JsonExecutionPayload) -> Self { match json_execution_payload { - JsonExecutionPayload::V1(payload) => ExecutionPayload::Merge(payload.into()), + JsonExecutionPayload::V1(payload) => ExecutionPayload::Bellatrix(payload.into()), JsonExecutionPayload::V2(payload) => ExecutionPayload::Capella(payload.into()), JsonExecutionPayload::V3(payload) => ExecutionPayload::Deneb(payload.into()), JsonExecutionPayload::V4(payload) => ExecutionPayload::Electra(payload.into()), @@ -366,7 +366,7 @@ impl From> for GetPayloadResponse { fn from(json_get_payload_response: JsonGetPayloadResponse) -> Self { match json_get_payload_response { JsonGetPayloadResponse::V1(response) => { - GetPayloadResponse::Merge(GetPayloadResponseMerge { + GetPayloadResponse::Bellatrix(GetPayloadResponseBellatrix { execution_payload: response.execution_payload.into(), block_value: response.block_value, }) diff --git a/beacon_node/execution_layer/src/engine_api/new_payload_request.rs b/beacon_node/execution_layer/src/engine_api/new_payload_request.rs index 6b6df13b704..8d2e3d5ad06 100644 --- a/beacon_node/execution_layer/src/engine_api/new_payload_request.rs +++ b/beacon_node/execution_layer/src/engine_api/new_payload_request.rs @@ -8,11 +8,12 @@ use types::{ ExecutionPayloadRef, Hash256, VersionedHash, }; use types::{ - ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadMerge, + ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb, + ExecutionPayloadElectra, }; #[superstruct( - variants(Merge, Capella, Deneb, Electra), + variants(Bellatrix, Capella, Deneb, Electra), variant_attributes(derive(Clone, Debug, PartialEq),), map_into(ExecutionPayload), map_ref_into(ExecutionPayloadRef), @@ -27,8 +28,11 @@ use types::{ )] #[derive(Clone, Debug, PartialEq)] pub struct NewPayloadRequest<'block, E: EthSpec> { - #[superstruct(only(Merge), partial_getter(rename = "execution_payload_merge"))] - pub execution_payload: &'block ExecutionPayloadMerge, + #[superstruct( + only(Bellatrix), + partial_getter(rename = "execution_payload_bellatrix") + )] + pub execution_payload: &'block ExecutionPayloadBellatrix, #[superstruct(only(Capella), partial_getter(rename = "execution_payload_capella"))] pub execution_payload: &'block ExecutionPayloadCapella, #[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))] @@ -44,7 +48,7 @@ pub struct NewPayloadRequest<'block, E: EthSpec> { impl<'block, E: EthSpec> NewPayloadRequest<'block, E> { pub fn parent_hash(&self) -> ExecutionBlockHash { match self { - Self::Merge(payload) => payload.execution_payload.parent_hash, + Self::Bellatrix(payload) => payload.execution_payload.parent_hash, Self::Capella(payload) => payload.execution_payload.parent_hash, Self::Deneb(payload) => payload.execution_payload.parent_hash, Self::Electra(payload) => payload.execution_payload.parent_hash, @@ -53,7 +57,7 @@ impl<'block, E: EthSpec> NewPayloadRequest<'block, E> { pub fn block_hash(&self) -> ExecutionBlockHash { match self { - Self::Merge(payload) => payload.execution_payload.block_hash, + Self::Bellatrix(payload) => payload.execution_payload.block_hash, Self::Capella(payload) => payload.execution_payload.block_hash, Self::Deneb(payload) => payload.execution_payload.block_hash, Self::Electra(payload) => payload.execution_payload.block_hash, @@ -62,7 +66,7 @@ impl<'block, E: EthSpec> NewPayloadRequest<'block, E> { pub fn block_number(&self) -> u64 { match self { - Self::Merge(payload) => payload.execution_payload.block_number, + Self::Bellatrix(payload) => payload.execution_payload.block_number, Self::Capella(payload) => payload.execution_payload.block_number, Self::Deneb(payload) => payload.execution_payload.block_number, Self::Electra(payload) => payload.execution_payload.block_number, @@ -71,7 +75,7 @@ impl<'block, E: EthSpec> NewPayloadRequest<'block, E> { pub fn execution_payload_ref(&self) -> ExecutionPayloadRef<'block, E> { match self { - Self::Merge(request) => ExecutionPayloadRef::Merge(request.execution_payload), + Self::Bellatrix(request) => ExecutionPayloadRef::Bellatrix(request.execution_payload), Self::Capella(request) => ExecutionPayloadRef::Capella(request.execution_payload), Self::Deneb(request) => ExecutionPayloadRef::Deneb(request.execution_payload), Self::Electra(request) => ExecutionPayloadRef::Electra(request.execution_payload), @@ -80,7 +84,9 @@ impl<'block, E: EthSpec> NewPayloadRequest<'block, E> { pub fn into_execution_payload(self) -> ExecutionPayload { match self { - Self::Merge(request) => ExecutionPayload::Merge(request.execution_payload.clone()), + Self::Bellatrix(request) => { + ExecutionPayload::Bellatrix(request.execution_payload.clone()) + } Self::Capella(request) => ExecutionPayload::Capella(request.execution_payload.clone()), Self::Deneb(request) => ExecutionPayload::Deneb(request.execution_payload.clone()), Self::Electra(request) => ExecutionPayload::Electra(request.execution_payload.clone()), @@ -150,9 +156,11 @@ impl<'a, E: EthSpec> TryFrom> for NewPayloadRequest<'a, E> BeaconBlockRef::Base(_) | BeaconBlockRef::Altair(_) => { Err(Self::Error::IncorrectStateVariant) } - BeaconBlockRef::Merge(block_ref) => Ok(Self::Merge(NewPayloadRequestMerge { - execution_payload: &block_ref.body.execution_payload.execution_payload, - })), + BeaconBlockRef::Bellatrix(block_ref) => { + Ok(Self::Bellatrix(NewPayloadRequestBellatrix { + execution_payload: &block_ref.body.execution_payload.execution_payload, + })) + } BeaconBlockRef::Capella(block_ref) => Ok(Self::Capella(NewPayloadRequestCapella { execution_payload: &block_ref.body.execution_payload.execution_payload, })), @@ -185,9 +193,11 @@ impl<'a, E: EthSpec> TryFrom> for NewPayloadRequest<' fn try_from(payload: ExecutionPayloadRef<'a, E>) -> Result { match payload { - ExecutionPayloadRef::Merge(payload) => Ok(Self::Merge(NewPayloadRequestMerge { - execution_payload: payload, - })), + ExecutionPayloadRef::Bellatrix(payload) => { + Ok(Self::Bellatrix(NewPayloadRequestBellatrix { + execution_payload: payload, + })) + } ExecutionPayloadRef::Capella(payload) => Ok(Self::Capella(NewPayloadRequestCapella { execution_payload: payload, })), diff --git a/beacon_node/execution_layer/src/lib.rs b/beacon_node/execution_layer/src/lib.rs index 30930318eff..2e3d300a65c 100644 --- a/beacon_node/execution_layer/src/lib.rs +++ b/beacon_node/execution_layer/src/lib.rs @@ -50,8 +50,8 @@ use types::{ AbstractExecPayload, BlobsList, ExecutionPayloadDeneb, KzgProofs, SignedBlindedBeaconBlock, }; use types::{ - BeaconStateError, BlindedPayload, ChainSpec, Epoch, ExecPayload, ExecutionPayloadCapella, - ExecutionPayloadElectra, ExecutionPayloadMerge, FullPayload, ProposerPreparationData, + BeaconStateError, BlindedPayload, ChainSpec, Epoch, ExecPayload, ExecutionPayloadBellatrix, + ExecutionPayloadCapella, ExecutionPayloadElectra, FullPayload, ProposerPreparationData, PublicKeyBytes, Signature, Slot, }; @@ -98,8 +98,8 @@ impl TryFrom> for ProvenancedPayload) -> Result { let block_proposal_contents = match value { - BuilderBid::Merge(builder_bid) => BlockProposalContents::Payload { - payload: ExecutionPayloadHeader::Merge(builder_bid.header).into(), + BuilderBid::Bellatrix(builder_bid) => BlockProposalContents::Payload { + payload: ExecutionPayloadHeader::Bellatrix(builder_bid.header).into(), block_value: builder_bid.value, }, BuilderBid::Capella(builder_bid) => BlockProposalContents::Payload { @@ -1775,7 +1775,7 @@ impl ExecutionLayer { // Handle default payload body. if header.block_hash() == ExecutionBlockHash::zero() { let payload = match fork { - ForkName::Merge => ExecutionPayloadMerge::default().into(), + ForkName::Bellatrix => ExecutionPayloadBellatrix::default().into(), ForkName::Capella => ExecutionPayloadCapella::default().into(), ForkName::Deneb => ExecutionPayloadDeneb::default().into(), ForkName::Electra => ExecutionPayloadElectra::default().into(), @@ -1844,7 +1844,7 @@ impl ExecutionLayer { if hash == ExecutionBlockHash::zero() { return match fork { - ForkName::Merge => Ok(Some(ExecutionPayloadMerge::default().into())), + ForkName::Bellatrix => Ok(Some(ExecutionPayloadBellatrix::default().into())), ForkName::Capella => Ok(Some(ExecutionPayloadCapella::default().into())), ForkName::Deneb => Ok(Some(ExecutionPayloadDeneb::default().into())), ForkName::Electra => Ok(Some(ExecutionPayloadElectra::default().into())), @@ -1873,22 +1873,22 @@ impl ExecutionLayer { }; let payload = match block { - ExecutionBlockWithTransactions::Merge(merge_block) => { - ExecutionPayload::Merge(ExecutionPayloadMerge { - parent_hash: merge_block.parent_hash, - fee_recipient: merge_block.fee_recipient, - state_root: merge_block.state_root, - receipts_root: merge_block.receipts_root, - logs_bloom: merge_block.logs_bloom, - prev_randao: merge_block.prev_randao, - block_number: merge_block.block_number, - gas_limit: merge_block.gas_limit, - gas_used: merge_block.gas_used, - timestamp: merge_block.timestamp, - extra_data: merge_block.extra_data, - base_fee_per_gas: merge_block.base_fee_per_gas, - block_hash: merge_block.block_hash, - transactions: convert_transactions(merge_block.transactions)?, + ExecutionBlockWithTransactions::Bellatrix(bellatrix_block) => { + ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix { + parent_hash: bellatrix_block.parent_hash, + fee_recipient: bellatrix_block.fee_recipient, + state_root: bellatrix_block.state_root, + receipts_root: bellatrix_block.receipts_root, + logs_bloom: bellatrix_block.logs_bloom, + prev_randao: bellatrix_block.prev_randao, + block_number: bellatrix_block.block_number, + gas_limit: bellatrix_block.gas_limit, + gas_used: bellatrix_block.gas_used, + timestamp: bellatrix_block.timestamp, + extra_data: bellatrix_block.extra_data, + base_fee_per_gas: bellatrix_block.base_fee_per_gas, + block_hash: bellatrix_block.block_hash, + transactions: convert_transactions(bellatrix_block.transactions)?, }) } ExecutionBlockWithTransactions::Capella(capella_block) => { diff --git a/beacon_node/execution_layer/src/test_utils/execution_block_generator.rs b/beacon_node/execution_layer/src/test_utils/execution_block_generator.rs index 08f8ca68435..7103dec7cd4 100644 --- a/beacon_node/execution_layer/src/test_utils/execution_block_generator.rs +++ b/beacon_node/execution_layer/src/test_utils/execution_block_generator.rs @@ -21,9 +21,9 @@ use std::sync::Arc; use tree_hash::TreeHash; use tree_hash_derive::TreeHash; use types::{ - Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadCapella, - ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadHeader, ExecutionPayloadMerge, - ForkName, Hash256, Transaction, Transactions, Uint256, + Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBellatrix, + ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra, + ExecutionPayloadHeader, ForkName, Hash256, Transaction, Transactions, Uint256, }; use super::DEFAULT_TERMINAL_BLOCK; @@ -212,7 +212,7 @@ impl ExecutionBlockGenerator { Some(fork_time) if timestamp >= fork_time => ForkName::Deneb, _ => match self.shanghai_time { Some(fork_time) if timestamp >= fork_time => ForkName::Capella, - _ => ForkName::Merge, + _ => ForkName::Bellatrix, }, }, } @@ -556,7 +556,7 @@ impl ExecutionBlockGenerator { attributes: &PayloadAttributes, ) -> Result, String> { let mut execution_payload = match attributes { - PayloadAttributes::V1(pa) => ExecutionPayload::Merge(ExecutionPayloadMerge { + PayloadAttributes::V1(pa) => ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix { parent_hash: head_block_hash, fee_recipient: pa.suggested_fee_recipient, receipts_root: Hash256::repeat_byte(42), @@ -573,7 +573,7 @@ impl ExecutionBlockGenerator { transactions: vec![].into(), }), PayloadAttributes::V2(pa) => match self.get_fork_at_timestamp(pa.timestamp) { - ForkName::Merge => ExecutionPayload::Merge(ExecutionPayloadMerge { + ForkName::Bellatrix => ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix { parent_hash: head_block_hash, fee_recipient: pa.suggested_fee_recipient, receipts_root: Hash256::repeat_byte(42), @@ -652,7 +652,7 @@ impl ExecutionBlockGenerator { }; match execution_payload.fork_name() { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => {} + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => {} ForkName::Deneb | ForkName::Electra => { // get random number between 0 and Max Blobs let mut rng = self.rng.lock(); @@ -768,13 +768,13 @@ pub fn generate_genesis_header( .map(|block| block.block_hash); match genesis_fork { ForkName::Base | ForkName::Altair => None, - ForkName::Merge => { + ForkName::Bellatrix => { if post_transition_merge { - let mut header = ExecutionPayloadHeader::Merge(<_>::default()); + let mut header = ExecutionPayloadHeader::Bellatrix(<_>::default()); *header.block_hash_mut() = genesis_block_hash.unwrap_or_default(); Some(header) } else { - Some(ExecutionPayloadHeader::::Merge(<_>::default())) + Some(ExecutionPayloadHeader::::Bellatrix(<_>::default())) } } ForkName::Capella => { diff --git a/beacon_node/execution_layer/src/test_utils/handle_rpc.rs b/beacon_node/execution_layer/src/test_utils/handle_rpc.rs index 77d972ab88e..23f52162624 100644 --- a/beacon_node/execution_layer/src/test_utils/handle_rpc.rs +++ b/beacon_node/execution_layer/src/test_utils/handle_rpc.rs @@ -129,7 +129,7 @@ pub async fn handle_rpc( .get_fork_at_timestamp(*request.timestamp()); // validate method called correctly according to fork time match fork { - ForkName::Merge => { + ForkName::Bellatrix => { if matches!(request, JsonExecutionPayload::V2(_)) { return Err(( format!( @@ -389,7 +389,7 @@ pub async fn handle_rpc( .read() .get_fork_at_timestamp(*pa.timestamp()) { - ForkName::Merge => { + ForkName::Bellatrix => { get_param::>(params, 1) .map(|opt| opt.map(JsonPayloadAttributes::V1)) .transpose() @@ -421,7 +421,7 @@ pub async fn handle_rpc( .read() .get_fork_at_timestamp(*pa.timestamp()) { - ForkName::Merge => { + ForkName::Bellatrix => { if matches!(pa, JsonPayloadAttributes::V2(_)) { return Err(( format!( diff --git a/beacon_node/execution_layer/src/test_utils/mock_builder.rs b/beacon_node/execution_layer/src/test_utils/mock_builder.rs index b12e26a3d6c..bdb459cf6fa 100644 --- a/beacon_node/execution_layer/src/test_utils/mock_builder.rs +++ b/beacon_node/execution_layer/src/test_utils/mock_builder.rs @@ -15,7 +15,7 @@ use task_executor::TaskExecutor; use tempfile::NamedTempFile; use tree_hash::TreeHash; use types::builder_bid::{ - BuilderBid, BuilderBidCapella, BuilderBidDeneb, BuilderBidElectra, BuilderBidMerge, + BuilderBid, BuilderBidBellatrix, BuilderBidCapella, BuilderBidDeneb, BuilderBidElectra, SignedBuilderBid, }; use types::{ @@ -77,7 +77,7 @@ pub trait BidStuff { impl BidStuff for BuilderBid { fn set_fee_recipient(&mut self, fee_recipient: Address) { match self.to_mut().header_mut() { - ExecutionPayloadHeaderRefMut::Merge(header) => { + ExecutionPayloadHeaderRefMut::Bellatrix(header) => { header.fee_recipient = fee_recipient; } ExecutionPayloadHeaderRefMut::Capella(header) => { @@ -94,7 +94,7 @@ impl BidStuff for BuilderBid { fn set_gas_limit(&mut self, gas_limit: u64) { match self.to_mut().header_mut() { - ExecutionPayloadHeaderRefMut::Merge(header) => { + ExecutionPayloadHeaderRefMut::Bellatrix(header) => { header.gas_limit = gas_limit; } ExecutionPayloadHeaderRefMut::Capella(header) => { @@ -115,7 +115,7 @@ impl BidStuff for BuilderBid { fn set_parent_hash(&mut self, parent_hash: Hash256) { match self.to_mut().header_mut() { - ExecutionPayloadHeaderRefMut::Merge(header) => { + ExecutionPayloadHeaderRefMut::Bellatrix(header) => { header.parent_hash = ExecutionBlockHash::from_root(parent_hash); } ExecutionPayloadHeaderRefMut::Capella(header) => { @@ -132,7 +132,7 @@ impl BidStuff for BuilderBid { fn set_prev_randao(&mut self, prev_randao: Hash256) { match self.to_mut().header_mut() { - ExecutionPayloadHeaderRefMut::Merge(header) => { + ExecutionPayloadHeaderRefMut::Bellatrix(header) => { header.prev_randao = prev_randao; } ExecutionPayloadHeaderRefMut::Capella(header) => { @@ -149,7 +149,7 @@ impl BidStuff for BuilderBid { fn set_block_number(&mut self, block_number: u64) { match self.to_mut().header_mut() { - ExecutionPayloadHeaderRefMut::Merge(header) => { + ExecutionPayloadHeaderRefMut::Bellatrix(header) => { header.block_number = block_number; } ExecutionPayloadHeaderRefMut::Capella(header) => { @@ -166,7 +166,7 @@ impl BidStuff for BuilderBid { fn set_timestamp(&mut self, timestamp: u64) { match self.to_mut().header_mut() { - ExecutionPayloadHeaderRefMut::Merge(header) => { + ExecutionPayloadHeaderRefMut::Bellatrix(header) => { header.timestamp = timestamp; } ExecutionPayloadHeaderRefMut::Capella(header) => { @@ -183,7 +183,7 @@ impl BidStuff for BuilderBid { fn set_withdrawals_root(&mut self, withdrawals_root: Hash256) { match self.to_mut().header_mut() { - ExecutionPayloadHeaderRefMut::Merge(_) => { + ExecutionPayloadHeaderRefMut::Bellatrix(_) => { panic!("no withdrawals before capella") } ExecutionPayloadHeaderRefMut::Capella(header) => { @@ -336,7 +336,7 @@ pub fn serve( SignedBlindedBeaconBlock::Base(_) | types::SignedBeaconBlock::Altair(_) => { return Err(reject("invalid fork")); } - SignedBlindedBeaconBlock::Merge(block) => { + SignedBlindedBeaconBlock::Bellatrix(block) => { block.message.body.execution_payload.tree_hash_root() } SignedBlindedBeaconBlock::Capella(block) => { @@ -480,7 +480,7 @@ pub fn serve( .get_randao_mix(head_state.current_epoch()) .map_err(|_| reject("couldn't get prev randao"))?; let expected_withdrawals = match fork { - ForkName::Base | ForkName::Altair | ForkName::Merge => None, + ForkName::Base | ForkName::Altair | ForkName::Bellatrix => None, ForkName::Capella | ForkName::Deneb | ForkName::Electra => Some( builder .beacon_client @@ -496,7 +496,7 @@ pub fn serve( // first to avoid polluting the execution block generator with invalid payload attributes // NOTE: this was part of an effort to add payload attribute uniqueness checks, // which was abandoned because it broke too many tests in subtle ways. - ForkName::Merge | ForkName::Capella => PayloadAttributes::new( + ForkName::Bellatrix | ForkName::Capella => PayloadAttributes::new( timestamp, *prev_randao, fee_recipient, @@ -577,9 +577,9 @@ pub fn serve( value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI), pubkey: builder.builder_sk.public_key().compress(), }), - ForkName::Merge => BuilderBid::Merge(BuilderBidMerge { + ForkName::Bellatrix => BuilderBid::Bellatrix(BuilderBidBellatrix { header: payload - .as_merge() + .as_bellatrix() .map_err(|_| reject("incorrect payload variant"))? .into(), value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI), @@ -627,9 +627,9 @@ pub fn serve( value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI), pubkey: builder.builder_sk.public_key().compress(), }), - ForkName::Merge => BuilderBid::Merge(BuilderBidMerge { + ForkName::Bellatrix => BuilderBid::Bellatrix(BuilderBidBellatrix { header: payload - .as_merge() + .as_bellatrix() .map_err(|_| reject("incorrect payload variant"))? .into(), value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI), diff --git a/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs b/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs index f76edfa90b7..d6f1c79ffa8 100644 --- a/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs +++ b/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs @@ -138,7 +138,7 @@ impl MockExecutionLayer { &payload_attributes, forkchoice_update_params, builder_params, - ForkName::Merge, + ForkName::Bellatrix, &self.spec, None, BlockProductionVersion::FullV2, @@ -178,7 +178,7 @@ impl MockExecutionLayer { &payload_attributes, forkchoice_update_params, builder_params, - ForkName::Merge, + ForkName::Bellatrix, &self.spec, None, BlockProductionVersion::BlindedV2, diff --git a/beacon_node/http_api/src/build_block_contents.rs b/beacon_node/http_api/src/build_block_contents.rs index 7e3778b3fbb..05a6735b327 100644 --- a/beacon_node/http_api/src/build_block_contents.rs +++ b/beacon_node/http_api/src/build_block_contents.rs @@ -12,7 +12,7 @@ pub fn build_block_contents( Ok(ProduceBlockV3Response::Blinded(block.block)) } BeaconBlockResponseWrapper::Full(block) => match fork_name { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => Ok( + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => Ok( ProduceBlockV3Response::Full(FullBlockContents::Block(block.block)), ), ForkName::Deneb | ForkName::Electra => { diff --git a/beacon_node/http_api/src/builder_states.rs b/beacon_node/http_api/src/builder_states.rs index 90203f2d60c..a540113ab43 100644 --- a/beacon_node/http_api/src/builder_states.rs +++ b/beacon_node/http_api/src/builder_states.rs @@ -53,7 +53,7 @@ fn get_next_withdrawals_sanity_checks( } let fork = chain.spec.fork_name_at_slot::(proposal_slot); - if let ForkName::Base | ForkName::Altair | ForkName::Merge = fork { + if let ForkName::Base | ForkName::Altair | ForkName::Bellatrix = fork { return Err(warp_utils::reject::custom_bad_request( "the specified state is a pre-capella state.".to_string(), )); diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index cc117c3fb92..f58f7d95dad 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -4300,7 +4300,7 @@ pub fn serve( |task_spawner: TaskSpawner, chain: Arc>| { task_spawner.spawn_async_with_rejection(Priority::P1, async move { let current_slot = chain.slot_clock.now_or_genesis().unwrap_or(Slot::new(0)); - let merge_readiness = chain.check_merge_readiness(current_slot).await; + let merge_readiness = chain.check_bellatrix_readiness(current_slot).await; Ok::<_, warp::reject::Rejection>( warp::reply::json(&api_types::GenericResponse::from(merge_readiness)) .into_response(), diff --git a/beacon_node/http_api/src/publish_blocks.rs b/beacon_node/http_api/src/publish_blocks.rs index 52e77753ce4..0d176e6a53a 100644 --- a/beacon_node/http_api/src/publish_blocks.rs +++ b/beacon_node/http_api/src/publish_blocks.rs @@ -20,8 +20,8 @@ use tokio::sync::mpsc::UnboundedSender; use tree_hash::TreeHash; use types::{ AbstractExecPayload, BeaconBlockRef, BlobSidecarList, EthSpec, ExecPayload, ExecutionBlockHash, - ForkName, FullPayload, FullPayloadMerge, Hash256, SignedBeaconBlock, SignedBlindedBeaconBlock, - VariableList, + ForkName, FullPayload, FullPayloadBellatrix, Hash256, SignedBeaconBlock, + SignedBlindedBeaconBlock, VariableList, }; use warp::http::StatusCode; use warp::{reply::Response, Rejection, Reply}; @@ -80,7 +80,7 @@ pub async fn publish_block { crate::publish_pubsub_message(&sender, PubsubMessage::BeaconBlock(block)) .map_err(|_| BlockError::BeaconChainError(BeaconChainError::UnableToPublish))?; @@ -331,8 +331,8 @@ pub async fn reconstruct_block( let fork_name = chain .spec .fork_name_at_epoch(block.slot().epoch(T::EthSpec::slots_per_epoch())); - if fork_name == ForkName::Merge { - let payload: FullPayload = FullPayloadMerge::default().into(); + if fork_name == ForkName::Bellatrix { + let payload: FullPayload = FullPayloadBellatrix::default().into(); ProvenancedPayload::Local(FullPayloadContents::Payload(payload.into())) } else { Err(warp_utils::reject::custom_server_error( diff --git a/beacon_node/lighthouse_network/src/config.rs b/beacon_node/lighthouse_network/src/config.rs index 03f530db4d1..91c5b62d0b2 100644 --- a/beacon_node/lighthouse_network/src/config.rs +++ b/beacon_node/lighthouse_network/src/config.rs @@ -438,7 +438,7 @@ pub fn gossipsub_config( let topic_bytes = message.topic.as_str().as_bytes(); match fork_context.current_fork() { ForkName::Altair - | ForkName::Merge + | ForkName::Bellatrix | ForkName::Capella | ForkName::Deneb | ForkName::Electra => { @@ -461,7 +461,7 @@ pub fn gossipsub_config( } } let message_domain_valid_snappy = gossipsub_config_params.message_domain_valid_snappy; - let is_merge_enabled = fork_context.fork_exists(ForkName::Merge); + let is_bellatrix_enabled = fork_context.fork_exists(ForkName::Bellatrix); let gossip_message_id = move |message: &gossipsub::Message| { gossipsub::MessageId::from( &Sha256::digest( @@ -481,7 +481,7 @@ pub fn gossipsub_config( gossipsub::ConfigBuilder::default() .max_transmit_size(gossip_max_size( - is_merge_enabled, + is_bellatrix_enabled, gossipsub_config_params.gossip_max_size, )) .heartbeat_interval(load.heartbeat_interval) diff --git a/beacon_node/lighthouse_network/src/rpc/codec/base.rs b/beacon_node/lighthouse_network/src/rpc/codec/base.rs index 287f0a3f5fd..42a31d3480a 100644 --- a/beacon_node/lighthouse_network/src/rpc/codec/base.rs +++ b/beacon_node/lighthouse_network/src/rpc/codec/base.rs @@ -184,13 +184,13 @@ mod tests { fn fork_context(fork_name: ForkName) -> ForkContext { let mut chain_spec = Spec::default_spec(); let altair_fork_epoch = Epoch::new(1); - let merge_fork_epoch = Epoch::new(2); + let bellatrix_fork_epoch = Epoch::new(2); let capella_fork_epoch = Epoch::new(3); let deneb_fork_epoch = Epoch::new(4); let electra_fork_epoch = Epoch::new(5); chain_spec.altair_fork_epoch = Some(altair_fork_epoch); - chain_spec.bellatrix_fork_epoch = Some(merge_fork_epoch); + chain_spec.bellatrix_fork_epoch = Some(bellatrix_fork_epoch); chain_spec.capella_fork_epoch = Some(capella_fork_epoch); chain_spec.deneb_fork_epoch = Some(deneb_fork_epoch); chain_spec.electra_fork_epoch = Some(electra_fork_epoch); @@ -198,7 +198,7 @@ mod tests { let current_slot = match fork_name { ForkName::Base => Slot::new(0), ForkName::Altair => altair_fork_epoch.start_slot(Spec::slots_per_epoch()), - ForkName::Merge => merge_fork_epoch.start_slot(Spec::slots_per_epoch()), + ForkName::Bellatrix => bellatrix_fork_epoch.start_slot(Spec::slots_per_epoch()), ForkName::Capella => capella_fork_epoch.start_slot(Spec::slots_per_epoch()), ForkName::Deneb => deneb_fork_epoch.start_slot(Spec::slots_per_epoch()), ForkName::Electra => electra_fork_epoch.start_slot(Spec::slots_per_epoch()), diff --git a/beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs b/beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs index 4cbb6582583..482d1d96b4a 100644 --- a/beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs +++ b/beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs @@ -18,8 +18,8 @@ use tokio_util::codec::{Decoder, Encoder}; use types::{ BlobSidecar, ChainSpec, EthSpec, ForkContext, ForkName, Hash256, LightClientBootstrap, LightClientFinalityUpdate, LightClientOptimisticUpdate, RuntimeVariableList, SignedBeaconBlock, - SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockCapella, - SignedBeaconBlockDeneb, SignedBeaconBlockElectra, SignedBeaconBlockMerge, + SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockBellatrix, + SignedBeaconBlockCapella, SignedBeaconBlockDeneb, SignedBeaconBlockElectra, }; use unsigned_varint::codec::Uvi; @@ -403,8 +403,8 @@ fn context_bytes( SignedBeaconBlock::Capella { .. } => { fork_context.to_context_bytes(ForkName::Capella) } - SignedBeaconBlock::Merge { .. } => { - fork_context.to_context_bytes(ForkName::Merge) + SignedBeaconBlock::Bellatrix { .. } => { + fork_context.to_context_bytes(ForkName::Bellatrix) } SignedBeaconBlock::Altair { .. } => { fork_context.to_context_bytes(ForkName::Altair) @@ -658,8 +658,10 @@ fn handle_rpc_response( Some(ForkName::Base) => Ok(Some(RPCResponse::BlocksByRange(Arc::new( SignedBeaconBlock::Base(SignedBeaconBlockBase::from_ssz_bytes(decoded_buffer)?), )))), - Some(ForkName::Merge) => Ok(Some(RPCResponse::BlocksByRange(Arc::new( - SignedBeaconBlock::Merge(SignedBeaconBlockMerge::from_ssz_bytes(decoded_buffer)?), + Some(ForkName::Bellatrix) => Ok(Some(RPCResponse::BlocksByRange(Arc::new( + SignedBeaconBlock::Bellatrix(SignedBeaconBlockBellatrix::from_ssz_bytes( + decoded_buffer, + )?), )))), Some(ForkName::Capella) => Ok(Some(RPCResponse::BlocksByRange(Arc::new( SignedBeaconBlock::Capella(SignedBeaconBlockCapella::from_ssz_bytes( @@ -689,8 +691,10 @@ fn handle_rpc_response( Some(ForkName::Base) => Ok(Some(RPCResponse::BlocksByRoot(Arc::new( SignedBeaconBlock::Base(SignedBeaconBlockBase::from_ssz_bytes(decoded_buffer)?), )))), - Some(ForkName::Merge) => Ok(Some(RPCResponse::BlocksByRoot(Arc::new( - SignedBeaconBlock::Merge(SignedBeaconBlockMerge::from_ssz_bytes(decoded_buffer)?), + Some(ForkName::Bellatrix) => Ok(Some(RPCResponse::BlocksByRoot(Arc::new( + SignedBeaconBlock::Bellatrix(SignedBeaconBlockBellatrix::from_ssz_bytes( + decoded_buffer, + )?), )))), Some(ForkName::Capella) => Ok(Some(RPCResponse::BlocksByRoot(Arc::new( SignedBeaconBlock::Capella(SignedBeaconBlockCapella::from_ssz_bytes( @@ -743,7 +747,7 @@ mod tests { use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield}; use types::{ blob_sidecar::BlobIdentifier, BeaconBlock, BeaconBlockAltair, BeaconBlockBase, - BeaconBlockMerge, EmptyBlock, Epoch, FullPayload, Signature, Slot, + BeaconBlockBellatrix, EmptyBlock, Epoch, FullPayload, Signature, Slot, }; type Spec = types::MainnetEthSpec; @@ -751,13 +755,13 @@ mod tests { fn fork_context(fork_name: ForkName) -> ForkContext { let mut chain_spec = Spec::default_spec(); let altair_fork_epoch = Epoch::new(1); - let merge_fork_epoch = Epoch::new(2); + let bellatrix_fork_epoch = Epoch::new(2); let capella_fork_epoch = Epoch::new(3); let deneb_fork_epoch = Epoch::new(4); let electra_fork_epoch = Epoch::new(5); chain_spec.altair_fork_epoch = Some(altair_fork_epoch); - chain_spec.bellatrix_fork_epoch = Some(merge_fork_epoch); + chain_spec.bellatrix_fork_epoch = Some(bellatrix_fork_epoch); chain_spec.capella_fork_epoch = Some(capella_fork_epoch); chain_spec.deneb_fork_epoch = Some(deneb_fork_epoch); chain_spec.electra_fork_epoch = Some(electra_fork_epoch); @@ -765,7 +769,7 @@ mod tests { let current_slot = match fork_name { ForkName::Base => Slot::new(0), ForkName::Altair => altair_fork_epoch.start_slot(Spec::slots_per_epoch()), - ForkName::Merge => merge_fork_epoch.start_slot(Spec::slots_per_epoch()), + ForkName::Bellatrix => bellatrix_fork_epoch.start_slot(Spec::slots_per_epoch()), ForkName::Capella => capella_fork_epoch.start_slot(Spec::slots_per_epoch()), ForkName::Deneb => deneb_fork_epoch.start_slot(Spec::slots_per_epoch()), ForkName::Electra => electra_fork_epoch.start_slot(Spec::slots_per_epoch()), @@ -790,32 +794,38 @@ mod tests { Arc::new(BlobSidecar::empty()) } - /// Merge block with length < max_rpc_size. - fn merge_block_small(fork_context: &ForkContext, spec: &ChainSpec) -> SignedBeaconBlock { - let mut block: BeaconBlockMerge<_, FullPayload> = - BeaconBlockMerge::empty(&Spec::default_spec()); + /// Bellatrix block with length < max_rpc_size. + fn bellatrix_block_small( + fork_context: &ForkContext, + spec: &ChainSpec, + ) -> SignedBeaconBlock { + let mut block: BeaconBlockBellatrix<_, FullPayload> = + BeaconBlockBellatrix::empty(&Spec::default_spec()); let tx = VariableList::from(vec![0; 1024]); let txs = VariableList::from(std::iter::repeat(tx).take(5000).collect::>()); block.body.execution_payload.execution_payload.transactions = txs; - let block = BeaconBlock::Merge(block); + let block = BeaconBlock::Bellatrix(block); assert!(block.ssz_bytes_len() <= max_rpc_size(fork_context, spec.max_chunk_size as usize)); SignedBeaconBlock::from_block(block, Signature::empty()) } - /// Merge block with length > MAX_RPC_SIZE. - /// The max limit for a merge block is in the order of ~16GiB which wouldn't fit in memory. - /// Hence, we generate a merge block just greater than `MAX_RPC_SIZE` to test rejection on the rpc layer. - fn merge_block_large(fork_context: &ForkContext, spec: &ChainSpec) -> SignedBeaconBlock { - let mut block: BeaconBlockMerge<_, FullPayload> = - BeaconBlockMerge::empty(&Spec::default_spec()); + /// Bellatrix block with length > MAX_RPC_SIZE. + /// The max limit for a Bellatrix block is in the order of ~16GiB which wouldn't fit in memory. + /// Hence, we generate a Bellatrix block just greater than `MAX_RPC_SIZE` to test rejection on the rpc layer. + fn bellatrix_block_large( + fork_context: &ForkContext, + spec: &ChainSpec, + ) -> SignedBeaconBlock { + let mut block: BeaconBlockBellatrix<_, FullPayload> = + BeaconBlockBellatrix::empty(&Spec::default_spec()); let tx = VariableList::from(vec![0; 1024]); let txs = VariableList::from(std::iter::repeat(tx).take(100000).collect::>()); block.body.execution_payload.execution_payload.transactions = txs; - let block = BeaconBlock::Merge(block); + let block = BeaconBlock::Bellatrix(block); assert!(block.ssz_bytes_len() > max_rpc_size(fork_context, spec.max_chunk_size as usize)); SignedBeaconBlock::from_block(block, Signature::empty()) } @@ -1172,25 +1182,27 @@ mod tests { Ok(Some(RPCResponse::BlocksByRange(Arc::new(altair_block())))) ); - let merge_block_small = merge_block_small(&fork_context(ForkName::Merge), &chain_spec); - let merge_block_large = merge_block_large(&fork_context(ForkName::Merge), &chain_spec); + let bellatrix_block_small = + bellatrix_block_small(&fork_context(ForkName::Bellatrix), &chain_spec); + let bellatrix_block_large = + bellatrix_block_large(&fork_context(ForkName::Bellatrix), &chain_spec); assert_eq!( encode_then_decode_response( SupportedProtocol::BlocksByRangeV2, RPCCodedResponse::Success(RPCResponse::BlocksByRange(Arc::new( - merge_block_small.clone() + bellatrix_block_small.clone() ))), - ForkName::Merge, + ForkName::Bellatrix, &chain_spec, ), Ok(Some(RPCResponse::BlocksByRange(Arc::new( - merge_block_small.clone() + bellatrix_block_small.clone() )))) ); let mut encoded = - encode_without_length_checks(merge_block_large.as_ssz_bytes(), ForkName::Merge) + encode_without_length_checks(bellatrix_block_large.as_ssz_bytes(), ForkName::Bellatrix) .unwrap(); assert!( @@ -1198,7 +1210,7 @@ mod tests { decode_response( SupportedProtocol::BlocksByRangeV2, &mut encoded, - ForkName::Merge, + ForkName::Bellatrix, &chain_spec, ) .unwrap_err(), @@ -1248,16 +1260,18 @@ mod tests { encode_then_decode_response( SupportedProtocol::BlocksByRootV2, RPCCodedResponse::Success(RPCResponse::BlocksByRoot(Arc::new( - merge_block_small.clone() + bellatrix_block_small.clone() ))), - ForkName::Merge, + ForkName::Bellatrix, &chain_spec, ), - Ok(Some(RPCResponse::BlocksByRoot(Arc::new(merge_block_small)))) + Ok(Some(RPCResponse::BlocksByRoot(Arc::new( + bellatrix_block_small + )))) ); let mut encoded = - encode_without_length_checks(merge_block_large.as_ssz_bytes(), ForkName::Merge) + encode_without_length_checks(bellatrix_block_large.as_ssz_bytes(), ForkName::Bellatrix) .unwrap(); assert!( @@ -1265,7 +1279,7 @@ mod tests { decode_response( SupportedProtocol::BlocksByRootV2, &mut encoded, - ForkName::Merge, + ForkName::Bellatrix, &chain_spec, ) .unwrap_err(), diff --git a/beacon_node/lighthouse_network/src/rpc/protocol.rs b/beacon_node/lighthouse_network/src/rpc/protocol.rs index f65586087c2..12a7f09338e 100644 --- a/beacon_node/lighthouse_network/src/rpc/protocol.rs +++ b/beacon_node/lighthouse_network/src/rpc/protocol.rs @@ -17,8 +17,8 @@ use tokio_util::{ compat::{Compat, FuturesAsyncReadCompatExt}, }; use types::{ - BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockCapella, BeaconBlockElectra, - BeaconBlockMerge, BlobSidecar, ChainSpec, EmptyBlock, EthSpec, ForkContext, ForkName, + BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BeaconBlockCapella, + BeaconBlockElectra, BlobSidecar, ChainSpec, EmptyBlock, EthSpec, ForkContext, ForkName, LightClientBootstrap, LightClientBootstrapAltair, LightClientFinalityUpdate, LightClientFinalityUpdateAltair, LightClientOptimisticUpdate, LightClientOptimisticUpdateAltair, MainnetEthSpec, Signature, SignedBeaconBlock, @@ -53,8 +53,8 @@ lazy_static! { .as_ssz_bytes() .len(); - pub static ref SIGNED_BEACON_BLOCK_MERGE_MIN: usize = SignedBeaconBlock::::from_block( - BeaconBlock::Merge(BeaconBlockMerge::::empty(&MainnetEthSpec::default_spec())), + pub static ref SIGNED_BEACON_BLOCK_BELLATRIX_MIN: usize = SignedBeaconBlock::::from_block( + BeaconBlock::Bellatrix(BeaconBlockBellatrix::::empty(&MainnetEthSpec::default_spec())), Signature::empty(), ) .as_ssz_bytes() @@ -74,14 +74,14 @@ lazy_static! { .as_ssz_bytes() .len(); - /// The `BeaconBlockMerge` block has an `ExecutionPayload` field which has a max size ~16 GiB for future proofing. + /// The `BeaconBlockBellatrix` block has an `ExecutionPayload` field which has a max size ~16 GiB for future proofing. /// We calculate the value from its fields instead of constructing the block and checking the length. /// Note: This is only the theoretical upper bound. We further bound the max size we receive over the network /// with `max_chunk_size`. - pub static ref SIGNED_BEACON_BLOCK_MERGE_MAX: usize = + pub static ref SIGNED_BEACON_BLOCK_BELLATRIX_MAX: usize = // Size of a full altair block *SIGNED_BEACON_BLOCK_ALTAIR_MAX - + types::ExecutionPayload::::max_execution_payload_merge_size() // adding max size of execution payload (~16gb) + + types::ExecutionPayload::::max_execution_payload_bellatrix_size() // adding max size of execution payload (~16gb) + ssz::BYTES_PER_LENGTH_OFFSET; // Adding the additional ssz offset for the `ExecutionPayload` field pub static ref SIGNED_BEACON_BLOCK_CAPELLA_MAX: usize = *SIGNED_BEACON_BLOCK_CAPELLA_MAX_WITHOUT_PAYLOAD @@ -134,7 +134,7 @@ const REQUEST_TIMEOUT: u64 = 15; pub fn max_rpc_size(fork_context: &ForkContext, max_chunk_size: usize) -> usize { match fork_context.current_fork() { ForkName::Altair | ForkName::Base => max_chunk_size / 10, - ForkName::Merge => max_chunk_size, + ForkName::Bellatrix => max_chunk_size, ForkName::Capella => max_chunk_size, ForkName::Deneb => max_chunk_size, ForkName::Electra => max_chunk_size, @@ -154,20 +154,20 @@ pub fn rpc_block_limits_by_fork(current_fork: ForkName) -> RpcLimits { *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair blocks *SIGNED_BEACON_BLOCK_ALTAIR_MAX, // Altair block is larger than base blocks ), - ForkName::Merge => RpcLimits::new( - *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and merge blocks - *SIGNED_BEACON_BLOCK_MERGE_MAX, // Merge block is larger than base and altair blocks + ForkName::Bellatrix => RpcLimits::new( + *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks + *SIGNED_BEACON_BLOCK_BELLATRIX_MAX, // Bellatrix block is larger than base and altair blocks ), ForkName::Capella => RpcLimits::new( - *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and merge blocks + *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks *SIGNED_BEACON_BLOCK_CAPELLA_MAX, // Capella block is larger than base, altair and merge blocks ), ForkName::Deneb => RpcLimits::new( - *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and merge blocks + *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks *SIGNED_BEACON_BLOCK_DENEB_MAX, // Deneb block is larger than all prior fork blocks ), ForkName::Electra => RpcLimits::new( - *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and merge blocks + *SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks *SIGNED_BEACON_BLOCK_ELECTRA_MAX, // Electra block is larger than Deneb block ), } @@ -178,7 +178,9 @@ fn rpc_light_client_finality_update_limits_by_fork(current_fork: ForkName) -> Rp match ¤t_fork { ForkName::Base => RpcLimits::new(0, 0), - ForkName::Altair | ForkName::Merge => RpcLimits::new(altair_fixed_len, altair_fixed_len), + ForkName::Altair | ForkName::Bellatrix => { + RpcLimits::new(altair_fixed_len, altair_fixed_len) + } ForkName::Capella => { RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_FINALITY_UPDATE_CAPELLA_MAX) } @@ -196,7 +198,9 @@ fn rpc_light_client_optimistic_update_limits_by_fork(current_fork: ForkName) -> match ¤t_fork { ForkName::Base => RpcLimits::new(0, 0), - ForkName::Altair | ForkName::Merge => RpcLimits::new(altair_fixed_len, altair_fixed_len), + ForkName::Altair | ForkName::Bellatrix => { + RpcLimits::new(altair_fixed_len, altair_fixed_len) + } ForkName::Capella => RpcLimits::new( altair_fixed_len, *LIGHT_CLIENT_OPTIMISTIC_UPDATE_CAPELLA_MAX, @@ -216,7 +220,9 @@ fn rpc_light_client_bootstrap_limits_by_fork(current_fork: ForkName) -> RpcLimit match ¤t_fork { ForkName::Base => RpcLimits::new(0, 0), - ForkName::Altair | ForkName::Merge => RpcLimits::new(altair_fixed_len, altair_fixed_len), + ForkName::Altair | ForkName::Bellatrix => { + RpcLimits::new(altair_fixed_len, altair_fixed_len) + } ForkName::Capella => RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_BOOTSTRAP_CAPELLA_MAX), ForkName::Deneb => RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_BOOTSTRAP_DENEB_MAX), ForkName::Electra => RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_BOOTSTRAP_ELECTRA_MAX), diff --git a/beacon_node/lighthouse_network/src/types/pubsub.rs b/beacon_node/lighthouse_network/src/types/pubsub.rs index a5cf03412d5..ed63ad014c9 100644 --- a/beacon_node/lighthouse_network/src/types/pubsub.rs +++ b/beacon_node/lighthouse_network/src/types/pubsub.rs @@ -10,8 +10,8 @@ use types::{ Attestation, AttesterSlashing, BlobSidecar, EthSpec, ForkContext, ForkName, LightClientFinalityUpdate, LightClientOptimisticUpdate, ProposerSlashing, SignedAggregateAndProof, SignedBeaconBlock, SignedBeaconBlockAltair, SignedBeaconBlockBase, - SignedBeaconBlockCapella, SignedBeaconBlockDeneb, SignedBeaconBlockElectra, - SignedBeaconBlockMerge, SignedBlsToExecutionChange, SignedContributionAndProof, + SignedBeaconBlockBellatrix, SignedBeaconBlockCapella, SignedBeaconBlockDeneb, + SignedBeaconBlockElectra, SignedBlsToExecutionChange, SignedContributionAndProof, SignedVoluntaryExit, SubnetId, SyncCommitteeMessage, SyncSubnetId, }; @@ -179,8 +179,8 @@ impl PubsubMessage { SignedBeaconBlockAltair::from_ssz_bytes(data) .map_err(|e| format!("{:?}", e))?, ), - Some(ForkName::Merge) => SignedBeaconBlock::::Merge( - SignedBeaconBlockMerge::from_ssz_bytes(data) + Some(ForkName::Bellatrix) => SignedBeaconBlock::::Bellatrix( + SignedBeaconBlockBellatrix::from_ssz_bytes(data) .map_err(|e| format!("{:?}", e))?, ), Some(ForkName::Capella) => SignedBeaconBlock::::Capella( @@ -219,7 +219,7 @@ impl PubsubMessage { Some( ForkName::Base | ForkName::Altair - | ForkName::Merge + | ForkName::Bellatrix | ForkName::Capella, ) | None => Err(format!( diff --git a/beacon_node/lighthouse_network/src/types/topics.rs b/beacon_node/lighthouse_network/src/types/topics.rs index 7cbb5bac57f..c5f4b0c9ebb 100644 --- a/beacon_node/lighthouse_network/src/types/topics.rs +++ b/beacon_node/lighthouse_network/src/types/topics.rs @@ -47,7 +47,7 @@ pub fn fork_core_topics(fork_name: &ForkName, spec: &ChainSpec) -> V match fork_name { ForkName::Base => BASE_CORE_TOPICS.to_vec(), ForkName::Altair => ALTAIR_CORE_TOPICS.to_vec(), - ForkName::Merge => vec![], + ForkName::Bellatrix => vec![], ForkName::Capella => CAPELLA_CORE_TOPICS.to_vec(), ForkName::Deneb => { // All of deneb blob topics are core topics diff --git a/beacon_node/lighthouse_network/tests/common.rs b/beacon_node/lighthouse_network/tests/common.rs index 40ae341bd26..32e3a034666 100644 --- a/beacon_node/lighthouse_network/tests/common.rs +++ b/beacon_node/lighthouse_network/tests/common.rs @@ -21,13 +21,13 @@ use tempfile::Builder as TempBuilder; pub fn fork_context(fork_name: ForkName) -> ForkContext { let mut chain_spec = E::default_spec(); let altair_fork_epoch = Epoch::new(1); - let merge_fork_epoch = Epoch::new(2); + let bellatrix_fork_epoch = Epoch::new(2); let capella_fork_epoch = Epoch::new(3); let deneb_fork_epoch = Epoch::new(4); let electra_fork_epoch = Epoch::new(5); chain_spec.altair_fork_epoch = Some(altair_fork_epoch); - chain_spec.bellatrix_fork_epoch = Some(merge_fork_epoch); + chain_spec.bellatrix_fork_epoch = Some(bellatrix_fork_epoch); chain_spec.capella_fork_epoch = Some(capella_fork_epoch); chain_spec.deneb_fork_epoch = Some(deneb_fork_epoch); chain_spec.electra_fork_epoch = Some(electra_fork_epoch); @@ -35,7 +35,7 @@ pub fn fork_context(fork_name: ForkName) -> ForkContext { let current_slot = match fork_name { ForkName::Base => Slot::new(0), ForkName::Altair => altair_fork_epoch.start_slot(E::slots_per_epoch()), - ForkName::Merge => merge_fork_epoch.start_slot(E::slots_per_epoch()), + ForkName::Bellatrix => bellatrix_fork_epoch.start_slot(E::slots_per_epoch()), ForkName::Capella => capella_fork_epoch.start_slot(E::slots_per_epoch()), ForkName::Deneb => deneb_fork_epoch.start_slot(E::slots_per_epoch()), ForkName::Electra => electra_fork_epoch.start_slot(E::slots_per_epoch()), diff --git a/beacon_node/lighthouse_network/tests/rpc_tests.rs b/beacon_node/lighthouse_network/tests/rpc_tests.rs index 5a21b462d43..a60af4db3db 100644 --- a/beacon_node/lighthouse_network/tests/rpc_tests.rs +++ b/beacon_node/lighthouse_network/tests/rpc_tests.rs @@ -13,37 +13,37 @@ use std::time::Duration; use tokio::runtime::Runtime; use tokio::time::sleep; use types::{ - BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockMerge, BlobSidecar, ChainSpec, + BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BlobSidecar, ChainSpec, EmptyBlock, Epoch, EthSpec, ForkContext, ForkName, Hash256, MinimalEthSpec, Signature, SignedBeaconBlock, Slot, }; type E = MinimalEthSpec; -/// Merge block with length < max_rpc_size. -fn merge_block_small(fork_context: &ForkContext, spec: &ChainSpec) -> BeaconBlock { - let mut block = BeaconBlockMerge::::empty(spec); +/// Bellatrix block with length < max_rpc_size. +fn bellatrix_block_small(fork_context: &ForkContext, spec: &ChainSpec) -> BeaconBlock { + let mut block = BeaconBlockBellatrix::::empty(spec); let tx = VariableList::from(vec![0; 1024]); let txs = VariableList::from(std::iter::repeat(tx).take(5000).collect::>()); block.body.execution_payload.execution_payload.transactions = txs; - let block = BeaconBlock::Merge(block); + let block = BeaconBlock::Bellatrix(block); assert!(block.ssz_bytes_len() <= max_rpc_size(fork_context, spec.max_chunk_size as usize)); block } -/// Merge block with length > MAX_RPC_SIZE. -/// The max limit for a merge block is in the order of ~16GiB which wouldn't fit in memory. -/// Hence, we generate a merge block just greater than `MAX_RPC_SIZE` to test rejection on the rpc layer. -fn merge_block_large(fork_context: &ForkContext, spec: &ChainSpec) -> BeaconBlock { - let mut block = BeaconBlockMerge::::empty(spec); +/// Bellatrix block with length > MAX_RPC_SIZE. +/// The max limit for a bellatrix block is in the order of ~16GiB which wouldn't fit in memory. +/// Hence, we generate a bellatrix block just greater than `MAX_RPC_SIZE` to test rejection on the rpc layer. +fn bellatrix_block_large(fork_context: &ForkContext, spec: &ChainSpec) -> BeaconBlock { + let mut block = BeaconBlockBellatrix::::empty(spec); let tx = VariableList::from(vec![0; 1024]); let txs = VariableList::from(std::iter::repeat(tx).take(100000).collect::>()); block.body.execution_payload.execution_payload.transactions = txs; - let block = BeaconBlock::Merge(block); + let block = BeaconBlock::Bellatrix(block); assert!(block.ssz_bytes_len() > max_rpc_size(fork_context, spec.max_chunk_size as usize)); block } @@ -167,7 +167,7 @@ fn test_tcp_blocks_by_range_chunked_rpc() { let (mut sender, mut receiver) = common::build_node_pair( Arc::downgrade(&rt), &log, - ForkName::Merge, + ForkName::Bellatrix, &spec, Protocol::Tcp, ) @@ -187,9 +187,10 @@ fn test_tcp_blocks_by_range_chunked_rpc() { let signed_full_block = SignedBeaconBlock::from_block(full_block, Signature::empty()); let rpc_response_altair = Response::BlocksByRange(Some(Arc::new(signed_full_block))); - let full_block = merge_block_small(&common::fork_context(ForkName::Merge), &spec); + let full_block = bellatrix_block_small(&common::fork_context(ForkName::Bellatrix), &spec); let signed_full_block = SignedBeaconBlock::from_block(full_block, Signature::empty()); - let rpc_response_merge_small = Response::BlocksByRange(Some(Arc::new(signed_full_block))); + let rpc_response_bellatrix_small = + Response::BlocksByRange(Some(Arc::new(signed_full_block))); // keep count of the number of messages received let mut messages_received = 0; @@ -216,7 +217,7 @@ fn test_tcp_blocks_by_range_chunked_rpc() { } else if messages_received < 4 { assert_eq!(response, rpc_response_altair.clone()); } else { - assert_eq!(response, rpc_response_merge_small.clone()); + assert_eq!(response, rpc_response_bellatrix_small.clone()); } messages_received += 1; warn!(log, "Chunk received"); @@ -249,13 +250,13 @@ fn test_tcp_blocks_by_range_chunked_rpc() { warn!(log, "Receiver got request"); for i in 0..messages_to_send { // Send first third of responses as base blocks, - // second as altair and third as merge. + // second as altair and third as bellatrix. let rpc_response = if i < 2 { rpc_response_base.clone() } else if i < 4 { rpc_response_altair.clone() } else { - rpc_response_merge_small.clone() + rpc_response_bellatrix_small.clone() }; receiver.send_response(peer_id, id, rpc_response.clone()); } @@ -368,7 +369,7 @@ fn test_blobs_by_range_chunked_rpc() { warn!(log, "Receiver got request"); for _ in 0..messages_to_send { // Send first third of responses as base blocks, - // second as altair and third as merge. + // second as altair and third as bellatrix. receiver.send_response(peer_id, id, rpc_response.clone()); } // send the stream termination @@ -411,7 +412,7 @@ fn test_tcp_blocks_by_range_over_limit() { let (mut sender, mut receiver) = common::build_node_pair( Arc::downgrade(&rt), &log, - ForkName::Merge, + ForkName::Bellatrix, &spec, Protocol::Tcp, ) @@ -421,9 +422,10 @@ fn test_tcp_blocks_by_range_over_limit() { let rpc_request = Request::BlocksByRange(BlocksByRangeRequest::new(0, messages_to_send)); // BlocksByRange Response - let full_block = merge_block_large(&common::fork_context(ForkName::Merge), &spec); + let full_block = bellatrix_block_large(&common::fork_context(ForkName::Bellatrix), &spec); let signed_full_block = SignedBeaconBlock::from_block(full_block, Signature::empty()); - let rpc_response_merge_large = Response::BlocksByRange(Some(Arc::new(signed_full_block))); + let rpc_response_bellatrix_large = + Response::BlocksByRange(Some(Arc::new(signed_full_block))); let request_id = messages_to_send as usize; // build the sender future @@ -458,7 +460,7 @@ fn test_tcp_blocks_by_range_over_limit() { // send the response warn!(log, "Receiver got request"); for _ in 0..messages_to_send { - let rpc_response = rpc_response_merge_large.clone(); + let rpc_response = rpc_response_bellatrix_large.clone(); receiver.send_response(peer_id, id, rpc_response.clone()); } // send the stream termination @@ -736,7 +738,7 @@ fn test_tcp_blocks_by_root_chunked_rpc() { let (mut sender, mut receiver) = common::build_node_pair( Arc::downgrade(&rt), &log, - ForkName::Merge, + ForkName::Bellatrix, &spec, Protocol::Tcp, ) @@ -764,9 +766,10 @@ fn test_tcp_blocks_by_root_chunked_rpc() { let signed_full_block = SignedBeaconBlock::from_block(full_block, Signature::empty()); let rpc_response_altair = Response::BlocksByRoot(Some(Arc::new(signed_full_block))); - let full_block = merge_block_small(&common::fork_context(ForkName::Merge), &spec); + let full_block = bellatrix_block_small(&common::fork_context(ForkName::Bellatrix), &spec); let signed_full_block = SignedBeaconBlock::from_block(full_block, Signature::empty()); - let rpc_response_merge_small = Response::BlocksByRoot(Some(Arc::new(signed_full_block))); + let rpc_response_bellatrix_small = + Response::BlocksByRoot(Some(Arc::new(signed_full_block))); // keep count of the number of messages received let mut messages_received = 0; @@ -790,7 +793,7 @@ fn test_tcp_blocks_by_root_chunked_rpc() { } else if messages_received < 4 { assert_eq!(response, rpc_response_altair.clone()); } else { - assert_eq!(response, rpc_response_merge_small.clone()); + assert_eq!(response, rpc_response_bellatrix_small.clone()); } messages_received += 1; debug!(log, "Chunk received"); @@ -822,13 +825,13 @@ fn test_tcp_blocks_by_root_chunked_rpc() { debug!(log, "Receiver got request"); for i in 0..messages_to_send { - // Send equal base, altair and merge blocks + // Send equal base, altair and bellatrix blocks let rpc_response = if i < 2 { rpc_response_base.clone() } else if i < 4 { rpc_response_altair.clone() } else { - rpc_response_merge_small.clone() + rpc_response_bellatrix_small.clone() }; receiver.send_response(peer_id, id, rpc_response); debug!(log, "Sending message"); diff --git a/beacon_node/network/src/network_beacon_processor/rpc_methods.rs b/beacon_node/network/src/network_beacon_processor/rpc_methods.rs index 1e72dc42578..2a0c7ea089b 100644 --- a/beacon_node/network/src/network_beacon_processor/rpc_methods.rs +++ b/beacon_node/network/src/network_beacon_processor/rpc_methods.rs @@ -433,9 +433,10 @@ impl NetworkBeaconProcessor { ForkName::Deneb | ForkName::Electra => { self.chain.spec.max_request_blocks_deneb } - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { - self.chain.spec.max_request_blocks - } + ForkName::Base + | ForkName::Altair + | ForkName::Bellatrix + | ForkName::Capella => self.chain.spec.max_request_blocks, } }); if *req.count() > max_request_size { diff --git a/beacon_node/store/src/impls/execution_payload.rs b/beacon_node/store/src/impls/execution_payload.rs index a874031ca27..14fc10ad6de 100644 --- a/beacon_node/store/src/impls/execution_payload.rs +++ b/beacon_node/store/src/impls/execution_payload.rs @@ -1,8 +1,8 @@ use crate::{DBColumn, Error, StoreItem}; use ssz::{Decode, Encode}; use types::{ - BlobSidecarList, EthSpec, ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb, - ExecutionPayloadElectra, ExecutionPayloadMerge, + BlobSidecarList, EthSpec, ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, + ExecutionPayloadDeneb, ExecutionPayloadElectra, }; macro_rules! impl_store_item { @@ -22,7 +22,7 @@ macro_rules! impl_store_item { } }; } -impl_store_item!(ExecutionPayloadMerge); +impl_store_item!(ExecutionPayloadBellatrix); impl_store_item!(ExecutionPayloadCapella); impl_store_item!(ExecutionPayloadDeneb); impl_store_item!(ExecutionPayloadElectra); @@ -51,7 +51,8 @@ impl StoreItem for ExecutionPayload { ExecutionPayloadCapella::from_ssz_bytes(bytes) .map(Self::Capella) .or_else(|_| { - ExecutionPayloadMerge::from_ssz_bytes(bytes).map(Self::Merge) + ExecutionPayloadBellatrix::from_ssz_bytes(bytes) + .map(Self::Bellatrix) }) }) }) diff --git a/beacon_node/store/src/partial_beacon_state.rs b/beacon_node/store/src/partial_beacon_state.rs index 4e5a2b8e64b..999cdbf8fe9 100644 --- a/beacon_node/store/src/partial_beacon_state.rs +++ b/beacon_node/store/src/partial_beacon_state.rs @@ -14,7 +14,7 @@ use types::*; /// /// Utilises lazy-loading from separate storage for its vector fields. #[superstruct( - variants(Base, Altair, Merge, Capella, Deneb, Electra), + variants(Base, Altair, Bellatrix, Capella, Deneb, Electra), variant_attributes(derive(Debug, PartialEq, Clone, Encode, Decode)) )] #[derive(Debug, PartialEq, Clone, Encode)] @@ -66,9 +66,9 @@ where pub current_epoch_attestations: VariableList, E::MaxPendingAttestations>, // Participation (Altair and later) - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub previous_epoch_participation: VariableList, - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub current_epoch_participation: VariableList, // Finality @@ -78,21 +78,21 @@ where pub finalized_checkpoint: Checkpoint, // Inactivity - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub inactivity_scores: VariableList, // Light-client sync committees - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub current_sync_committee: Arc>, - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub next_sync_committee: Arc>, // Execution #[superstruct( - only(Merge), - partial_getter(rename = "latest_execution_payload_header_merge") + only(Bellatrix), + partial_getter(rename = "latest_execution_payload_header_bellatrix") )] - pub latest_execution_payload_header: ExecutionPayloadHeaderMerge, + pub latest_execution_payload_header: ExecutionPayloadHeaderBellatrix, #[superstruct( only(Capella), partial_getter(rename = "latest_execution_payload_header_capella") @@ -199,11 +199,11 @@ impl PartialBeaconState { ], [] ), - BeaconState::Merge(s) => impl_from_state_forgetful!( + BeaconState::Bellatrix(s) => impl_from_state_forgetful!( s, outer, - Merge, - PartialBeaconStateMerge, + Bellatrix, + PartialBeaconStateBellatrix, [ previous_epoch_participation, current_epoch_participation, @@ -466,10 +466,10 @@ impl TryInto> for PartialBeaconState { ], [] ), - PartialBeaconState::Merge(inner) => impl_try_into_beacon_state!( + PartialBeaconState::Bellatrix(inner) => impl_try_into_beacon_state!( inner, - Merge, - BeaconStateMerge, + Bellatrix, + BeaconStateBellatrix, [ previous_epoch_participation, current_epoch_participation, diff --git a/common/eth2/src/types.rs b/common/eth2/src/types.rs index feff1d391a9..838be4beffb 100644 --- a/common/eth2/src/types.rs +++ b/common/eth2/src/types.rs @@ -1023,7 +1023,7 @@ impl ForkVersionDeserialize for SsePayloadAttributes { fork_name: ForkName, ) -> Result { match fork_name { - ForkName::Merge => serde_json::from_value(value) + ForkName::Bellatrix => serde_json::from_value(value) .map(Self::V1) .map_err(serde::de::Error::custom), ForkName::Capella => serde_json::from_value(value) @@ -1598,7 +1598,7 @@ impl FullBlockContents { fork_name: ForkName, ) -> Result { match fork_name { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => { BeaconBlock::from_ssz_bytes_for_fork(bytes, fork_name) .map(|block| FullBlockContents::Block(block)) } @@ -1658,7 +1658,7 @@ impl ForkVersionDeserialize for FullBlockContents { fork_name: ForkName, ) -> Result { match fork_name { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => { Ok(FullBlockContents::Block( BeaconBlock::deserialize_by_fork::<'de, D>(value, fork_name)?, )) @@ -1758,7 +1758,7 @@ impl PublishBlockRequest { /// SSZ decode with fork variant determined by `fork_name`. pub fn from_ssz_bytes(bytes: &[u8], fork_name: ForkName) -> Result { match fork_name { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => { SignedBeaconBlock::from_ssz_bytes_for_fork(bytes, fork_name) .map(|block| PublishBlockRequest::Block(Arc::new(block))) } @@ -1844,7 +1844,7 @@ impl TryFrom>> for PublishBlockRequest { match *block { SignedBeaconBlock::Base(_) | SignedBeaconBlock::Altair(_) - | SignedBeaconBlock::Merge(_) + | SignedBeaconBlock::Bellatrix(_) | SignedBeaconBlock::Capella(_) => Ok(PublishBlockRequest::Block(block)), SignedBeaconBlock::Deneb(_) | SignedBeaconBlock::Electra(_) => Err( "post-Deneb block contents cannot be fully constructed from just the signed block", @@ -1953,7 +1953,7 @@ impl ForkVersionDeserialize for FullPayloadContents { fork_name: ForkName, ) -> Result { match fork_name { - ForkName::Merge | ForkName::Capella => serde_json::from_value(value) + ForkName::Bellatrix | ForkName::Capella => serde_json::from_value(value) .map(Self::Payload) .map_err(serde::de::Error::custom), ForkName::Deneb | ForkName::Electra => serde_json::from_value(value) diff --git a/common/eth2_network_config/built_in_network_configs/gnosis/config.yaml b/common/eth2_network_config/built_in_network_configs/gnosis/config.yaml index 27fb81a5139..50a5fcc3a50 100644 --- a/common/eth2_network_config/built_in_network_configs/gnosis/config.yaml +++ b/common/eth2_network_config/built_in_network_configs/gnosis/config.yaml @@ -33,7 +33,7 @@ GENESIS_DELAY: 6000 # Altair ALTAIR_FORK_VERSION: 0x01000064 ALTAIR_FORK_EPOCH: 512 -# Merge +# Bellatrix BELLATRIX_FORK_VERSION: 0x02000064 BELLATRIX_FORK_EPOCH: 385536 # Capella diff --git a/common/eth2_network_config/built_in_network_configs/holesky/config.yaml b/common/eth2_network_config/built_in_network_configs/holesky/config.yaml index bd384cfe497..6a399b957d2 100644 --- a/common/eth2_network_config/built_in_network_configs/holesky/config.yaml +++ b/common/eth2_network_config/built_in_network_configs/holesky/config.yaml @@ -22,7 +22,7 @@ GENESIS_DELAY: 300 # Altair ALTAIR_FORK_VERSION: 0x02017000 ALTAIR_FORK_EPOCH: 0 -# Merge +# Bellatrix BELLATRIX_FORK_VERSION: 0x03017000 BELLATRIX_FORK_EPOCH: 0 TERMINAL_TOTAL_DIFFICULTY: 0 diff --git a/common/eth2_network_config/built_in_network_configs/sepolia/config.yaml b/common/eth2_network_config/built_in_network_configs/sepolia/config.yaml index 2df40798c11..72a48679118 100644 --- a/common/eth2_network_config/built_in_network_configs/sepolia/config.yaml +++ b/common/eth2_network_config/built_in_network_configs/sepolia/config.yaml @@ -21,7 +21,7 @@ GENESIS_DELAY: 86400 ALTAIR_FORK_VERSION: 0x90000070 ALTAIR_FORK_EPOCH: 50 -# Merge +# Bellatrix BELLATRIX_FORK_VERSION: 0x90000071 BELLATRIX_FORK_EPOCH: 100 TERMINAL_TOTAL_DIFFICULTY: 17000000000000000 diff --git a/common/slot_clock/src/lib.rs b/common/slot_clock/src/lib.rs index 6bf74645000..4f54b2ee76b 100644 --- a/common/slot_clock/src/lib.rs +++ b/common/slot_clock/src/lib.rs @@ -11,7 +11,7 @@ pub use crate::manual_slot_clock::ManualSlotClock as TestingSlotClock; pub use crate::manual_slot_clock::ManualSlotClock; pub use crate::system_time_slot_clock::SystemTimeSlotClock; pub use metrics::scrape_for_metrics; -use types::consts::merge::INTERVALS_PER_SLOT; +use types::consts::bellatrix::INTERVALS_PER_SLOT; pub use types::Slot; /// A clock that reports the current slot. diff --git a/consensus/fork_choice/src/fork_choice.rs b/consensus/fork_choice/src/fork_choice.rs index 6e3f6717ede..2846a0112cd 100644 --- a/consensus/fork_choice/src/fork_choice.rs +++ b/consensus/fork_choice/src/fork_choice.rs @@ -13,7 +13,7 @@ use std::collections::BTreeSet; use std::marker::PhantomData; use std::time::Duration; use types::{ - consts::merge::INTERVALS_PER_SLOT, AbstractExecPayload, AttestationShufflingId, + consts::bellatrix::INTERVALS_PER_SLOT, AbstractExecPayload, AttestationShufflingId, AttesterSlashing, BeaconBlockRef, BeaconState, BeaconStateError, ChainSpec, Checkpoint, Epoch, EthSpec, ExecPayload, ExecutionBlockHash, Hash256, IndexedAttestation, RelativeEpoch, SignedBeaconBlock, Slot, @@ -751,7 +751,7 @@ where BeaconBlockRef::Electra(_) | BeaconBlockRef::Deneb(_) | BeaconBlockRef::Capella(_) - | BeaconBlockRef::Merge(_) + | BeaconBlockRef::Bellatrix(_) | BeaconBlockRef::Altair(_) => { // NOTE: Processing justification & finalization requires the progressive // balances cache, but we cannot initialize it here as we only have an diff --git a/consensus/state_processing/src/common/get_attestation_participation.rs b/consensus/state_processing/src/common/get_attestation_participation.rs index d27a00c3826..fc09dad1f4e 100644 --- a/consensus/state_processing/src/common/get_attestation_participation.rs +++ b/consensus/state_processing/src/common/get_attestation_participation.rs @@ -47,7 +47,7 @@ pub fn get_attestation_participation_flag_indices( match state { &BeaconState::Base(_) | &BeaconState::Altair(_) - | &BeaconState::Merge(_) + | &BeaconState::Bellatrix(_) | &BeaconState::Capella(_) => { if is_matching_target && inclusion_delay <= E::slots_per_epoch() { participation_flag_indices.push(TIMELY_TARGET_FLAG_INDEX); diff --git a/consensus/state_processing/src/common/slash_validator.rs b/consensus/state_processing/src/common/slash_validator.rs index 16b4e74ece9..520b58a8af3 100644 --- a/consensus/state_processing/src/common/slash_validator.rs +++ b/consensus/state_processing/src/common/slash_validator.rs @@ -58,7 +58,7 @@ pub fn slash_validator( let proposer_reward = match state { BeaconState::Base(_) => whistleblower_reward.safe_div(spec.proposer_reward_quotient)?, BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => whistleblower_reward diff --git a/consensus/state_processing/src/genesis.rs b/consensus/state_processing/src/genesis.rs index 036ab23498c..d20213a9296 100644 --- a/consensus/state_processing/src/genesis.rs +++ b/consensus/state_processing/src/genesis.rs @@ -63,7 +63,7 @@ pub fn initialize_beacon_state_from_eth1( .bellatrix_fork_epoch .map_or(false, |fork_epoch| fork_epoch == E::genesis_epoch()) { - // this will set state.latest_execution_payload_header = ExecutionPayloadHeaderMerge::default() + // this will set state.latest_execution_payload_header = ExecutionPayloadHeaderBellatrix::default() upgrade_to_bellatrix(&mut state, spec)?; // Remove intermediate Altair fork from `state.fork`. @@ -71,8 +71,8 @@ pub fn initialize_beacon_state_from_eth1( // Override latest execution payload header. // See https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/bellatrix/beacon-chain.md#testing - if let Some(ExecutionPayloadHeader::Merge(ref header)) = execution_payload_header { - *state.latest_execution_payload_header_merge_mut()? = header.clone(); + if let Some(ExecutionPayloadHeader::Bellatrix(ref header)) = execution_payload_header { + *state.latest_execution_payload_header_bellatrix_mut()? = header.clone(); } } diff --git a/consensus/state_processing/src/per_block_processing.rs b/consensus/state_processing/src/per_block_processing.rs index b370ec6216b..6bf7c6cc892 100644 --- a/consensus/state_processing/src/per_block_processing.rs +++ b/consensus/state_processing/src/per_block_processing.rs @@ -422,9 +422,9 @@ pub fn process_execution_payload>( partially_verify_execution_payload::(state, state.slot(), body, spec)?; let payload = body.execution_payload()?; match state.latest_execution_payload_header_mut()? { - ExecutionPayloadHeaderRefMut::Merge(header_mut) => { + ExecutionPayloadHeaderRefMut::Bellatrix(header_mut) => { match payload.to_execution_payload_header() { - ExecutionPayloadHeader::Merge(header) => *header_mut = header, + ExecutionPayloadHeader::Bellatrix(header) => *header_mut = header, _ => return Err(BlockProcessingError::IncorrectStateType), } } @@ -453,14 +453,14 @@ pub fn process_execution_payload>( /// These functions will definitely be called before the merge. Their entire purpose is to check if /// the merge has happened or if we're on the transition block. Thus we don't want to propagate -/// errors from the `BeaconState` being an earlier variant than `BeaconStateMerge` as we'd have to +/// errors from the `BeaconState` being an earlier variant than `BeaconStateBellatrix` as we'd have to /// repeatedly write code to treat these errors as false. /// https://github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/beacon-chain.md#is_merge_transition_complete pub fn is_merge_transition_complete(state: &BeaconState) -> bool { match state { // We must check defaultness against the payload header with 0x0 roots, as that's what's meant // by `ExecutionPayloadHeader()` in the spec. - BeaconState::Merge(_) => state + BeaconState::Bellatrix(_) => state .latest_execution_payload_header() .map(|header| !header.is_default_with_zero_roots()) .unwrap_or(false), @@ -561,7 +561,7 @@ pub fn process_withdrawals>( spec: &ChainSpec, ) -> Result<(), BlockProcessingError> { match state { - BeaconState::Merge(_) => Ok(()), + BeaconState::Bellatrix(_) => Ok(()), BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => { let expected_withdrawals = get_expected_withdrawals(state, spec)?; let expected_root = expected_withdrawals.tree_hash_root(); diff --git a/consensus/state_processing/src/per_block_processing/process_operations.rs b/consensus/state_processing/src/per_block_processing/process_operations.rs index 63b7c9e01fb..398a84eacb0 100644 --- a/consensus/state_processing/src/per_block_processing/process_operations.rs +++ b/consensus/state_processing/src/per_block_processing/process_operations.rs @@ -272,7 +272,7 @@ pub fn process_attestations>( )?; } BeaconBlockBodyRef::Altair(_) - | BeaconBlockBodyRef::Merge(_) + | BeaconBlockBodyRef::Bellatrix(_) | BeaconBlockBodyRef::Capella(_) | BeaconBlockBodyRef::Deneb(_) | BeaconBlockBodyRef::Electra(_) => { diff --git a/consensus/state_processing/src/per_block_processing/signature_sets.rs b/consensus/state_processing/src/per_block_processing/signature_sets.rs index 163b2cff7a9..9468893f762 100644 --- a/consensus/state_processing/src/per_block_processing/signature_sets.rs +++ b/consensus/state_processing/src/per_block_processing/signature_sets.rs @@ -390,7 +390,7 @@ where let domain = match state { BeaconState::Base(_) | BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) => spec.get_domain( exit.epoch, Domain::VoluntaryExit, diff --git a/consensus/state_processing/src/per_block_processing/verify_attestation.rs b/consensus/state_processing/src/per_block_processing/verify_attestation.rs index 73454559dfd..c904ba55f0a 100644 --- a/consensus/state_processing/src/per_block_processing/verify_attestation.rs +++ b/consensus/state_processing/src/per_block_processing/verify_attestation.rs @@ -35,7 +35,7 @@ pub fn verify_attestation_for_block_inclusion<'ctxt, E: EthSpec>( match state { BeaconState::Base(_) | BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) => { verify!( state.slot() <= data.slot.safe_add(E::slots_per_epoch())?, diff --git a/consensus/state_processing/src/per_epoch_processing.rs b/consensus/state_processing/src/per_epoch_processing.rs index b51aa23f370..55e8853f3f8 100644 --- a/consensus/state_processing/src/per_epoch_processing.rs +++ b/consensus/state_processing/src/per_epoch_processing.rs @@ -44,7 +44,7 @@ pub fn process_epoch( match state { BeaconState::Base(_) => base::process_epoch(state, spec), BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => altair::process_epoch(state, spec), diff --git a/consensus/state_processing/src/per_slot_processing.rs b/consensus/state_processing/src/per_slot_processing.rs index cc28340962a..6554423199f 100644 --- a/consensus/state_processing/src/per_slot_processing.rs +++ b/consensus/state_processing/src/per_slot_processing.rs @@ -54,7 +54,7 @@ pub fn per_slot_processing( if spec.altair_fork_epoch == Some(state.current_epoch()) { upgrade_to_altair(state, spec)?; } - // If the Merge fork epoch is reached, perform an irregular state upgrade. + // If the Bellatrix fork epoch is reached, perform an irregular state upgrade. if spec.bellatrix_fork_epoch == Some(state.current_epoch()) { upgrade_to_bellatrix(state, spec)?; } diff --git a/consensus/state_processing/src/upgrade.rs b/consensus/state_processing/src/upgrade.rs index 98602c66ba3..93cafa73d03 100644 --- a/consensus/state_processing/src/upgrade.rs +++ b/consensus/state_processing/src/upgrade.rs @@ -1,11 +1,11 @@ pub mod altair; +pub mod bellatrix; pub mod capella; pub mod deneb; pub mod electra; -pub mod merge; pub use altair::upgrade_to_altair; +pub use bellatrix::upgrade_to_bellatrix; pub use capella::upgrade_to_capella; pub use deneb::upgrade_to_deneb; pub use electra::upgrade_to_electra; -pub use merge::upgrade_to_bellatrix; diff --git a/consensus/state_processing/src/upgrade/merge.rs b/consensus/state_processing/src/upgrade/bellatrix.rs similarity index 90% rename from consensus/state_processing/src/upgrade/merge.rs rename to consensus/state_processing/src/upgrade/bellatrix.rs index 147c97ac29e..047b56d1e0b 100644 --- a/consensus/state_processing/src/upgrade/merge.rs +++ b/consensus/state_processing/src/upgrade/bellatrix.rs @@ -1,10 +1,10 @@ use std::mem; use types::{ - BeaconState, BeaconStateError as Error, BeaconStateMerge, ChainSpec, EpochCache, EthSpec, - ExecutionPayloadHeaderMerge, Fork, + BeaconState, BeaconStateBellatrix, BeaconStateError as Error, ChainSpec, EpochCache, EthSpec, + ExecutionPayloadHeaderBellatrix, Fork, }; -/// Transform a `Altair` state into an `Merge` state. +/// Transform a `Altair` state into an `Bellatrix` state. pub fn upgrade_to_bellatrix( pre_state: &mut BeaconState, spec: &ChainSpec, @@ -17,7 +17,7 @@ pub fn upgrade_to_bellatrix( // // Fixed size vectors get cloned because replacing them would require the same size // allocation as cloning. - let post = BeaconState::Merge(BeaconStateMerge { + let post = BeaconState::Bellatrix(BeaconStateBellatrix { // Versioning genesis_time: pre.genesis_time, genesis_validators_root: pre.genesis_validators_root, @@ -57,7 +57,7 @@ pub fn upgrade_to_bellatrix( current_sync_committee: pre.current_sync_committee.clone(), next_sync_committee: pre.next_sync_committee.clone(), // Execution - latest_execution_payload_header: >::default(), + latest_execution_payload_header: >::default(), // Caches total_active_balance: pre.total_active_balance, progressive_balances_cache: mem::take(&mut pre.progressive_balances_cache), diff --git a/consensus/state_processing/src/upgrade/capella.rs b/consensus/state_processing/src/upgrade/capella.rs index 87b40abebdd..0cb46fbf56b 100644 --- a/consensus/state_processing/src/upgrade/capella.rs +++ b/consensus/state_processing/src/upgrade/capella.rs @@ -4,13 +4,13 @@ use types::{ Fork, VariableList, }; -/// Transform a `Merge` state into an `Capella` state. +/// Transform a `Bellatrix` state into an `Capella` state. pub fn upgrade_to_capella( pre_state: &mut BeaconState, spec: &ChainSpec, ) -> Result<(), Error> { let epoch = pre_state.current_epoch(); - let pre = pre_state.as_merge_mut()?; + let pre = pre_state.as_bellatrix_mut()?; // Where possible, use something like `mem::take` to move fields from behind the &mut // reference. For other fields that don't have a good default value, use `clone`. diff --git a/consensus/types/src/beacon_block.rs b/consensus/types/src/beacon_block.rs index 14874f0204f..5af53b3fa17 100644 --- a/consensus/types/src/beacon_block.rs +++ b/consensus/types/src/beacon_block.rs @@ -12,7 +12,7 @@ use tree_hash_derive::TreeHash; /// A block of the `BeaconChain`. #[superstruct( - variants(Base, Altair, Merge, Capella, Deneb, Electra), + variants(Base, Altair, Bellatrix, Capella, Deneb, Electra), variant_attributes( derive( Debug, @@ -63,8 +63,8 @@ pub struct BeaconBlock = FullPayload pub body: BeaconBlockBodyBase, #[superstruct(only(Altair), partial_getter(rename = "body_altair"))] pub body: BeaconBlockBodyAltair, - #[superstruct(only(Merge), partial_getter(rename = "body_merge"))] - pub body: BeaconBlockBodyMerge, + #[superstruct(only(Bellatrix), partial_getter(rename = "body_bellatrix"))] + pub body: BeaconBlockBodyBellatrix, #[superstruct(only(Capella), partial_getter(rename = "body_capella"))] pub body: BeaconBlockBodyCapella, #[superstruct(only(Deneb), partial_getter(rename = "body_deneb"))] @@ -130,7 +130,7 @@ impl> BeaconBlock { .map(BeaconBlock::Electra) .or_else(|_| BeaconBlockDeneb::from_ssz_bytes(bytes).map(BeaconBlock::Deneb)) .or_else(|_| BeaconBlockCapella::from_ssz_bytes(bytes).map(BeaconBlock::Capella)) - .or_else(|_| BeaconBlockMerge::from_ssz_bytes(bytes).map(BeaconBlock::Merge)) + .or_else(|_| BeaconBlockBellatrix::from_ssz_bytes(bytes).map(BeaconBlock::Bellatrix)) .or_else(|_| BeaconBlockAltair::from_ssz_bytes(bytes).map(BeaconBlock::Altair)) .or_else(|_| BeaconBlockBase::from_ssz_bytes(bytes).map(BeaconBlock::Base)) } @@ -221,7 +221,7 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload> BeaconBlockRef<'a, E, Payl match self { BeaconBlockRef::Base { .. } => ForkName::Base, BeaconBlockRef::Altair { .. } => ForkName::Altair, - BeaconBlockRef::Merge { .. } => ForkName::Merge, + BeaconBlockRef::Bellatrix { .. } => ForkName::Bellatrix, BeaconBlockRef::Capella { .. } => ForkName::Capella, BeaconBlockRef::Deneb { .. } => ForkName::Deneb, BeaconBlockRef::Electra { .. } => ForkName::Electra, @@ -466,15 +466,15 @@ impl> BeaconBlockAltair } } -impl> EmptyBlock for BeaconBlockMerge { - /// Returns an empty Merge block to be used during genesis. +impl> EmptyBlock for BeaconBlockBellatrix { + /// Returns an empty Bellatrix block to be used during genesis. fn empty(spec: &ChainSpec) -> Self { - BeaconBlockMerge { + BeaconBlockBellatrix { slot: spec.genesis_slot, proposer_index: 0, parent_root: Hash256::zero(), state_root: Hash256::zero(), - body: BeaconBlockBodyMerge { + body: BeaconBlockBodyBellatrix { randao_reveal: Signature::empty(), eth1_data: Eth1Data { deposit_root: Hash256::zero(), @@ -488,7 +488,7 @@ impl> EmptyBlock for BeaconBlockMerg deposits: VariableList::empty(), voluntary_exits: VariableList::empty(), sync_aggregate: SyncAggregate::empty(), - execution_payload: Payload::Merge::default(), + execution_payload: Payload::Bellatrix::default(), }, } } @@ -753,7 +753,7 @@ macro_rules! impl_from { impl_from!(BeaconBlockBase, >, >, |body: BeaconBlockBodyBase<_, _>| body.into()); impl_from!(BeaconBlockAltair, >, >, |body: BeaconBlockBodyAltair<_, _>| body.into()); -impl_from!(BeaconBlockMerge, >, >, |body: BeaconBlockBodyMerge<_, _>| body.into()); +impl_from!(BeaconBlockBellatrix, >, >, |body: BeaconBlockBodyBellatrix<_, _>| body.into()); impl_from!(BeaconBlockCapella, >, >, |body: BeaconBlockBodyCapella<_, _>| body.into()); impl_from!(BeaconBlockDeneb, >, >, |body: BeaconBlockBodyDeneb<_, _>| body.into()); impl_from!(BeaconBlockElectra, >, >, |body: BeaconBlockBodyElectra<_, _>| body.into()); @@ -786,7 +786,7 @@ macro_rules! impl_clone_as_blinded { impl_clone_as_blinded!(BeaconBlockBase, >, >); impl_clone_as_blinded!(BeaconBlockAltair, >, >); -impl_clone_as_blinded!(BeaconBlockMerge, >, >); +impl_clone_as_blinded!(BeaconBlockBellatrix, >, >); impl_clone_as_blinded!(BeaconBlockCapella, >, >); impl_clone_as_blinded!(BeaconBlockDeneb, >, >); impl_clone_as_blinded!(BeaconBlockElectra, >, >); diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index a55c16b80d5..c3077c4ab68 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -29,7 +29,7 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11; /// /// This *superstruct* abstracts over the hard-fork. #[superstruct( - variants(Base, Altair, Merge, Capella, Deneb, Electra), + variants(Base, Altair, Bellatrix, Capella, Deneb, Electra), variant_attributes( derive( Debug, @@ -67,14 +67,17 @@ pub struct BeaconBlockBody = FullPay pub attestations: VariableList, E::MaxAttestations>, pub deposits: VariableList, pub voluntary_exits: VariableList, - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub sync_aggregate: SyncAggregate, // We flatten the execution payload so that serde can use the name of the inner type, // either `execution_payload` for full payloads, or `execution_payload_header` for blinded // payloads. - #[superstruct(only(Merge), partial_getter(rename = "execution_payload_merge"))] + #[superstruct( + only(Bellatrix), + partial_getter(rename = "execution_payload_bellatrix") + )] #[serde(flatten)] - pub execution_payload: Payload::Merge, + pub execution_payload: Payload::Bellatrix, #[superstruct(only(Capella), partial_getter(rename = "execution_payload_capella"))] #[serde(flatten)] pub execution_payload: Payload::Capella, @@ -107,7 +110,7 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload> BeaconBlockBodyRef<'a, E, pub fn execution_payload(&self) -> Result, Error> { match self { Self::Base(_) | Self::Altair(_) => Err(Error::IncorrectStateVariant), - Self::Merge(body) => Ok(Payload::Ref::from(&body.execution_payload)), + Self::Bellatrix(body) => Ok(Payload::Ref::from(&body.execution_payload)), Self::Capella(body) => Ok(Payload::Ref::from(&body.execution_payload)), Self::Deneb(body) => Ok(Payload::Ref::from(&body.execution_payload)), Self::Electra(body) => Ok(Payload::Ref::from(&body.execution_payload)), @@ -121,7 +124,7 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload> BeaconBlockBodyRef<'a, E, index: usize, ) -> Result, Error> { match self { - Self::Base(_) | Self::Altair(_) | Self::Merge(_) | Self::Capella(_) => { + Self::Base(_) | Self::Altair(_) | Self::Bellatrix(_) | Self::Capella(_) => { Err(Error::IncorrectStateVariant) } Self::Deneb(body) => { @@ -261,7 +264,7 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload> BeaconBlockBodyRef<'a, E, match self { BeaconBlockBodyRef::Base { .. } => ForkName::Base, BeaconBlockBodyRef::Altair { .. } => ForkName::Altair, - BeaconBlockBodyRef::Merge { .. } => ForkName::Merge, + BeaconBlockBodyRef::Bellatrix { .. } => ForkName::Bellatrix, BeaconBlockBodyRef::Capella { .. } => ForkName::Capella, BeaconBlockBodyRef::Deneb { .. } => ForkName::Deneb, BeaconBlockBodyRef::Electra { .. } => ForkName::Electra, @@ -407,14 +410,14 @@ impl From>> } } -impl From>> +impl From>> for ( - BeaconBlockBodyMerge>, - Option>, + BeaconBlockBodyBellatrix>, + Option>, ) { - fn from(body: BeaconBlockBodyMerge>) -> Self { - let BeaconBlockBodyMerge { + fn from(body: BeaconBlockBodyBellatrix>) -> Self { + let BeaconBlockBodyBellatrix { randao_reveal, eth1_data, graffiti, @@ -424,11 +427,11 @@ impl From>> deposits, voluntary_exits, sync_aggregate, - execution_payload: FullPayloadMerge { execution_payload }, + execution_payload: FullPayloadBellatrix { execution_payload }, } = body; ( - BeaconBlockBodyMerge { + BeaconBlockBodyBellatrix { randao_reveal, eth1_data, graffiti, @@ -438,7 +441,7 @@ impl From>> deposits, voluntary_exits, sync_aggregate, - execution_payload: BlindedPayloadMerge { + execution_payload: BlindedPayloadBellatrix { execution_payload_header: From::from(&execution_payload), }, }, @@ -592,9 +595,9 @@ impl BeaconBlockBodyAltair> { } } -impl BeaconBlockBodyMerge> { - pub fn clone_as_blinded(&self) -> BeaconBlockBodyMerge> { - let BeaconBlockBodyMerge { +impl BeaconBlockBodyBellatrix> { + pub fn clone_as_blinded(&self) -> BeaconBlockBodyBellatrix> { + let BeaconBlockBodyBellatrix { randao_reveal, eth1_data, graffiti, @@ -604,10 +607,10 @@ impl BeaconBlockBodyMerge> { deposits, voluntary_exits, sync_aggregate, - execution_payload: FullPayloadMerge { execution_payload }, + execution_payload: FullPayloadBellatrix { execution_payload }, } = self; - BeaconBlockBodyMerge { + BeaconBlockBodyBellatrix { randao_reveal: randao_reveal.clone(), eth1_data: eth1_data.clone(), graffiti: *graffiti, @@ -617,7 +620,7 @@ impl BeaconBlockBodyMerge> { deposits: deposits.clone(), voluntary_exits: voluntary_exits.clone(), sync_aggregate: sync_aggregate.clone(), - execution_payload: BlindedPayloadMerge { + execution_payload: BlindedPayloadBellatrix { execution_payload_header: execution_payload.into(), }, } diff --git a/consensus/types/src/beacon_state.rs b/consensus/types/src/beacon_state.rs index 02572b0efbd..9a89ff23c3f 100644 --- a/consensus/types/src/beacon_state.rs +++ b/consensus/types/src/beacon_state.rs @@ -194,7 +194,7 @@ impl From for Hash256 { /// The state of the `BeaconChain` at some slot. #[superstruct( - variants(Base, Altair, Merge, Capella, Deneb, Electra), + variants(Base, Altair, Bellatrix, Capella, Deneb, Electra), variant_attributes( derive( Derivative, @@ -274,9 +274,9 @@ where pub current_epoch_attestations: VariableList, E::MaxPendingAttestations>, // Participation (Altair and later) - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub previous_epoch_participation: VariableList, - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub current_epoch_participation: VariableList, // Finality @@ -291,21 +291,21 @@ where // Inactivity #[serde(with = "ssz_types::serde_utils::quoted_u64_var_list")] - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub inactivity_scores: VariableList, // Light-client sync committees - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub current_sync_committee: Arc>, - #[superstruct(only(Altair, Merge, Capella, Deneb, Electra))] + #[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))] pub next_sync_committee: Arc>, // Execution #[superstruct( - only(Merge), - partial_getter(rename = "latest_execution_payload_header_merge") + only(Bellatrix), + partial_getter(rename = "latest_execution_payload_header_bellatrix") )] - pub latest_execution_payload_header: ExecutionPayloadHeaderMerge, + pub latest_execution_payload_header: ExecutionPayloadHeaderBellatrix, #[superstruct( only(Capella), partial_getter(rename = "latest_execution_payload_header_capella") @@ -478,7 +478,7 @@ impl BeaconState { match self { BeaconState::Base { .. } => ForkName::Base, BeaconState::Altair { .. } => ForkName::Altair, - BeaconState::Merge { .. } => ForkName::Merge, + BeaconState::Bellatrix { .. } => ForkName::Bellatrix, BeaconState::Capella { .. } => ForkName::Capella, BeaconState::Deneb { .. } => ForkName::Deneb, BeaconState::Electra { .. } => ForkName::Electra, @@ -781,7 +781,7 @@ impl BeaconState { pub fn latest_execution_payload_header(&self) -> Result, Error> { match self { BeaconState::Base(_) | BeaconState::Altair(_) => Err(Error::IncorrectStateVariant), - BeaconState::Merge(state) => Ok(ExecutionPayloadHeaderRef::Merge( + BeaconState::Bellatrix(state) => Ok(ExecutionPayloadHeaderRef::Bellatrix( &state.latest_execution_payload_header, )), BeaconState::Capella(state) => Ok(ExecutionPayloadHeaderRef::Capella( @@ -801,7 +801,7 @@ impl BeaconState { ) -> Result, Error> { match self { BeaconState::Base(_) | BeaconState::Altair(_) => Err(Error::IncorrectStateVariant), - BeaconState::Merge(state) => Ok(ExecutionPayloadHeaderRefMut::Merge( + BeaconState::Bellatrix(state) => Ok(ExecutionPayloadHeaderRefMut::Bellatrix( &mut state.latest_execution_payload_header, )), BeaconState::Capella(state) => Ok(ExecutionPayloadHeaderRefMut::Capella( @@ -1255,7 +1255,7 @@ impl BeaconState { &mut state.balances, &mut state.progressive_balances_cache, ), - BeaconState::Merge(state) => ( + BeaconState::Bellatrix(state) => ( &mut state.validators, &mut state.balances, &mut state.progressive_balances_cache, @@ -1306,7 +1306,7 @@ impl BeaconState { &mut state.exit_cache, &mut state.epoch_cache, )), - BeaconState::Merge(state) => Ok(( + BeaconState::Bellatrix(state) => Ok(( &mut state.validators, &mut state.balances, &state.previous_epoch_participation, @@ -1461,7 +1461,7 @@ impl BeaconState { Ok(match self { BeaconState::Base(_) | BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) => self.get_validator_churn_limit(spec)?, BeaconState::Deneb(_) | BeaconState::Electra(_) => std::cmp::min( spec.max_per_epoch_activation_churn_limit, @@ -1580,7 +1580,7 @@ impl BeaconState { match self { BeaconState::Base(_) => Err(BeaconStateError::IncorrectStateVariant), BeaconState::Altair(state) => Ok(&mut state.current_epoch_participation), - BeaconState::Merge(state) => Ok(&mut state.current_epoch_participation), + BeaconState::Bellatrix(state) => Ok(&mut state.current_epoch_participation), BeaconState::Capella(state) => Ok(&mut state.current_epoch_participation), BeaconState::Deneb(state) => Ok(&mut state.current_epoch_participation), BeaconState::Electra(state) => Ok(&mut state.current_epoch_participation), @@ -1589,7 +1589,7 @@ impl BeaconState { match self { BeaconState::Base(_) => Err(BeaconStateError::IncorrectStateVariant), BeaconState::Altair(state) => Ok(&mut state.previous_epoch_participation), - BeaconState::Merge(state) => Ok(&mut state.previous_epoch_participation), + BeaconState::Bellatrix(state) => Ok(&mut state.previous_epoch_participation), BeaconState::Capella(state) => Ok(&mut state.previous_epoch_participation), BeaconState::Deneb(state) => Ok(&mut state.previous_epoch_participation), BeaconState::Electra(state) => Ok(&mut state.previous_epoch_participation), @@ -1894,7 +1894,7 @@ impl BeaconState { let mut res = match self { BeaconState::Base(inner) => BeaconState::Base(inner.clone()), BeaconState::Altair(inner) => BeaconState::Altair(inner.clone()), - BeaconState::Merge(inner) => BeaconState::Merge(inner.clone()), + BeaconState::Bellatrix(inner) => BeaconState::Bellatrix(inner.clone()), BeaconState::Capella(inner) => BeaconState::Capella(inner.clone()), BeaconState::Deneb(inner) => BeaconState::Deneb(inner.clone()), BeaconState::Electra(inner) => BeaconState::Electra(inner.clone()), @@ -2084,7 +2084,7 @@ impl CompareFields for BeaconState { match (self, other) { (BeaconState::Base(x), BeaconState::Base(y)) => x.compare_fields(y), (BeaconState::Altair(x), BeaconState::Altair(y)) => x.compare_fields(y), - (BeaconState::Merge(x), BeaconState::Merge(y)) => x.compare_fields(y), + (BeaconState::Bellatrix(x), BeaconState::Bellatrix(y)) => x.compare_fields(y), (BeaconState::Capella(x), BeaconState::Capella(y)) => x.compare_fields(y), (BeaconState::Deneb(x), BeaconState::Deneb(y)) => x.compare_fields(y), (BeaconState::Electra(x), BeaconState::Electra(y)) => x.compare_fields(y), diff --git a/consensus/types/src/beacon_state/progressive_balances_cache.rs b/consensus/types/src/beacon_state/progressive_balances_cache.rs index 523c94cf57e..fd5e51313f7 100644 --- a/consensus/types/src/beacon_state/progressive_balances_cache.rs +++ b/consensus/types/src/beacon_state/progressive_balances_cache.rs @@ -288,7 +288,7 @@ pub fn is_progressive_balances_enabled(state: &BeaconState) -> bo match state { BeaconState::Base(_) => false, BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => true, diff --git a/consensus/types/src/beacon_state/tree_hash_cache.rs b/consensus/types/src/beacon_state/tree_hash_cache.rs index 290020b1b35..0f88e14e2b2 100644 --- a/consensus/types/src/beacon_state/tree_hash_cache.rs +++ b/consensus/types/src/beacon_state/tree_hash_cache.rs @@ -298,7 +298,7 @@ impl BeaconTreeHashCacheInner { leaves.push(next_sync_committee.tree_hash_root()); } - // Execution payload (merge and later). + // Execution payload (Bellatrix and later). if let Ok(payload_header) = state.latest_execution_payload_header() { leaves.push(payload_header.tree_hash_root()); } diff --git a/consensus/types/src/builder_bid.rs b/consensus/types/src/builder_bid.rs index 121d3f84277..9885f78474f 100644 --- a/consensus/types/src/builder_bid.rs +++ b/consensus/types/src/builder_bid.rs @@ -1,7 +1,7 @@ use crate::beacon_block_body::KzgCommitments; use crate::{ - ChainSpec, EthSpec, ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, - ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderMerge, ExecutionPayloadHeaderRef, + ChainSpec, EthSpec, ExecutionPayloadHeaderBellatrix, ExecutionPayloadHeaderCapella, + ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderRef, ExecutionPayloadHeaderRefMut, ForkName, ForkVersionDeserialize, SignedRoot, Uint256, }; use bls::PublicKeyBytes; @@ -11,7 +11,7 @@ use superstruct::superstruct; use tree_hash_derive::TreeHash; #[superstruct( - variants(Merge, Capella, Deneb, Electra), + variants(Bellatrix, Capella, Deneb, Electra), variant_attributes( derive(PartialEq, Debug, Serialize, Deserialize, TreeHash, Clone), serde(bound = "E: EthSpec", deny_unknown_fields) @@ -23,8 +23,8 @@ use tree_hash_derive::TreeHash; #[serde(bound = "E: EthSpec", deny_unknown_fields, untagged)] #[tree_hash(enum_behaviour = "transparent")] pub struct BuilderBid { - #[superstruct(only(Merge), partial_getter(rename = "header_merge"))] - pub header: ExecutionPayloadHeaderMerge, + #[superstruct(only(Bellatrix), partial_getter(rename = "header_bellatrix"))] + pub header: ExecutionPayloadHeaderBellatrix, #[superstruct(only(Capella), partial_getter(rename = "header_capella"))] pub header: ExecutionPayloadHeaderCapella, #[superstruct(only(Deneb), partial_getter(rename = "header_deneb"))] @@ -79,7 +79,9 @@ impl ForkVersionDeserialize for BuilderBid { |e| serde::de::Error::custom(format!("BuilderBid failed to deserialize: {:?}", e)); Ok(match fork_name { - ForkName::Merge => Self::Merge(serde_json::from_value(value).map_err(convert_err)?), + ForkName::Bellatrix => { + Self::Bellatrix(serde_json::from_value(value).map_err(convert_err)?) + } ForkName::Capella => Self::Capella(serde_json::from_value(value).map_err(convert_err)?), ForkName::Deneb => Self::Deneb(serde_json::from_value(value).map_err(convert_err)?), ForkName::Electra => Self::Electra(serde_json::from_value(value).map_err(convert_err)?), diff --git a/consensus/types/src/chain_spec.rs b/consensus/types/src/chain_spec.rs index e9345ab14ea..31a0f463dd8 100644 --- a/consensus/types/src/chain_spec.rs +++ b/consensus/types/src/chain_spec.rs @@ -144,13 +144,13 @@ pub struct ChainSpec { pub altair_fork_epoch: Option, /* - * Merge hard fork params + * Bellatrix hard fork params */ pub inactivity_penalty_quotient_bellatrix: u64, pub min_slashing_penalty_quotient_bellatrix: u64, pub proportional_slashing_multiplier_bellatrix: u64, pub bellatrix_fork_version: [u8; 4], - /// The Merge fork epoch is optional, with `None` representing "Merge never happens". + /// The Bellatrix fork epoch is optional, with `None` representing "Bellatrix never happens". pub bellatrix_fork_epoch: Option, pub terminal_total_difficulty: Uint256, pub terminal_block_hash: ExecutionBlockHash, @@ -298,7 +298,7 @@ impl ChainSpec { _ => match self.capella_fork_epoch { Some(fork_epoch) if epoch >= fork_epoch => ForkName::Capella, _ => match self.bellatrix_fork_epoch { - Some(fork_epoch) if epoch >= fork_epoch => ForkName::Merge, + Some(fork_epoch) if epoch >= fork_epoch => ForkName::Bellatrix, _ => match self.altair_fork_epoch { Some(fork_epoch) if epoch >= fork_epoch => ForkName::Altair, _ => ForkName::Base, @@ -314,7 +314,7 @@ impl ChainSpec { match fork_name { ForkName::Base => self.genesis_fork_version, ForkName::Altair => self.altair_fork_version, - ForkName::Merge => self.bellatrix_fork_version, + ForkName::Bellatrix => self.bellatrix_fork_version, ForkName::Capella => self.capella_fork_version, ForkName::Deneb => self.deneb_fork_version, ForkName::Electra => self.electra_fork_version, @@ -326,7 +326,7 @@ impl ChainSpec { match fork_name { ForkName::Base => Some(Epoch::new(0)), ForkName::Altair => self.altair_fork_epoch, - ForkName::Merge => self.bellatrix_fork_epoch, + ForkName::Bellatrix => self.bellatrix_fork_epoch, ForkName::Capella => self.capella_fork_epoch, ForkName::Deneb => self.deneb_fork_epoch, ForkName::Electra => self.electra_fork_epoch, @@ -334,7 +334,7 @@ impl ChainSpec { } pub fn inactivity_penalty_quotient_for_fork(&self, fork_name: ForkName) -> u64 { - if fork_name >= ForkName::Merge { + if fork_name >= ForkName::Bellatrix { self.inactivity_penalty_quotient_bellatrix } else if fork_name >= ForkName::Altair { self.inactivity_penalty_quotient_altair @@ -349,7 +349,7 @@ impl ChainSpec { state: &BeaconState, ) -> u64 { let fork_name = state.fork_name_unchecked(); - if fork_name >= ForkName::Merge { + if fork_name >= ForkName::Bellatrix { self.proportional_slashing_multiplier_bellatrix } else if fork_name >= ForkName::Altair { self.proportional_slashing_multiplier_altair @@ -364,7 +364,7 @@ impl ChainSpec { state: &BeaconState, ) -> u64 { let fork_name = state.fork_name_unchecked(); - if fork_name >= ForkName::Merge { + if fork_name >= ForkName::Bellatrix { self.min_slashing_penalty_quotient_bellatrix } else if fork_name >= ForkName::Altair { self.min_slashing_penalty_quotient_altair @@ -676,7 +676,7 @@ impl ChainSpec { altair_fork_epoch: Some(Epoch::new(74240)), /* - * Merge hard fork params + * Bellatrix hard fork params */ inactivity_penalty_quotient_bellatrix: u64::checked_pow(2, 24) .expect("pow does not overflow"), @@ -789,7 +789,7 @@ impl ChainSpec { epochs_per_sync_committee_period: Epoch::new(8), altair_fork_version: [0x01, 0x00, 0x00, 0x01], altair_fork_epoch: None, - // Merge + // Bellatrix bellatrix_fork_version: [0x02, 0x00, 0x00, 0x01], bellatrix_fork_epoch: None, terminal_total_difficulty: Uint256::MAX @@ -948,7 +948,7 @@ impl ChainSpec { altair_fork_epoch: Some(Epoch::new(512)), /* - * Merge hard fork params + * Bellatrix hard fork params */ inactivity_penalty_quotient_bellatrix: u64::checked_pow(2, 24) .expect("pow does not overflow"), diff --git a/consensus/types/src/consts.rs b/consensus/types/src/consts.rs index a9377bc3e00..52ddc5deeb1 100644 --- a/consensus/types/src/consts.rs +++ b/consensus/types/src/consts.rs @@ -19,6 +19,6 @@ pub mod altair { pub const NUM_FLAG_INDICES: usize = 3; } -pub mod merge { +pub mod bellatrix { pub const INTERVALS_PER_SLOT: u64 = 3; } diff --git a/consensus/types/src/eth_spec.rs b/consensus/types/src/eth_spec.rs index a2972b722a2..2a63a3f1400 100644 --- a/consensus/types/src/eth_spec.rs +++ b/consensus/types/src/eth_spec.rs @@ -90,7 +90,7 @@ pub trait EthSpec: /// The number of `sync_committee` subnets. type SyncCommitteeSubnetCount: Unsigned + Clone + Sync + Send + Debug + PartialEq; /* - * New in Merge + * New in Bellatrix */ type MaxBytesPerTransaction: Unsigned + Clone + Sync + Send + Debug + PartialEq; type MaxTransactionsPerPayload: Unsigned + Clone + Sync + Send + Debug + PartialEq; diff --git a/consensus/types/src/execution_payload.rs b/consensus/types/src/execution_payload.rs index 27dc8cab0a4..a46e7c29fff 100644 --- a/consensus/types/src/execution_payload.rs +++ b/consensus/types/src/execution_payload.rs @@ -15,7 +15,7 @@ pub type Transactions = VariableList< pub type Withdrawals = VariableList::MaxWithdrawalsPerPayload>; #[superstruct( - variants(Merge, Capella, Deneb, Electra), + variants(Bellatrix, Capella, Deneb, Electra), variant_attributes( derive( Default, @@ -107,7 +107,9 @@ impl ExecutionPayload { ForkName::Base | ForkName::Altair => Err(ssz::DecodeError::BytesInvalid(format!( "unsupported fork for ExecutionPayload: {fork_name}", ))), - ForkName::Merge => ExecutionPayloadMerge::from_ssz_bytes(bytes).map(Self::Merge), + ForkName::Bellatrix => { + ExecutionPayloadBellatrix::from_ssz_bytes(bytes).map(Self::Bellatrix) + } ForkName::Capella => ExecutionPayloadCapella::from_ssz_bytes(bytes).map(Self::Capella), ForkName::Deneb => ExecutionPayloadDeneb::from_ssz_bytes(bytes).map(Self::Deneb), ForkName::Electra => ExecutionPayloadElectra::from_ssz_bytes(bytes).map(Self::Electra), @@ -116,9 +118,9 @@ impl ExecutionPayload { #[allow(clippy::arithmetic_side_effects)] /// Returns the maximum size of an execution payload. - pub fn max_execution_payload_merge_size() -> usize { + pub fn max_execution_payload_bellatrix_size() -> usize { // Fixed part - ExecutionPayloadMerge::::default().as_ssz_bytes().len() + ExecutionPayloadBellatrix::::default().as_ssz_bytes().len() // Max size of variable length `extra_data` field + (E::max_extra_data_bytes() * ::ssz_fixed_len()) // Max size of variable length `transactions` field @@ -175,7 +177,9 @@ impl ForkVersionDeserialize for ExecutionPayload { }; Ok(match fork_name { - ForkName::Merge => Self::Merge(serde_json::from_value(value).map_err(convert_err)?), + ForkName::Bellatrix => { + Self::Bellatrix(serde_json::from_value(value).map_err(convert_err)?) + } ForkName::Capella => Self::Capella(serde_json::from_value(value).map_err(convert_err)?), ForkName::Deneb => Self::Deneb(serde_json::from_value(value).map_err(convert_err)?), ForkName::Electra => Self::Electra(serde_json::from_value(value).map_err(convert_err)?), @@ -192,7 +196,7 @@ impl ForkVersionDeserialize for ExecutionPayload { impl ExecutionPayload { pub fn fork_name(&self) -> ForkName { match self { - ExecutionPayload::Merge(_) => ForkName::Merge, + ExecutionPayload::Bellatrix(_) => ForkName::Bellatrix, ExecutionPayload::Capella(_) => ForkName::Capella, ExecutionPayload::Deneb(_) => ForkName::Deneb, ExecutionPayload::Electra(_) => ForkName::Electra, diff --git a/consensus/types/src/execution_payload_header.rs b/consensus/types/src/execution_payload_header.rs index 3d0b0aca41d..be09ea0d841 100644 --- a/consensus/types/src/execution_payload_header.rs +++ b/consensus/types/src/execution_payload_header.rs @@ -8,7 +8,7 @@ use tree_hash::TreeHash; use tree_hash_derive::TreeHash; #[superstruct( - variants(Merge, Capella, Deneb, Electra), + variants(Bellatrix, Capella, Deneb, Electra), variant_attributes( derive( Default, @@ -99,7 +99,9 @@ impl ExecutionPayloadHeader { ForkName::Base | ForkName::Altair => Err(ssz::DecodeError::BytesInvalid(format!( "unsupported fork for ExecutionPayloadHeader: {fork_name}", ))), - ForkName::Merge => ExecutionPayloadHeaderMerge::from_ssz_bytes(bytes).map(Self::Merge), + ForkName::Bellatrix => { + ExecutionPayloadHeaderBellatrix::from_ssz_bytes(bytes).map(Self::Bellatrix) + } ForkName::Capella => { ExecutionPayloadHeaderCapella::from_ssz_bytes(bytes).map(Self::Capella) } @@ -117,7 +119,7 @@ impl ExecutionPayloadHeader { match fork_name { ForkName::Base | ForkName::Altair - | ForkName::Merge + | ForkName::Bellatrix | ForkName::Capella | ForkName::Deneb | ForkName::Electra => { @@ -137,7 +139,7 @@ impl<'a, E: EthSpec> ExecutionPayloadHeaderRef<'a, E> { } } -impl ExecutionPayloadHeaderMerge { +impl ExecutionPayloadHeaderBellatrix { pub fn upgrade_to_capella(&self) -> ExecutionPayloadHeaderCapella { ExecutionPayloadHeaderCapella { parent_hash: self.parent_hash, @@ -207,8 +209,8 @@ impl ExecutionPayloadHeaderDeneb { } } -impl<'a, E: EthSpec> From<&'a ExecutionPayloadMerge> for ExecutionPayloadHeaderMerge { - fn from(payload: &'a ExecutionPayloadMerge) -> Self { +impl<'a, E: EthSpec> From<&'a ExecutionPayloadBellatrix> for ExecutionPayloadHeaderBellatrix { + fn from(payload: &'a ExecutionPayloadBellatrix) -> Self { Self { parent_hash: payload.parent_hash, fee_recipient: payload.fee_recipient, @@ -300,7 +302,7 @@ impl<'a, E: EthSpec> From<&'a ExecutionPayloadElectra> for ExecutionPayloadHe // These impls are required to work around an inelegance in `to_execution_payload_header`. // They only clone headers so they should be relatively cheap. -impl<'a, E: EthSpec> From<&'a Self> for ExecutionPayloadHeaderMerge { +impl<'a, E: EthSpec> From<&'a Self> for ExecutionPayloadHeaderBellatrix { fn from(payload: &'a Self) -> Self { payload.clone() } @@ -334,11 +336,13 @@ impl<'a, E: EthSpec> From> for ExecutionPayloadHeader } } -impl TryFrom> for ExecutionPayloadHeaderMerge { +impl TryFrom> for ExecutionPayloadHeaderBellatrix { type Error = BeaconStateError; fn try_from(header: ExecutionPayloadHeader) -> Result { match header { - ExecutionPayloadHeader::Merge(execution_payload_header) => Ok(execution_payload_header), + ExecutionPayloadHeader::Bellatrix(execution_payload_header) => { + Ok(execution_payload_header) + } _ => Err(BeaconStateError::IncorrectStateVariant), } } @@ -389,7 +393,9 @@ impl ForkVersionDeserialize for ExecutionPayloadHeader { }; Ok(match fork_name { - ForkName::Merge => Self::Merge(serde_json::from_value(value).map_err(convert_err)?), + ForkName::Bellatrix => { + Self::Bellatrix(serde_json::from_value(value).map_err(convert_err)?) + } ForkName::Capella => Self::Capella(serde_json::from_value(value).map_err(convert_err)?), ForkName::Deneb => Self::Deneb(serde_json::from_value(value).map_err(convert_err)?), ForkName::Electra => Self::Electra(serde_json::from_value(value).map_err(convert_err)?), diff --git a/consensus/types/src/fork_context.rs b/consensus/types/src/fork_context.rs index 6b052d83976..0f7f0eb769e 100644 --- a/consensus/types/src/fork_context.rs +++ b/consensus/types/src/fork_context.rs @@ -36,11 +36,11 @@ impl ForkContext { )); } - // Only add Merge to list of forks if it's enabled - // Note: `bellatrix_fork_epoch == None` implies merge hasn't been activated yet on the config. + // Only add Bellatrix to list of forks if it's enabled + // Note: `bellatrix_fork_epoch == None` implies bellatrix hasn't been activated yet on the config. if spec.bellatrix_fork_epoch.is_some() { fork_to_digest.push(( - ForkName::Merge, + ForkName::Bellatrix, ChainSpec::compute_fork_digest( spec.bellatrix_fork_version, genesis_validators_root, diff --git a/consensus/types/src/fork_name.rs b/consensus/types/src/fork_name.rs index f6bd5cbadf9..5cc66214733 100644 --- a/consensus/types/src/fork_name.rs +++ b/consensus/types/src/fork_name.rs @@ -13,7 +13,7 @@ use std::str::FromStr; pub enum ForkName { Base, Altair, - Merge, + Bellatrix, Capella, Deneb, Electra, @@ -24,7 +24,7 @@ impl ForkName { vec![ ForkName::Base, ForkName::Altair, - ForkName::Merge, + ForkName::Bellatrix, ForkName::Capella, ForkName::Deneb, ForkName::Electra, @@ -57,7 +57,7 @@ impl ForkName { spec.electra_fork_epoch = None; spec } - ForkName::Merge => { + ForkName::Bellatrix => { spec.altair_fork_epoch = Some(Epoch::new(0)); spec.bellatrix_fork_epoch = Some(Epoch::new(0)); spec.capella_fork_epoch = None; @@ -99,8 +99,8 @@ impl ForkName { match self { ForkName::Base => None, ForkName::Altair => Some(ForkName::Base), - ForkName::Merge => Some(ForkName::Altair), - ForkName::Capella => Some(ForkName::Merge), + ForkName::Bellatrix => Some(ForkName::Altair), + ForkName::Capella => Some(ForkName::Bellatrix), ForkName::Deneb => Some(ForkName::Capella), ForkName::Electra => Some(ForkName::Deneb), } @@ -112,8 +112,8 @@ impl ForkName { pub fn next_fork(self) -> Option { match self { ForkName::Base => Some(ForkName::Altair), - ForkName::Altair => Some(ForkName::Merge), - ForkName::Merge => Some(ForkName::Capella), + ForkName::Altair => Some(ForkName::Bellatrix), + ForkName::Bellatrix => Some(ForkName::Capella), ForkName::Capella => Some(ForkName::Deneb), ForkName::Deneb => Some(ForkName::Electra), ForkName::Electra => None, @@ -154,9 +154,9 @@ macro_rules! map_fork_name_with { let (value, extra_data) = $body; ($t::Altair(value), extra_data) } - ForkName::Merge => { + ForkName::Bellatrix => { let (value, extra_data) = $body; - ($t::Merge(value), extra_data) + ($t::Bellatrix(value), extra_data) } ForkName::Capella => { let (value, extra_data) = $body; @@ -181,7 +181,7 @@ impl FromStr for ForkName { Ok(match fork_name.to_lowercase().as_ref() { "phase0" | "base" => ForkName::Base, "altair" => ForkName::Altair, - "bellatrix" | "merge" => ForkName::Merge, + "bellatrix" | "merge" => ForkName::Bellatrix, "capella" => ForkName::Capella, "deneb" => ForkName::Deneb, "electra" => ForkName::Electra, @@ -195,7 +195,7 @@ impl Display for ForkName { match self { ForkName::Base => "phase0".fmt(f), ForkName::Altair => "altair".fmt(f), - ForkName::Merge => "bellatrix".fmt(f), + ForkName::Bellatrix => "bellatrix".fmt(f), ForkName::Capella => "capella".fmt(f), ForkName::Deneb => "deneb".fmt(f), ForkName::Electra => "electra".fmt(f), @@ -259,9 +259,9 @@ mod test { #[test] fn fork_name_bellatrix_or_merge() { - assert_eq!(ForkName::from_str("bellatrix"), Ok(ForkName::Merge)); - assert_eq!(ForkName::from_str("merge"), Ok(ForkName::Merge)); - assert_eq!(ForkName::Merge.to_string(), "bellatrix"); + assert_eq!(ForkName::from_str("bellatrix"), Ok(ForkName::Bellatrix)); + assert_eq!(ForkName::from_str("merge"), Ok(ForkName::Bellatrix)); + assert_eq!(ForkName::Bellatrix.to_string(), "bellatrix"); } #[test] diff --git a/consensus/types/src/fork_versioned_response.rs b/consensus/types/src/fork_versioned_response.rs index 195c083e295..cd78b5b3ca0 100644 --- a/consensus/types/src/fork_versioned_response.rs +++ b/consensus/types/src/fork_versioned_response.rs @@ -104,7 +104,8 @@ impl ForkVersionedResponse { #[cfg(test)] mod fork_version_response_tests { use crate::{ - ExecutionPayload, ExecutionPayloadMerge, ForkName, ForkVersionedResponse, MainnetEthSpec, + ExecutionPayload, ExecutionPayloadBellatrix, ForkName, ForkVersionedResponse, + MainnetEthSpec, }; use serde_json::json; @@ -114,9 +115,9 @@ mod fork_version_response_tests { let response_json = serde_json::to_string(&json!(ForkVersionedResponse::> { - version: Some(ForkName::Merge), + version: Some(ForkName::Bellatrix), metadata: Default::default(), - data: ExecutionPayload::Merge(ExecutionPayloadMerge::default()), + data: ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix::default()), })) .unwrap(); @@ -134,7 +135,7 @@ mod fork_version_response_tests { serde_json::to_string(&json!(ForkVersionedResponse::> { version: Some(ForkName::Capella), metadata: Default::default(), - data: ExecutionPayload::Merge(ExecutionPayloadMerge::default()), + data: ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix::default()), })) .unwrap(); diff --git a/consensus/types/src/lib.rs b/consensus/types/src/lib.rs index 6551ebc1dda..c67b317b26a 100644 --- a/consensus/types/src/lib.rs +++ b/consensus/types/src/lib.rs @@ -114,13 +114,13 @@ pub use crate::attestation_data::AttestationData; pub use crate::attestation_duty::AttestationDuty; pub use crate::attester_slashing::AttesterSlashing; pub use crate::beacon_block::{ - BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockCapella, BeaconBlockDeneb, - BeaconBlockElectra, BeaconBlockMerge, BeaconBlockRef, BeaconBlockRefMut, BlindedBeaconBlock, + BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BeaconBlockCapella, + BeaconBlockDeneb, BeaconBlockElectra, BeaconBlockRef, BeaconBlockRefMut, BlindedBeaconBlock, EmptyBlock, }; pub use crate::beacon_block_body::{ - BeaconBlockBody, BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyCapella, - BeaconBlockBodyDeneb, BeaconBlockBodyElectra, BeaconBlockBodyMerge, BeaconBlockBodyRef, + BeaconBlockBody, BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyBellatrix, + BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconBlockBodyElectra, BeaconBlockBodyRef, BeaconBlockBodyRefMut, }; pub use crate::beacon_block_header::BeaconBlockHeader; @@ -145,12 +145,12 @@ pub use crate::eth_spec::EthSpecId; pub use crate::execution_block_hash::ExecutionBlockHash; pub use crate::execution_block_header::ExecutionBlockHeader; pub use crate::execution_payload::{ - ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra, - ExecutionPayloadMerge, ExecutionPayloadRef, Transaction, Transactions, Withdrawals, + ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb, + ExecutionPayloadElectra, ExecutionPayloadRef, Transaction, Transactions, Withdrawals, }; pub use crate::execution_payload_header::{ - ExecutionPayloadHeader, ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, - ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderMerge, ExecutionPayloadHeaderRef, + ExecutionPayloadHeader, ExecutionPayloadHeaderBellatrix, ExecutionPayloadHeaderCapella, + ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderRef, ExecutionPayloadHeaderRefMut, }; pub use crate::fork::Fork; @@ -183,9 +183,9 @@ pub use crate::light_client_update::{ pub use crate::participation_flags::ParticipationFlags; pub use crate::participation_list::ParticipationList; pub use crate::payload::{ - AbstractExecPayload, BlindedPayload, BlindedPayloadCapella, BlindedPayloadDeneb, - BlindedPayloadElectra, BlindedPayloadMerge, BlindedPayloadRef, BlockType, ExecPayload, - FullPayload, FullPayloadCapella, FullPayloadDeneb, FullPayloadElectra, FullPayloadMerge, + AbstractExecPayload, BlindedPayload, BlindedPayloadBellatrix, BlindedPayloadCapella, + BlindedPayloadDeneb, BlindedPayloadElectra, BlindedPayloadRef, BlockType, ExecPayload, + FullPayload, FullPayloadBellatrix, FullPayloadCapella, FullPayloadDeneb, FullPayloadElectra, FullPayloadRef, OwnedExecPayload, }; pub use crate::pending_attestation::PendingAttestation; @@ -201,9 +201,9 @@ pub use crate::shuffling_id::AttestationShufflingId; pub use crate::signed_aggregate_and_proof::SignedAggregateAndProof; pub use crate::signed_beacon_block::{ ssz_tagged_signed_beacon_block, ssz_tagged_signed_beacon_block_arc, SignedBeaconBlock, - SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockCapella, - SignedBeaconBlockDeneb, SignedBeaconBlockElectra, SignedBeaconBlockHash, - SignedBeaconBlockMerge, SignedBlindedBeaconBlock, + SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockBellatrix, + SignedBeaconBlockCapella, SignedBeaconBlockDeneb, SignedBeaconBlockElectra, + SignedBeaconBlockHash, SignedBlindedBeaconBlock, }; pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader; pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange; diff --git a/consensus/types/src/light_client_bootstrap.rs b/consensus/types/src/light_client_bootstrap.rs index 33fbf214c80..52068d28c53 100644 --- a/consensus/types/src/light_client_bootstrap.rs +++ b/consensus/types/src/light_client_bootstrap.rs @@ -79,7 +79,7 @@ impl LightClientBootstrap { pub fn from_ssz_bytes(bytes: &[u8], fork_name: ForkName) -> Result { let bootstrap = match fork_name { - ForkName::Altair | ForkName::Merge => { + ForkName::Altair | ForkName::Bellatrix => { Self::Altair(LightClientBootstrapAltair::from_ssz_bytes(bytes)?) } ForkName::Capella => Self::Capella(LightClientBootstrapCapella::from_ssz_bytes(bytes)?), @@ -102,7 +102,7 @@ impl LightClientBootstrap { match fork_name { ForkName::Base => 0, ForkName::Altair - | ForkName::Merge + | ForkName::Bellatrix | ForkName::Capella | ForkName::Deneb | ForkName::Electra => { @@ -129,7 +129,7 @@ impl LightClientBootstrap { .map_err(|_| Error::InconsistentFork)? { ForkName::Base => return Err(Error::AltairForkNotActive), - ForkName::Altair | ForkName::Merge => Self::Altair(LightClientBootstrapAltair { + ForkName::Altair | ForkName::Bellatrix => Self::Altair(LightClientBootstrapAltair { header: LightClientHeaderAltair::block_to_light_client_header(block)?, current_sync_committee, current_sync_committee_branch, diff --git a/consensus/types/src/light_client_finality_update.rs b/consensus/types/src/light_client_finality_update.rs index c5c730e8b83..1fe51781046 100644 --- a/consensus/types/src/light_client_finality_update.rs +++ b/consensus/types/src/light_client_finality_update.rs @@ -78,7 +78,7 @@ impl LightClientFinalityUpdate { .fork_name(chain_spec) .map_err(|_| Error::InconsistentFork)? { - ForkName::Altair | ForkName::Merge => { + ForkName::Altair | ForkName::Bellatrix => { let finality_update = LightClientFinalityUpdateAltair { attested_header: LightClientHeaderAltair::block_to_light_client_header( attested_block, @@ -146,7 +146,7 @@ impl LightClientFinalityUpdate { pub fn from_ssz_bytes(bytes: &[u8], fork_name: ForkName) -> Result { let finality_update = match fork_name { - ForkName::Altair | ForkName::Merge => { + ForkName::Altair | ForkName::Bellatrix => { Self::Altair(LightClientFinalityUpdateAltair::from_ssz_bytes(bytes)?) } ForkName::Capella => { @@ -171,7 +171,7 @@ impl LightClientFinalityUpdate { match fork_name { ForkName::Base => 0, ForkName::Altair - | ForkName::Merge + | ForkName::Bellatrix | ForkName::Capella | ForkName::Deneb | ForkName::Electra => { diff --git a/consensus/types/src/light_client_header.rs b/consensus/types/src/light_client_header.rs index 647ece99499..213ec90f955 100644 --- a/consensus/types/src/light_client_header.rs +++ b/consensus/types/src/light_client_header.rs @@ -75,7 +75,7 @@ impl LightClientHeader { .map_err(|_| Error::InconsistentFork)? { ForkName::Base => return Err(Error::AltairForkNotActive), - ForkName::Altair | ForkName::Merge => LightClientHeader::Altair( + ForkName::Altair | ForkName::Bellatrix => LightClientHeader::Altair( LightClientHeaderAltair::block_to_light_client_header(block)?, ), ForkName::Capella => LightClientHeader::Capella( @@ -90,7 +90,7 @@ impl LightClientHeader { pub fn from_ssz_bytes(bytes: &[u8], fork_name: ForkName) -> Result { let header = match fork_name { - ForkName::Altair | ForkName::Merge => { + ForkName::Altair | ForkName::Bellatrix => { LightClientHeader::Altair(LightClientHeaderAltair::from_ssz_bytes(bytes)?) } ForkName::Capella => { @@ -119,7 +119,7 @@ impl LightClientHeader { pub fn ssz_max_var_len_for_fork(fork_name: ForkName) -> usize { match fork_name { - ForkName::Base | ForkName::Altair | ForkName::Merge => 0, + ForkName::Base | ForkName::Altair | ForkName::Bellatrix => 0, ForkName::Capella | ForkName::Deneb | ForkName::Electra => { ExecutionPayloadHeader::::ssz_max_var_len_for_fork(fork_name) } @@ -198,7 +198,7 @@ impl ForkVersionDeserialize for LightClientHeader { fork_name: ForkName, ) -> Result { match fork_name { - ForkName::Altair | ForkName::Merge => serde_json::from_value(value) + ForkName::Altair | ForkName::Bellatrix => serde_json::from_value(value) .map(|light_client_header| Self::Altair(light_client_header)) .map_err(serde::de::Error::custom), ForkName::Capella => serde_json::from_value(value) diff --git a/consensus/types/src/light_client_optimistic_update.rs b/consensus/types/src/light_client_optimistic_update.rs index d22c4535f1e..4727673f6c0 100644 --- a/consensus/types/src/light_client_optimistic_update.rs +++ b/consensus/types/src/light_client_optimistic_update.rs @@ -70,13 +70,15 @@ impl LightClientOptimisticUpdate { .fork_name(chain_spec) .map_err(|_| Error::InconsistentFork)? { - ForkName::Altair | ForkName::Merge => Self::Altair(LightClientOptimisticUpdateAltair { - attested_header: LightClientHeaderAltair::block_to_light_client_header( - attested_block, - )?, - sync_aggregate, - signature_slot, - }), + ForkName::Altair | ForkName::Bellatrix => { + Self::Altair(LightClientOptimisticUpdateAltair { + attested_header: LightClientHeaderAltair::block_to_light_client_header( + attested_block, + )?, + sync_aggregate, + signature_slot, + }) + } ForkName::Capella => Self::Capella(LightClientOptimisticUpdateCapella { attested_header: LightClientHeaderCapella::block_to_light_client_header( attested_block, @@ -131,7 +133,7 @@ impl LightClientOptimisticUpdate { pub fn from_ssz_bytes(bytes: &[u8], fork_name: ForkName) -> Result { let optimistic_update = match fork_name { - ForkName::Altair | ForkName::Merge => { + ForkName::Altair | ForkName::Bellatrix => { Self::Altair(LightClientOptimisticUpdateAltair::from_ssz_bytes(bytes)?) } ForkName::Capella => { @@ -156,7 +158,7 @@ impl LightClientOptimisticUpdate { match fork_name { ForkName::Base => 0, ForkName::Altair - | ForkName::Merge + | ForkName::Bellatrix | ForkName::Capella | ForkName::Deneb | ForkName::Electra => { diff --git a/consensus/types/src/light_client_update.rs b/consensus/types/src/light_client_update.rs index af9cbc16610..7d0d82ca9f9 100644 --- a/consensus/types/src/light_client_update.rs +++ b/consensus/types/src/light_client_update.rs @@ -184,7 +184,7 @@ impl LightClientUpdate { .map_err(|_| Error::InconsistentFork)? { ForkName::Base => return Err(Error::AltairForkNotActive), - ForkName::Altair | ForkName::Merge => { + ForkName::Altair | ForkName::Bellatrix => { let attested_header = LightClientHeaderAltair::block_to_light_client_header(attested_block)?; let finalized_header = @@ -236,7 +236,7 @@ impl LightClientUpdate { pub fn from_ssz_bytes(bytes: &[u8], fork_name: ForkName) -> Result { let update = match fork_name { - ForkName::Altair | ForkName::Merge => { + ForkName::Altair | ForkName::Bellatrix => { Self::Altair(LightClientUpdateAltair::from_ssz_bytes(bytes)?) } ForkName::Capella => Self::Capella(LightClientUpdateCapella::from_ssz_bytes(bytes)?), diff --git a/consensus/types/src/payload.rs b/consensus/types/src/payload.rs index 18b3199bd35..80a70c171f5 100644 --- a/consensus/types/src/payload.rs +++ b/consensus/types/src/payload.rs @@ -79,22 +79,22 @@ pub trait AbstractExecPayload: + Sized + From> + TryFrom> - + TryInto + + TryInto + TryInto + TryInto + TryInto { type Ref<'a>: ExecPayload + Copy - + From<&'a Self::Merge> + + From<&'a Self::Bellatrix> + From<&'a Self::Capella> + From<&'a Self::Deneb> + From<&'a Self::Electra>; - type Merge: OwnedExecPayload + type Bellatrix: OwnedExecPayload + Into - + for<'a> From>> - + TryFrom>; + + for<'a> From>> + + TryFrom>; type Capella: OwnedExecPayload + Into + for<'a> From>> @@ -110,7 +110,7 @@ pub trait AbstractExecPayload: } #[superstruct( - variants(Merge, Capella, Deneb, Electra), + variants(Bellatrix, Capella, Deneb, Electra), variant_attributes( derive( Debug, @@ -145,8 +145,11 @@ pub trait AbstractExecPayload: #[arbitrary(bound = "E: EthSpec")] #[tree_hash(enum_behaviour = "transparent")] pub struct FullPayload { - #[superstruct(only(Merge), partial_getter(rename = "execution_payload_merge"))] - pub execution_payload: ExecutionPayloadMerge, + #[superstruct( + only(Bellatrix), + partial_getter(rename = "execution_payload_bellatrix") + )] + pub execution_payload: ExecutionPayloadBellatrix, #[superstruct(only(Capella), partial_getter(rename = "execution_payload_capella"))] pub execution_payload: ExecutionPayloadCapella, #[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))] @@ -252,7 +255,7 @@ impl ExecPayload for FullPayload { fn withdrawals_root(&self) -> Result { match self { - FullPayload::Merge(_) => Err(Error::IncorrectStateVariant), + FullPayload::Bellatrix(_) => Err(Error::IncorrectStateVariant), FullPayload::Capella(ref inner) => { Ok(inner.execution_payload.withdrawals.tree_hash_root()) } @@ -267,7 +270,9 @@ impl ExecPayload for FullPayload { fn blob_gas_used(&self) -> Result { match self { - FullPayload::Merge(_) | FullPayload::Capella(_) => Err(Error::IncorrectStateVariant), + FullPayload::Bellatrix(_) | FullPayload::Capella(_) => { + Err(Error::IncorrectStateVariant) + } FullPayload::Deneb(ref inner) => Ok(inner.execution_payload.blob_gas_used), FullPayload::Electra(ref inner) => Ok(inner.execution_payload.blob_gas_used), } @@ -296,7 +301,7 @@ impl FullPayload { pub fn default_at_fork(fork_name: ForkName) -> Result { match fork_name { ForkName::Base | ForkName::Altair => Err(Error::IncorrectStateVariant), - ForkName::Merge => Ok(FullPayloadMerge::default().into()), + ForkName::Bellatrix => Ok(FullPayloadBellatrix::default().into()), ForkName::Capella => Ok(FullPayloadCapella::default().into()), ForkName::Deneb => Ok(FullPayloadDeneb::default().into()), ForkName::Electra => Ok(FullPayloadElectra::default().into()), @@ -382,7 +387,7 @@ impl<'b, E: EthSpec> ExecPayload for FullPayloadRef<'b, E> { fn withdrawals_root(&self) -> Result { match self { - FullPayloadRef::Merge(_) => Err(Error::IncorrectStateVariant), + FullPayloadRef::Bellatrix(_) => Err(Error::IncorrectStateVariant), FullPayloadRef::Capella(inner) => { Ok(inner.execution_payload.withdrawals.tree_hash_root()) } @@ -397,7 +402,7 @@ impl<'b, E: EthSpec> ExecPayload for FullPayloadRef<'b, E> { fn blob_gas_used(&self) -> Result { match self { - FullPayloadRef::Merge(_) | FullPayloadRef::Capella(_) => { + FullPayloadRef::Bellatrix(_) | FullPayloadRef::Capella(_) => { Err(Error::IncorrectStateVariant) } FullPayloadRef::Deneb(inner) => Ok(inner.execution_payload.blob_gas_used), @@ -420,7 +425,7 @@ impl<'b, E: EthSpec> ExecPayload for FullPayloadRef<'b, E> { impl AbstractExecPayload for FullPayload { type Ref<'a> = FullPayloadRef<'a, E>; - type Merge = FullPayloadMerge; + type Bellatrix = FullPayloadBellatrix; type Capella = FullPayloadCapella; type Deneb = FullPayloadDeneb; type Electra = FullPayloadElectra; @@ -442,7 +447,7 @@ impl TryFrom> for FullPayload { } #[superstruct( - variants(Merge, Capella, Deneb, Electra), + variants(Bellatrix, Capella, Deneb, Electra), variant_attributes( derive( Debug, @@ -476,8 +481,11 @@ impl TryFrom> for FullPayload { #[arbitrary(bound = "E: EthSpec")] #[tree_hash(enum_behaviour = "transparent")] pub struct BlindedPayload { - #[superstruct(only(Merge), partial_getter(rename = "execution_payload_merge"))] - pub execution_payload_header: ExecutionPayloadHeaderMerge, + #[superstruct( + only(Bellatrix), + partial_getter(rename = "execution_payload_bellatrix") + )] + pub execution_payload_header: ExecutionPayloadHeaderBellatrix, #[superstruct(only(Capella), partial_getter(rename = "execution_payload_capella"))] pub execution_payload_header: ExecutionPayloadHeaderCapella, #[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))] @@ -561,7 +569,7 @@ impl ExecPayload for BlindedPayload { fn withdrawals_root(&self) -> Result { match self { - BlindedPayload::Merge(_) => Err(Error::IncorrectStateVariant), + BlindedPayload::Bellatrix(_) => Err(Error::IncorrectStateVariant), BlindedPayload::Capella(ref inner) => { Ok(inner.execution_payload_header.withdrawals_root) } @@ -574,7 +582,7 @@ impl ExecPayload for BlindedPayload { fn blob_gas_used(&self) -> Result { match self { - BlindedPayload::Merge(_) | BlindedPayload::Capella(_) => { + BlindedPayload::Bellatrix(_) | BlindedPayload::Capella(_) => { Err(Error::IncorrectStateVariant) } BlindedPayload::Deneb(ref inner) => Ok(inner.execution_payload_header.blob_gas_used), @@ -662,7 +670,7 @@ impl<'b, E: EthSpec> ExecPayload for BlindedPayloadRef<'b, E> { fn withdrawals_root(&self) -> Result { match self { - BlindedPayloadRef::Merge(_) => Err(Error::IncorrectStateVariant), + BlindedPayloadRef::Bellatrix(_) => Err(Error::IncorrectStateVariant), BlindedPayloadRef::Capella(inner) => { Ok(inner.execution_payload_header.withdrawals_root) } @@ -675,7 +683,7 @@ impl<'b, E: EthSpec> ExecPayload for BlindedPayloadRef<'b, E> { fn blob_gas_used(&self) -> Result { match self { - BlindedPayloadRef::Merge(_) | BlindedPayloadRef::Capella(_) => { + BlindedPayloadRef::Bellatrix(_) | BlindedPayloadRef::Capella(_) => { Err(Error::IncorrectStateVariant) } BlindedPayloadRef::Deneb(inner) => Ok(inner.execution_payload_header.blob_gas_used), @@ -699,12 +707,12 @@ impl<'b, E: EthSpec> ExecPayload for BlindedPayloadRef<'b, E> { } macro_rules! impl_exec_payload_common { - ($wrapper_type:ident, // BlindedPayloadMerge | FullPayloadMerge - $wrapped_type:ident, // ExecutionPayloadHeaderMerge | ExecutionPayloadMerge - $wrapped_type_full:ident, // ExecutionPayloadMerge | ExecutionPayloadMerge - $wrapped_type_header:ident, // ExecutionPayloadHeaderMerge | ExecutionPayloadHeaderMerge + ($wrapper_type:ident, // BlindedPayloadBellatrix | FullPayloadBellatrix + $wrapped_type:ident, // ExecutionPayloadHeaderBellatrix | ExecutionPayloadBellatrix + $wrapped_type_full:ident, // ExecutionPayloadBellatrix | ExecutionPayloadBellatrix + $wrapped_type_header:ident, // ExecutionPayloadHeaderBellatrix | ExecutionPayloadHeaderBellatrix $wrapped_field:ident, // execution_payload_header | execution_payload - $fork_variant:ident, // Merge | Merge + $fork_variant:ident, // Bellatrix | Bellatrix $block_type_variant:ident, // Blinded | Full $is_default_with_empty_roots:block, $f:block, @@ -783,17 +791,17 @@ macro_rules! impl_exec_payload_common { } macro_rules! impl_exec_payload_for_fork { - // BlindedPayloadMerge, FullPayloadMerge, ExecutionPayloadHeaderMerge, ExecutionPayloadMerge, Merge + // BlindedPayloadBellatrix, FullPayloadBellatrix, ExecutionPayloadHeaderBellatrix, ExecutionPayloadBellatrix, Bellatrix ($wrapper_type_header:ident, $wrapper_type_full:ident, $wrapped_type_header:ident, $wrapped_type_full:ident, $fork_variant:ident) => { //*************** Blinded payload implementations ******************// impl_exec_payload_common!( - $wrapper_type_header, // BlindedPayloadMerge - $wrapped_type_header, // ExecutionPayloadHeaderMerge - $wrapped_type_full, // ExecutionPayloadMerge - $wrapped_type_header, // ExecutionPayloadHeaderMerge + $wrapper_type_header, // BlindedPayloadBellatrix + $wrapped_type_header, // ExecutionPayloadHeaderBellatrix + $wrapped_type_full, // ExecutionPayloadBellatrix + $wrapped_type_header, // ExecutionPayloadHeaderBellatrix execution_payload_header, - $fork_variant, // Merge + $fork_variant, // Bellatrix Blinded, { |wrapper: &$wrapper_type_header| { @@ -872,12 +880,12 @@ macro_rules! impl_exec_payload_for_fork { //*************** Full payload implementations ******************// impl_exec_payload_common!( - $wrapper_type_full, // FullPayloadMerge - $wrapped_type_full, // ExecutionPayloadMerge - $wrapped_type_full, // ExecutionPayloadMerge - $wrapped_type_header, // ExecutionPayloadHeaderMerge + $wrapper_type_full, // FullPayloadBellatrix + $wrapped_type_full, // ExecutionPayloadBellatrix + $wrapped_type_full, // ExecutionPayloadBellatrix + $wrapped_type_header, // ExecutionPayloadHeaderBellatrix execution_payload, - $fork_variant, // Merge + $fork_variant, // Bellatrix Full, { |wrapper: &$wrapper_type_full| { @@ -952,11 +960,11 @@ macro_rules! impl_exec_payload_for_fork { } impl_exec_payload_for_fork!( - BlindedPayloadMerge, - FullPayloadMerge, - ExecutionPayloadHeaderMerge, - ExecutionPayloadMerge, - Merge + BlindedPayloadBellatrix, + FullPayloadBellatrix, + ExecutionPayloadHeaderBellatrix, + ExecutionPayloadBellatrix, + Bellatrix ); impl_exec_payload_for_fork!( BlindedPayloadCapella, @@ -982,7 +990,7 @@ impl_exec_payload_for_fork!( impl AbstractExecPayload for BlindedPayload { type Ref<'a> = BlindedPayloadRef<'a, E>; - type Merge = BlindedPayloadMerge; + type Bellatrix = BlindedPayloadBellatrix; type Capella = BlindedPayloadCapella; type Deneb = BlindedPayloadDeneb; type Electra = BlindedPayloadElectra; @@ -1002,8 +1010,8 @@ impl From> for BlindedPayload { impl From> for BlindedPayload { fn from(execution_payload_header: ExecutionPayloadHeader) -> Self { match execution_payload_header { - ExecutionPayloadHeader::Merge(execution_payload_header) => { - Self::Merge(BlindedPayloadMerge { + ExecutionPayloadHeader::Bellatrix(execution_payload_header) => { + Self::Bellatrix(BlindedPayloadBellatrix { execution_payload_header, }) } @@ -1029,8 +1037,8 @@ impl From> for BlindedPayload { impl From> for ExecutionPayloadHeader { fn from(blinded: BlindedPayload) -> Self { match blinded { - BlindedPayload::Merge(blinded_payload) => { - ExecutionPayloadHeader::Merge(blinded_payload.execution_payload_header) + BlindedPayload::Bellatrix(blinded_payload) => { + ExecutionPayloadHeader::Bellatrix(blinded_payload.execution_payload_header) } BlindedPayload::Capella(blinded_payload) => { ExecutionPayloadHeader::Capella(blinded_payload.execution_payload_header) diff --git a/consensus/types/src/signed_beacon_block.rs b/consensus/types/src/signed_beacon_block.rs index da4ac392362..4d3279a7f77 100644 --- a/consensus/types/src/signed_beacon_block.rs +++ b/consensus/types/src/signed_beacon_block.rs @@ -37,7 +37,7 @@ impl From for Hash256 { /// A `BeaconBlock` and a signature from its proposer. #[superstruct( - variants(Base, Altair, Merge, Capella, Deneb, Electra), + variants(Base, Altair, Bellatrix, Capella, Deneb, Electra), variant_attributes( derive( Debug, @@ -72,8 +72,8 @@ pub struct SignedBeaconBlock = FullP pub message: BeaconBlockBase, #[superstruct(only(Altair), partial_getter(rename = "message_altair"))] pub message: BeaconBlockAltair, - #[superstruct(only(Merge), partial_getter(rename = "message_merge"))] - pub message: BeaconBlockMerge, + #[superstruct(only(Bellatrix), partial_getter(rename = "message_bellatrix"))] + pub message: BeaconBlockBellatrix, #[superstruct(only(Capella), partial_getter(rename = "message_capella"))] pub message: BeaconBlockCapella, #[superstruct(only(Deneb), partial_getter(rename = "message_deneb"))] @@ -150,8 +150,8 @@ impl> SignedBeaconBlock BeaconBlock::Altair(message) => { SignedBeaconBlock::Altair(SignedBeaconBlockAltair { message, signature }) } - BeaconBlock::Merge(message) => { - SignedBeaconBlock::Merge(SignedBeaconBlockMerge { message, signature }) + BeaconBlock::Bellatrix(message) => { + SignedBeaconBlock::Bellatrix(SignedBeaconBlockBellatrix { message, signature }) } BeaconBlock::Capella(message) => { SignedBeaconBlock::Capella(SignedBeaconBlockCapella { message, signature }) @@ -310,20 +310,20 @@ impl From>> // Post-Bellatrix blocks can be "unblinded" by adding the full payload. // NOTE: It might be nice to come up with a `superstruct` pattern to abstract over this before // the first fork after Bellatrix. -impl SignedBeaconBlockMerge> { +impl SignedBeaconBlockBellatrix> { pub fn into_full_block( self, - execution_payload: ExecutionPayloadMerge, - ) -> SignedBeaconBlockMerge> { - let SignedBeaconBlockMerge { + execution_payload: ExecutionPayloadBellatrix, + ) -> SignedBeaconBlockBellatrix> { + let SignedBeaconBlockBellatrix { message: - BeaconBlockMerge { + BeaconBlockBellatrix { slot, proposer_index, parent_root, state_root, body: - BeaconBlockBodyMerge { + BeaconBlockBodyBellatrix { randao_reveal, eth1_data, graffiti, @@ -333,18 +333,18 @@ impl SignedBeaconBlockMerge> { deposits, voluntary_exits, sync_aggregate, - execution_payload: BlindedPayloadMerge { .. }, + execution_payload: BlindedPayloadBellatrix { .. }, }, }, signature, } = self; - SignedBeaconBlockMerge { - message: BeaconBlockMerge { + SignedBeaconBlockBellatrix { + message: BeaconBlockBellatrix { slot, proposer_index, parent_root, state_root, - body: BeaconBlockBodyMerge { + body: BeaconBlockBodyBellatrix { randao_reveal, eth1_data, graffiti, @@ -354,7 +354,7 @@ impl SignedBeaconBlockMerge> { deposits, voluntary_exits, sync_aggregate, - execution_payload: FullPayloadMerge { execution_payload }, + execution_payload: FullPayloadBellatrix { execution_payload }, }, }, signature, @@ -536,8 +536,8 @@ impl SignedBeaconBlock> { let full_block = match (self, execution_payload) { (SignedBeaconBlock::Base(block), _) => SignedBeaconBlock::Base(block.into()), (SignedBeaconBlock::Altair(block), _) => SignedBeaconBlock::Altair(block.into()), - (SignedBeaconBlock::Merge(block), Some(ExecutionPayload::Merge(payload))) => { - SignedBeaconBlock::Merge(block.into_full_block(payload)) + (SignedBeaconBlock::Bellatrix(block), Some(ExecutionPayload::Bellatrix(payload))) => { + SignedBeaconBlock::Bellatrix(block.into_full_block(payload)) } (SignedBeaconBlock::Capella(block), Some(ExecutionPayload::Capella(payload))) => { SignedBeaconBlock::Capella(block.into_full_block(payload)) @@ -550,7 +550,7 @@ impl SignedBeaconBlock> { } // avoid wildcard matching forks so that compiler will // direct us here when a new fork has been added - (SignedBeaconBlock::Merge(_), _) => return None, + (SignedBeaconBlock::Bellatrix(_), _) => return None, (SignedBeaconBlock::Capella(_), _) => return None, (SignedBeaconBlock::Deneb(_), _) => return None, (SignedBeaconBlock::Electra(_), _) => return None, @@ -687,8 +687,8 @@ pub mod ssz_tagged_signed_beacon_block { ForkName::Altair => Ok(SignedBeaconBlock::Altair( SignedBeaconBlockAltair::from_ssz_bytes(body)?, )), - ForkName::Merge => Ok(SignedBeaconBlock::Merge( - SignedBeaconBlockMerge::from_ssz_bytes(body)?, + ForkName::Bellatrix => Ok(SignedBeaconBlock::Bellatrix( + SignedBeaconBlockBellatrix::from_ssz_bytes(body)?, )), ForkName::Capella => Ok(SignedBeaconBlock::Capella( SignedBeaconBlockCapella::from_ssz_bytes(body)?, @@ -744,7 +744,10 @@ mod test { BeaconBlock::Altair(BeaconBlockAltair::empty(spec)), sig.clone(), ), - SignedBeaconBlock::from_block(BeaconBlock::Merge(BeaconBlockMerge::empty(spec)), sig), + SignedBeaconBlock::from_block( + BeaconBlock::Bellatrix(BeaconBlockBellatrix::empty(spec)), + sig, + ), ]; for block in blocks { @@ -783,7 +786,7 @@ mod test { sig.clone(), ), SignedBeaconBlock::from_block( - BeaconBlock::Merge(BeaconBlockMerge::empty(spec)), + BeaconBlock::Bellatrix(BeaconBlockBellatrix::empty(spec)), sig.clone(), ), SignedBeaconBlock::from_block( diff --git a/consensus/types/src/voluntary_exit.rs b/consensus/types/src/voluntary_exit.rs index 74175423e34..4c7c16757ed 100644 --- a/consensus/types/src/voluntary_exit.rs +++ b/consensus/types/src/voluntary_exit.rs @@ -42,7 +42,7 @@ impl VoluntaryExit { ) -> SignedVoluntaryExit { let fork_name = spec.fork_name_at_epoch(self.epoch); let fork_version = match fork_name { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => { spec.fork_version_for_name(fork_name) } // EIP-7044 diff --git a/lcli/src/create_payload_header.rs b/lcli/src/create_payload_header.rs index 7aa1ef70089..974a34591f0 100644 --- a/lcli/src/create_payload_header.rs +++ b/lcli/src/create_payload_header.rs @@ -5,8 +5,9 @@ use std::fs::File; use std::io::Write; use std::time::{SystemTime, UNIX_EPOCH}; use types::{ - EthSpec, ExecutionPayloadHeader, ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, - ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderMerge, ForkName, + EthSpec, ExecutionPayloadHeader, ExecutionPayloadHeaderBellatrix, + ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, + ForkName, }; pub fn run(matches: &ArgMatches) -> Result<(), String> { @@ -20,17 +21,17 @@ pub fn run(matches: &ArgMatches) -> Result<(), String> { let base_fee_per_gas = parse_required(matches, "base-fee-per-gas")?; let gas_limit = parse_required(matches, "gas-limit")?; let file_name = matches.value_of("file").ok_or("No file supplied")?; - let fork_name: ForkName = parse_optional(matches, "fork")?.unwrap_or(ForkName::Merge); + let fork_name: ForkName = parse_optional(matches, "fork")?.unwrap_or(ForkName::Bellatrix); let execution_payload_header: ExecutionPayloadHeader = match fork_name { ForkName::Base | ForkName::Altair => return Err("invalid fork name".to_string()), - ForkName::Merge => ExecutionPayloadHeader::Merge(ExecutionPayloadHeaderMerge { + ForkName::Bellatrix => ExecutionPayloadHeader::Bellatrix(ExecutionPayloadHeaderBellatrix { gas_limit, base_fee_per_gas, timestamp: genesis_time, block_hash: eth1_block_hash, prev_randao: eth1_block_hash.into_root(), - ..ExecutionPayloadHeaderMerge::default() + ..ExecutionPayloadHeaderBellatrix::default() }), ForkName::Capella => ExecutionPayloadHeader::Capella(ExecutionPayloadHeaderCapella { gas_limit, diff --git a/lcli/src/main.rs b/lcli/src/main.rs index c374a8f4b37..7b5c1598c9e 100644 --- a/lcli/src/main.rs +++ b/lcli/src/main.rs @@ -433,7 +433,7 @@ fn main() { .takes_value(true) .default_value("bellatrix") .help("The fork for which the execution payload header should be created.") - .possible_values(&["merge", "bellatrix", "capella", "deneb", "electra"]) + .possible_values(&["bellatrix", "capella", "deneb", "electra"]) ) ) .subcommand( diff --git a/lcli/src/new_testnet.rs b/lcli/src/new_testnet.rs index f9da3d2b3e9..d9574afd3ac 100644 --- a/lcli/src/new_testnet.rs +++ b/lcli/src/new_testnet.rs @@ -21,8 +21,8 @@ use std::time::{SystemTime, UNIX_EPOCH}; use types::ExecutionBlockHash; use types::{ test_utils::generate_deterministic_keypairs, Address, BeaconState, ChainSpec, Config, Epoch, - Eth1Data, EthSpec, ExecutionPayloadHeader, ExecutionPayloadHeaderCapella, - ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderMerge, + Eth1Data, EthSpec, ExecutionPayloadHeader, ExecutionPayloadHeaderBellatrix, + ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ForkName, Hash256, Keypair, PublicKey, Validator, }; @@ -114,9 +114,9 @@ pub fn run(testnet_dir_path: PathBuf, matches: &ArgMatches) -> Resul ForkName::Base | ForkName::Altair => Err(ssz::DecodeError::BytesInvalid( "genesis fork must be post-merge".to_string(), )), - ForkName::Merge => { - ExecutionPayloadHeaderMerge::::from_ssz_bytes(bytes.as_slice()) - .map(ExecutionPayloadHeader::Merge) + ForkName::Bellatrix => { + ExecutionPayloadHeaderBellatrix::::from_ssz_bytes(bytes.as_slice()) + .map(ExecutionPayloadHeader::Bellatrix) } ForkName::Capella => { ExecutionPayloadHeaderCapella::::from_ssz_bytes(bytes.as_slice()) @@ -246,10 +246,10 @@ fn initialize_state_with_validators( ) -> Result, String> { // If no header is provided, then start from a Bellatrix state by default let default_header: ExecutionPayloadHeader = - ExecutionPayloadHeader::Merge(ExecutionPayloadHeaderMerge { + ExecutionPayloadHeader::Bellatrix(ExecutionPayloadHeaderBellatrix { block_hash: ExecutionBlockHash::from_root(eth1_block_hash), parent_hash: ExecutionBlockHash::zero(), - ..ExecutionPayloadHeaderMerge::default() + ..ExecutionPayloadHeaderBellatrix::default() }); let execution_payload_header = execution_payload_header.unwrap_or(default_header); // Empty eth1 data @@ -314,9 +314,9 @@ fn initialize_state_with_validators( // Override latest execution payload header. // See https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/bellatrix/beacon-chain.md#testing - if let ExecutionPayloadHeader::Merge(ref header) = execution_payload_header { + if let ExecutionPayloadHeader::Bellatrix(ref header) = execution_payload_header { *state - .latest_execution_payload_header_merge_mut() + .latest_execution_payload_header_bellatrix_mut() .or(Err("mismatched fork".to_string()))? = header.clone(); } } diff --git a/lcli/src/parse_ssz.rs b/lcli/src/parse_ssz.rs index 5b34fedfb9e..e86ffb73dc2 100644 --- a/lcli/src/parse_ssz.rs +++ b/lcli/src/parse_ssz.rs @@ -70,9 +70,11 @@ pub fn run_parse_ssz( "SignedBeaconBlockAltair" => { decode_and_print(&bytes, SignedBeaconBlockAltair::::from_ssz_bytes, format)? } - "SignedBeaconBlockMerge" | "SignedBeaconBlockBellatrix" => { - decode_and_print(&bytes, SignedBeaconBlockMerge::::from_ssz_bytes, format)? - } + "SignedBeaconBlockBellatrix" => decode_and_print( + &bytes, + SignedBeaconBlockBellatrix::::from_ssz_bytes, + format, + )?, "SignedBeaconBlockCapella" => decode_and_print( &bytes, SignedBeaconBlockCapella::::from_ssz_bytes, @@ -97,8 +99,8 @@ pub fn run_parse_ssz( "BeaconStateAltair" => { decode_and_print(&bytes, BeaconStateAltair::::from_ssz_bytes, format)? } - "BeaconStateMerge" | "BeaconStateBellatrix" => { - decode_and_print(&bytes, BeaconStateMerge::::from_ssz_bytes, format)? + "BeaconStateBellatrix" => { + decode_and_print(&bytes, BeaconStateBellatrix::::from_ssz_bytes, format)? } "BeaconStateCapella" => { decode_and_print(&bytes, BeaconStateCapella::::from_ssz_bytes, format)? diff --git a/lighthouse/environment/tests/testnet_dir/config.yaml b/lighthouse/environment/tests/testnet_dir/config.yaml index 86f4dce239b..c71feaa7dc5 100644 --- a/lighthouse/environment/tests/testnet_dir/config.yaml +++ b/lighthouse/environment/tests/testnet_dir/config.yaml @@ -32,7 +32,7 @@ GENESIS_DELAY: 604800 # Altair ALTAIR_FORK_VERSION: 0x01000000 ALTAIR_FORK_EPOCH: 18446744073709551615 -# Merge +# Bellatrix BELLATRIX_FORK_VERSION: 0x02000000 BELLATRIX_FORK_EPOCH: 18446744073709551615 # Sharding diff --git a/lighthouse/tests/beacon_node.rs b/lighthouse/tests/beacon_node.rs index 4a50126945b..1531ef8f8f9 100644 --- a/lighthouse/tests/beacon_node.rs +++ b/lighthouse/tests/beacon_node.rs @@ -411,7 +411,7 @@ fn eth1_cache_follow_distance_manual() { } // Tests for Bellatrix flags. -fn run_merge_execution_endpoints_flag_test(flag: &str) { +fn run_bellatrix_execution_endpoints_flag_test(flag: &str) { use sensitive_url::SensitiveUrl; let urls = vec!["http://sigp.io/no-way:1337", "http://infura.not_real:4242"]; // we don't support redundancy for execution-endpoints @@ -492,15 +492,15 @@ fn execution_timeout_multiplier_flag() { }); } #[test] -fn merge_execution_endpoints_flag() { - run_merge_execution_endpoints_flag_test("execution-endpoints") +fn bellatrix_execution_endpoints_flag() { + run_bellatrix_execution_endpoints_flag_test("execution-endpoints") } #[test] -fn merge_execution_endpoint_flag() { - run_merge_execution_endpoints_flag_test("execution-endpoint") +fn bellatrix_execution_endpoint_flag() { + run_bellatrix_execution_endpoints_flag_test("execution-endpoint") } #[test] -fn merge_jwt_secrets_flag() { +fn bellatrix_jwt_secrets_flag() { let dir = TempDir::new().expect("Unable to create temporary directory"); let mut file = File::create(dir.path().join("jwtsecrets")).expect("Unable to create file"); file.write_all(b"0x3cbc11b0d8fa16f3344eacfd6ff6430b9d30734450e8adcf5400f88d327dcb33") @@ -522,7 +522,7 @@ fn merge_jwt_secrets_flag() { }); } #[test] -fn merge_fee_recipient_flag() { +fn bellatrix_fee_recipient_flag() { let dir = TempDir::new().expect("Unable to create temporary directory"); CommandLineTest::new() .flag("execution-endpoint", Some("http://meow.cats")) diff --git a/testing/ef_tests/src/cases/common.rs b/testing/ef_tests/src/cases/common.rs index 342a48ba46c..6763edbe22b 100644 --- a/testing/ef_tests/src/cases/common.rs +++ b/testing/ef_tests/src/cases/common.rs @@ -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, } diff --git a/testing/ef_tests/src/cases/epoch_processing.rs b/testing/ef_tests/src/cases/epoch_processing.rs index a9c77c53c52..c4c592e4cf2 100644 --- a/testing/ef_tests/src/cases/epoch_processing.rs +++ b/testing/ef_tests/src/cases/epoch_processing.rs @@ -105,7 +105,7 @@ impl EpochTransition for JustificationAndFinalization { Ok(()) } BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => { @@ -128,7 +128,7 @@ impl EpochTransition 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 EpochTransition for Slashings { )?; } BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => { @@ -203,7 +203,7 @@ impl EpochTransition for RandaoMixesReset { impl EpochTransition for HistoricalRootsUpdate { fn run(state: &mut BeaconState, _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 EpochTransition 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 EpochTransition 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 EpochTransition 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> Case for EpochProcessing { && 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" } diff --git a/testing/ef_tests/src/cases/fork.rs b/testing/ef_tests/src/cases/fork.rs index be8a344a35a..132cfb4c0ae 100644 --- a/testing/ef_tests/src/cases/fork.rs +++ b/testing/ef_tests/src/cases/fork.rs @@ -63,7 +63,9 @@ impl Case for ForkTest { 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), diff --git a/testing/ef_tests/src/cases/merkle_proof_validity.rs b/testing/ef_tests/src/cases/merkle_proof_validity.rs index a2e831ade59..458885eb284 100644 --- a/testing/ef_tests/src/cases/merkle_proof_validity.rs +++ b/testing/ef_tests/src/cases/merkle_proof_validity.rs @@ -95,7 +95,7 @@ pub struct KzgInclusionMerkleProofValidity { impl LoadCase for KzgInclusionMerkleProofValidity { fn load_from_dir(path: &Path, fork_name: ForkName) -> Result { let block: BeaconBlockBody> = 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 diff --git a/testing/ef_tests/src/cases/operations.rs b/testing/ef_tests/src/cases/operations.rs index a2f50896a57..158f2334dc3 100644 --- a/testing/ef_tests/src/cases/operations.rs +++ b/testing/ef_tests/src/cases/operations.rs @@ -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 Operation for Attestation { spec, ), BeaconState::Altair(_) - | BeaconState::Merge(_) + | BeaconState::Bellatrix(_) | BeaconState::Capella(_) | BeaconState::Deneb(_) | BeaconState::Electra(_) => { @@ -289,7 +289,7 @@ impl Operation for BeaconBlockBody> { fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result { 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 Operation for BeaconBlockBody> { fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result { ssz_decode_file_with(path, |bytes| { Ok(match fork_name { - ForkName::Merge => { - let inner = >>::from_ssz_bytes(bytes)?; - BeaconBlockBody::Merge(inner.clone_as_blinded()) + ForkName::Bellatrix => { + let inner = + >>::from_ssz_bytes(bytes)?; + BeaconBlockBody::Bellatrix(inner.clone_as_blinded()) } ForkName::Capella => { let inner = >>::from_ssz_bytes(bytes)?; @@ -375,7 +376,9 @@ impl Operation for WithdrawalsPayload { } 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 { @@ -407,7 +410,9 @@ impl Operation 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 { diff --git a/testing/ef_tests/src/cases/transition.rs b/testing/ef_tests/src/cases/transition.rs index 927589948a2..01b3d940464 100644 --- a/testing/ef_tests/src/cases/transition.rs +++ b/testing/ef_tests/src/cases/transition.rs @@ -38,7 +38,7 @@ impl LoadCase for TransitionTest { 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); } diff --git a/testing/ef_tests/src/handler.rs b/testing/ef_tests/src/handler.rs index 59b5cb6ba74..2d5ea4149ef 100644 --- a/testing/ef_tests/src/handler.rs +++ b/testing/ef_tests/src/handler.rs @@ -217,8 +217,8 @@ impl SszStaticHandler { 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 Handler for ForkChoiceHandler { 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 Handler for KzgInclusionMerkleProofValidityHandler, MainnetEthSpec>::altair_only() .run(); - SszStaticHandler::, MinimalEthSpec>::merge_only() + SszStaticHandler::, MinimalEthSpec>::bellatrix_only() .run(); - SszStaticHandler::, MainnetEthSpec>::merge_only() + SszStaticHandler::, MainnetEthSpec>::bellatrix_only() .run(); SszStaticHandler::, MinimalEthSpec>::capella_only() .run(); @@ -290,10 +290,10 @@ mod ssz_static { .run(); SszStaticHandler::, MainnetEthSpec>::altair_only() .run(); - SszStaticHandler::, MinimalEthSpec>::merge_only( + SszStaticHandler::, MinimalEthSpec>::bellatrix_only( ) .run(); - SszStaticHandler::, MainnetEthSpec>::merge_only( + SszStaticHandler::, MainnetEthSpec>::bellatrix_only( ) .run(); SszStaticHandler::, MinimalEthSpec>::capella_only() @@ -313,9 +313,9 @@ mod ssz_static { .run(); SszStaticHandler::, MainnetEthSpec>::altair_only() .run(); - SszStaticHandler::, MinimalEthSpec>::merge_only() + SszStaticHandler::, MinimalEthSpec>::bellatrix_only() .run(); - SszStaticHandler::, MainnetEthSpec>::merge_only() + SszStaticHandler::, MainnetEthSpec>::bellatrix_only() .run(); SszStaticHandler::, MinimalEthSpec>::capella_only( @@ -340,10 +340,10 @@ mod ssz_static { SszStaticHandler::, MainnetEthSpec>::altair_only( ) .run(); - SszStaticHandler::, MinimalEthSpec>::merge_only( + SszStaticHandler::, MinimalEthSpec>::bellatrix_only( ) .run(); - SszStaticHandler::, MainnetEthSpec>::merge_only( + SszStaticHandler::, MainnetEthSpec>::bellatrix_only( ) .run(); SszStaticHandler::, MinimalEthSpec>::capella_only( @@ -369,10 +369,10 @@ mod ssz_static { SszStaticHandler::, MainnetEthSpec>::altair_only( ) .run(); - SszStaticHandler::, MinimalEthSpec>::merge_only( + SszStaticHandler::, MinimalEthSpec>::bellatrix_only( ) .run(); - SszStaticHandler::, MainnetEthSpec>::merge_only( + SszStaticHandler::, MainnetEthSpec>::bellatrix_only( ) .run(); SszStaticHandler::, MinimalEthSpec>::capella_only( @@ -396,9 +396,9 @@ mod ssz_static { .run(); SszStaticHandler::, MainnetEthSpec>::altair_only() .run(); - SszStaticHandler::, MinimalEthSpec>::merge_only() + SszStaticHandler::, MinimalEthSpec>::bellatrix_only() .run(); - SszStaticHandler::, MainnetEthSpec>::merge_only() + SszStaticHandler::, MainnetEthSpec>::bellatrix_only() .run(); SszStaticHandler::, MinimalEthSpec>::capella_only( ) @@ -448,12 +448,12 @@ mod ssz_static { SszStaticHandler::::altair_and_later().run(); } - // Merge and later + // Bellatrix and later #[test] fn execution_payload() { - SszStaticHandler::, MinimalEthSpec>::merge_only() + SszStaticHandler::, MinimalEthSpec>::bellatrix_only() .run(); - SszStaticHandler::, MainnetEthSpec>::merge_only() + SszStaticHandler::, MainnetEthSpec>::bellatrix_only() .run(); SszStaticHandler::, MinimalEthSpec>::capella_only() .run(); @@ -467,9 +467,9 @@ mod ssz_static { #[test] fn execution_payload_header() { - SszStaticHandler::, MinimalEthSpec>::merge_only() + SszStaticHandler::, MinimalEthSpec>::bellatrix_only() .run(); - SszStaticHandler::, MainnetEthSpec>::merge_only() + SszStaticHandler::, MainnetEthSpec>::bellatrix_only() .run(); SszStaticHandler::, MinimalEthSpec> ::capella_only().run(); diff --git a/testing/web3signer_tests/src/lib.rs b/testing/web3signer_tests/src/lib.rs index 3090b4da556..292e10d0542 100644 --- a/testing/web3signer_tests/src/lib.rs +++ b/testing/web3signer_tests/src/lib.rs @@ -724,11 +724,11 @@ mod tests { .await; } - /// Test all the Merge types. - async fn test_merge_types(network: &str, listen_port: u16) { + /// Test all the Bellatrix types. + async fn test_bellatrix_types(network: &str, listen_port: u16) { let network_config = Eth2NetworkConfig::constant(network).unwrap().unwrap(); let spec = &network_config.chain_spec::().unwrap(); - let merge_fork_slot = spec + let bellatrix_fork_slot = spec .bellatrix_fork_epoch .unwrap() .start_slot(E::slots_per_epoch()); @@ -740,14 +740,21 @@ mod tests { listen_port, ) .await - .assert_signatures_match("beacon_block_merge", |pubkey, validator_store| async move { - let mut merge_block = BeaconBlockMerge::empty(spec); - merge_block.slot = merge_fork_slot; - validator_store - .sign_block(pubkey, BeaconBlock::Merge(merge_block), merge_fork_slot) - .await - .unwrap() - }) + .assert_signatures_match( + "beacon_block_bellatrix", + |pubkey, validator_store| async move { + let mut bellatrix_block = BeaconBlockBellatrix::empty(spec); + bellatrix_block.slot = bellatrix_fork_slot; + validator_store + .sign_block( + pubkey, + BeaconBlock::Bellatrix(bellatrix_block), + bellatrix_fork_slot, + ) + .await + .unwrap() + }, + ) .await; } @@ -760,7 +767,7 @@ mod tests { let network_config = Eth2NetworkConfig::constant(network).unwrap().unwrap(); let spec = &network_config.chain_spec::().unwrap(); - let merge_fork_slot = spec + let bellatrix_fork_slot = spec .bellatrix_fork_epoch .unwrap() .start_slot(E::slots_per_epoch()); @@ -797,9 +804,9 @@ mod tests { }; let first_block = || { - let mut merge_block = BeaconBlockMerge::empty(spec); - merge_block.slot = merge_fork_slot; - BeaconBlock::Merge(merge_block) + let mut bellatrix_block = BeaconBlockBellatrix::empty(spec); + bellatrix_block.slot = bellatrix_fork_slot; + BeaconBlock::Bellatrix(bellatrix_block) }; let double_vote_block = || { @@ -914,8 +921,8 @@ mod tests { } #[tokio::test] - async fn sepolia_merge_types() { - test_merge_types("sepolia", 4252).await + async fn sepolia_bellatrix_types() { + test_bellatrix_types("sepolia", 4252).await } #[tokio::test] diff --git a/validator_client/src/signing_method/web3signer.rs b/validator_client/src/signing_method/web3signer.rs index 7973cab2c1e..8ad37a1620a 100644 --- a/validator_client/src/signing_method/web3signer.rs +++ b/validator_client/src/signing_method/web3signer.rs @@ -87,7 +87,7 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload> Web3SignerObject<'a, E, Pa block: Some(block), block_header: None, }), - BeaconBlock::Merge(_) => Ok(Web3SignerObject::BeaconBlock { + BeaconBlock::Bellatrix(_) => Ok(Web3SignerObject::BeaconBlock { version: ForkName::Bellatrix, block: None, block_header: Some(block.block_header()), diff --git a/validator_client/src/validator_store.rs b/validator_client/src/validator_store.rs index 0a00dad9beb..f3bdc2c0f69 100644 --- a/validator_client/src/validator_store.rs +++ b/validator_client/src/validator_store.rs @@ -360,7 +360,7 @@ impl ValidatorStore { fn signing_context(&self, domain: Domain, signing_epoch: Epoch) -> SigningContext { if domain == Domain::VoluntaryExit { match self.spec.fork_name_at_epoch(signing_epoch) { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => { SigningContext { domain, epoch: signing_epoch, diff --git a/watch/src/database/mod.rs b/watch/src/database/mod.rs index 59547c303ab..315fcbc8358 100644 --- a/watch/src/database/mod.rs +++ b/watch/src/database/mod.rs @@ -146,7 +146,7 @@ pub fn insert_beacon_block( let full_payload = block_message.execution_payload().ok(); let transaction_count: Option = if let Some(bellatrix_payload) = - full_payload.and_then(|payload| payload.execution_payload_merge().ok()) + full_payload.and_then(|payload| payload.execution_payload_bellatrix().ok()) { Some(bellatrix_payload.transactions.len() as i32) } else {