From a3563289c1c1516ba2aa7dc0a410f6834543e2f6 Mon Sep 17 00:00:00 2001 From: shane-moore Date: Mon, 18 Aug 2025 12:21:21 -0700 Subject: [PATCH] additional updates per pr review --- .../src/test_utils/mock_builder.rs | 21 ++++++++++--------- beacon_node/store/src/partial_beacon_state.rs | 4 ---- .../state_processing/src/upgrade/gloas.rs | 12 ++++++----- consensus/types/src/beacon_state.rs | 5 ----- 4 files changed, 18 insertions(+), 24 deletions(-) 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 eef5811f90..5121551545 100644 --- a/beacon_node/execution_layer/src/test_utils/mock_builder.rs +++ b/beacon_node/execution_layer/src/test_utils/mock_builder.rs @@ -439,7 +439,7 @@ impl MockBuilder { block: SignedBlindedBeaconBlock, ) -> Result, String> { let root = match &block { - SignedBlindedBeaconBlock::Base(_) | SignedBlindedBeaconBlock::Altair(_) => { + SignedBlindedBeaconBlock::Base(_) | types::SignedBeaconBlock::Altair(_) => { return Err("invalid fork".to_string()); } SignedBlindedBeaconBlock::Bellatrix(block) => { @@ -846,10 +846,6 @@ impl MockBuilder { // 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::Gloas => { - // TODO(EIP7732) Check if this is how we want to do error handling for gloas - return Err("invalid fork".to_string()); - } ForkName::Bellatrix | ForkName::Capella => PayloadAttributes::new( timestamp, *prev_randao, @@ -857,11 +853,16 @@ impl MockBuilder { expected_withdrawals, None, ), - ForkName::Deneb - | ForkName::Electra - | ForkName::Fulu - | ForkName::Base - | ForkName::Altair => { + ForkName::Deneb | ForkName::Electra | ForkName::Fulu | ForkName::Gloas => { + PayloadAttributes::new( + timestamp, + *prev_randao, + fee_recipient, + expected_withdrawals, + Some(head_block_root), + ) + } + ForkName::Base | ForkName::Altair => { return Err("invalid fork".to_string()); } }; diff --git a/beacon_node/store/src/partial_beacon_state.rs b/beacon_node/store/src/partial_beacon_state.rs index 2d8226bf4c..298291eb4a 100644 --- a/beacon_node/store/src/partial_beacon_state.rs +++ b/beacon_node/store/src/partial_beacon_state.rs @@ -167,9 +167,6 @@ where #[superstruct(only(Gloas))] pub latest_block_hash: ExecutionBlockHash, - #[superstruct(only(Gloas))] - pub latest_full_slot: Slot, - #[superstruct(only(Gloas))] pub latest_withdrawals_root: Hash256, } @@ -500,7 +497,6 @@ impl TryInto> for PartialBeaconState { builder_pending_payments, builder_pending_withdrawals, latest_block_hash, - latest_full_slot, latest_withdrawals_root ], [historical_summaries] diff --git a/consensus/state_processing/src/upgrade/gloas.rs b/consensus/state_processing/src/upgrade/gloas.rs index c2ec8b7600..9fede0a90a 100644 --- a/consensus/state_processing/src/upgrade/gloas.rs +++ b/consensus/state_processing/src/upgrade/gloas.rs @@ -1,8 +1,8 @@ use bls::Hash256; use std::mem; use types::{ - BeaconState, BeaconStateError as Error, BeaconStateGloas, BitVector, ChainSpec, EthSpec, - ExecutionBid, Fork, List, Vector, + BeaconState, BeaconStateError as Error, BeaconStateGloas, BitVector, BuilderPendingPayment, + ChainSpec, EthSpec, ExecutionBid, Fork, List, Vector, }; /// Transform a `Fulu` state into a `Gloas` state. @@ -85,10 +85,12 @@ pub fn upgrade_state_to_gloas( pending_consolidations: pre.pending_consolidations.clone(), // Gloas execution_payload_availability: BitVector::default(), // All bits set to false initially - builder_pending_payments: Vector::default(), // Empty vector initially, - builder_pending_withdrawals: List::default(), // Empty list initially, + builder_pending_payments: Vector::new(vec![ + BuilderPendingPayment::default(); + 2 * E::slots_per_epoch() as usize + ])?, + builder_pending_withdrawals: List::default(), // Empty list initially, latest_block_hash: pre.latest_execution_payload_header.block_hash, - latest_full_slot: pre.slot, latest_withdrawals_root: Hash256::default(), // Caches total_active_balance: pre.total_active_balance, diff --git a/consensus/types/src/beacon_state.rs b/consensus/types/src/beacon_state.rs index 279f2eff18..7a9ba9ba0a 100644 --- a/consensus/types/src/beacon_state.rs +++ b/consensus/types/src/beacon_state.rs @@ -597,11 +597,6 @@ where #[metastruct(exclude_from(tree_lists))] pub latest_block_hash: ExecutionBlockHash, - #[test_random(default)] - #[superstruct(only(Gloas))] - #[metastruct(exclude_from(tree_lists))] - pub latest_full_slot: Slot, - #[test_random(default)] #[superstruct(only(Gloas))] #[metastruct(exclude_from(tree_lists))]