From ccf0fb90780c0f7d2b4629ec3795e5b0b3e05f89 Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Mon, 22 Jun 2026 14:09:29 +0300 Subject: [PATCH] lint fixes --- .../beacon_chain/tests/prepare_payload.rs | 6 ++++-- beacon_node/beacon_chain/tests/store_tests.rs | 2 +- .../src/network_beacon_processor/tests.rs | 8 +++---- consensus/fork_choice/src/fork_choice.rs | 2 +- .../src/per_block_processing.rs | 21 ++++++++++--------- .../process_operations.rs | 4 ---- .../src/builder/builder_deposit_request.rs | 5 +---- testing/ef_tests/src/cases/operations.rs | 15 +++++++------ testing/ef_tests/tests/tests.rs | 14 +++++++++++-- 9 files changed, 41 insertions(+), 36 deletions(-) diff --git a/beacon_node/beacon_chain/tests/prepare_payload.rs b/beacon_node/beacon_chain/tests/prepare_payload.rs index de8bfb3865..ad23b77a55 100644 --- a/beacon_node/beacon_chain/tests/prepare_payload.rs +++ b/beacon_node/beacon_chain/tests/prepare_payload.rs @@ -184,11 +184,13 @@ async fn prepare_payload_generic( // created with eth1 withdrawal credentials in the interop genesis builder. let consolidation_request = harness.make_switch_to_compounding_request(1); - let execution_requests = ExecutionRequests:: { + let execution_requests = ExecutionRequests::Gloas(ExecutionRequestsGloas:: { deposits: VariableList::empty(), withdrawals: VariableList::empty(), consolidations: VariableList::new(vec![consolidation_request]).unwrap(), - }; + builder_deposits: VariableList::empty(), + builder_exits: VariableList::empty(), + }); // Inject the execution requests into the mock EL so the next payload includes them. harness diff --git a/beacon_node/beacon_chain/tests/store_tests.rs b/beacon_node/beacon_chain/tests/store_tests.rs index 4d392ef524..1d7a5995de 100644 --- a/beacon_node/beacon_chain/tests/store_tests.rs +++ b/beacon_node/beacon_chain/tests/store_tests.rs @@ -1485,7 +1485,7 @@ async fn proposer_shuffling_changing_with_lookahead() { target_pubkey: validator_to_topup.pubkey, }; - let execution_requests = ExecutionRequests:: { + let execution_requests = ExecutionRequestsElectra:: { deposits: VariableList::new(vec![deposit_request]).unwrap(), withdrawals: vec![].try_into().unwrap(), consolidations: VariableList::new(vec![consolidation_request]).unwrap(), diff --git a/beacon_node/network/src/network_beacon_processor/tests.rs b/beacon_node/network/src/network_beacon_processor/tests.rs index 6b7c623230..c3cf1b8e1f 100644 --- a/beacon_node/network/src/network_beacon_processor/tests.rs +++ b/beacon_node/network/src/network_beacon_processor/tests.rs @@ -41,13 +41,13 @@ use std::iter::Iterator; use std::sync::Arc; use std::time::Duration; use tokio::sync::mpsc; -use types::data::BlobIdentifier; use types::{ AttesterSlashing, ChainSpec, DataColumnSidecarList, DataColumnSubnetId, Epoch, EthSpec, - ExecutionPayloadEnvelope, ExecutionPayloadGloas, ExecutionRequests, Hash256, MainnetEthSpec, - ProposerSlashing, SignedAggregateAndProof, SignedBeaconBlock, SignedExecutionPayloadEnvelope, + ExecutionPayloadEnvelope, ExecutionPayloadGloas, Hash256, MainnetEthSpec, ProposerSlashing, + SignedAggregateAndProof, SignedBeaconBlock, SignedExecutionPayloadEnvelope, SignedVoluntaryExit, SingleAttestation, Slot, SubnetId, }; +use types::{ExecutionRequestsGloas, data::BlobIdentifier}; type E = MainnetEthSpec; type T = EphemeralHarnessType; @@ -1967,7 +1967,7 @@ fn make_test_payload_envelope( slot_number: slot, ..ExecutionPayloadGloas::default() }, - execution_requests: ExecutionRequests::default(), + execution_requests: ExecutionRequestsGloas::default(), builder_index: 0, beacon_block_root, parent_beacon_block_root: Hash256::ZERO, diff --git a/consensus/fork_choice/src/fork_choice.rs b/consensus/fork_choice/src/fork_choice.rs index aa1c03685e..cf06a8fe13 100644 --- a/consensus/fork_choice/src/fork_choice.rs +++ b/consensus/fork_choice/src/fork_choice.rs @@ -819,7 +819,7 @@ where .get_block(&block.parent_root()) .ok_or_else(|| Error::InvalidBlock(InvalidBlock::UnknownParent(block.parent_root())))?; - // If the block builds on a full payload envelope, the envelope must be known. + // If the block builds on a full payload envelope, the envelope must be known. if let Some(parent_block_hash) = parent_block.execution_payload_block_hash { let builds_on_full = block .body() diff --git a/consensus/state_processing/src/per_block_processing.rs b/consensus/state_processing/src/per_block_processing.rs index 5d293890ee..a1f45044e4 100644 --- a/consensus/state_processing/src/per_block_processing.rs +++ b/consensus/state_processing/src/per_block_processing.rs @@ -192,7 +192,8 @@ pub fn per_block_processing>( let body = block.body(); if state.fork_name_unchecked().gloas_enabled() { withdrawals::gloas::process_withdrawals::(state, spec)?; - process_execution_payload_bid(state, block, verify_signatures, spec)?; + let signed_bid = block.body().signed_execution_payload_bid()?; + process_execution_payload_bid(state, signed_bid, verify_signatures, spec)?; } else { if state.fork_name_unchecked().capella_enabled() { withdrawals::capella_electra::process_withdrawals::( @@ -671,15 +672,13 @@ pub fn settle_builder_payment( Ok(()) } -pub fn process_execution_payload_bid>( +pub fn process_execution_payload_bid( state: &mut BeaconState, - block: BeaconBlockRef<'_, E, Payload>, + signed_bid: &SignedExecutionPayloadBid, verify_signatures: VerifySignatures, spec: &ChainSpec, ) -> Result<(), BlockProcessingError> { // Verify the bid signature - let signed_bid = block.body().signed_execution_payload_bid()?; - let bid = &signed_bid.message; let amount = bid.value; let builder_index = bid.builder_index; @@ -754,10 +753,10 @@ pub fn process_execution_payload_bid // Verify that the bid is for the current slot block_verify!( - bid.slot == block.slot(), + bid.slot == state.slot(), ExecutionPayloadBidInvalid::SlotMismatch { bid_slot: bid.slot, - block_slot: block.slot(), + block_slot: state.slot(), } .into() ); @@ -773,10 +772,11 @@ pub fn process_execution_payload_bid .into() ); + let expected_parent_root = *state.get_block_root(state.slot().safe_sub(1)?)?; block_verify!( - bid.parent_block_root == block.parent_root(), + bid.parent_block_root == expected_parent_root, ExecutionPayloadBidInvalid::ParentBlockRootMismatch { - block_parent_root: block.parent_root(), + block_parent_root: expected_parent_root, bid_parent_root: bid.parent_block_root, } .into() @@ -794,6 +794,7 @@ pub fn process_execution_payload_bid // Record the pending payment if there is some payment if amount > 0 { + let proposer_index = state.get_beacon_proposer_index(state.slot(), spec)? as u64; let pending_payment = BuilderPendingPayment { weight: 0, withdrawal: BuilderPendingWithdrawal { @@ -801,7 +802,7 @@ pub fn process_execution_payload_bid amount, builder_index, }, - proposer_index: block.proposer_index(), + proposer_index, }; let payment_index = E::SlotsPerEpoch::to_usize() 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 354001a75a..f2c900f2a6 100644 --- a/consensus/state_processing/src/per_block_processing/process_operations.rs +++ b/consensus/state_processing/src/per_block_processing/process_operations.rs @@ -4,11 +4,7 @@ use crate::common::{ get_attestation_participation_flag_indices, increase_balance, initiate_validator_exit, slash_validator, }; -use crate::per_block_processing::builder::{ - convert_validator_index_to_builder_index, is_builder_index, -}; use crate::per_block_processing::errors::{BlockProcessingError, ExitInvalid, IntoWithIndex}; -use crate::per_block_processing::signature_sets::{exit_signature_set, get_pubkey_from_state}; use crate::per_block_processing::verify_payload_attestation::verify_payload_attestation; use bls::{PublicKeyBytes, SignatureBytes}; use ssz_types::FixedVector; diff --git a/consensus/types/src/builder/builder_deposit_request.rs b/consensus/types/src/builder/builder_deposit_request.rs index 5b2ab35f02..f57845750d 100644 --- a/consensus/types/src/builder/builder_deposit_request.rs +++ b/consensus/types/src/builder/builder_deposit_request.rs @@ -5,10 +5,7 @@ use ssz::Encode; use ssz_derive::{Decode, Encode}; use tree_hash_derive::TreeHash; -use crate::{ - Address, BeaconStateError, ChainSpec, DepositMessage, Domain, SignedRoot, core::Hash256, - fork::ForkName, -}; +use crate::{ChainSpec, DepositMessage, Domain, SignedRoot, core::Hash256, fork::ForkName}; #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash)] diff --git a/testing/ef_tests/src/cases/operations.rs b/testing/ef_tests/src/cases/operations.rs index 0894b4bfdf..81c8b7bc12 100644 --- a/testing/ef_tests/src/cases/operations.rs +++ b/testing/ef_tests/src/cases/operations.rs @@ -32,8 +32,8 @@ use types::{ BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconBlockBodyElectra, BeaconBlockBodyFulu, BeaconState, BlindedPayload, BuilderDepositRequest, BuilderExitRequest, ConsolidationRequest, Deposit, DepositRequest, ExecutionPayload, ForkVersionDecode, FullPayload, PayloadAttestation, - ProposerSlashing, SignedBlsToExecutionChange, SignedExecutionPayloadEnvelope, - SignedVoluntaryExit, SyncAggregate, WithdrawalRequest, + ProposerSlashing, SignedBlsToExecutionChange, SignedExecutionPayloadBid, + SignedExecutionPayloadEnvelope, SignedVoluntaryExit, SyncAggregate, WithdrawalRequest, }; #[derive(Debug, Clone, Default, Deserialize)] @@ -65,7 +65,7 @@ pub struct VoluntaryExitChurn { /// Newtype for testing execution payload bids. #[derive(Debug, Clone, Deserialize)] pub struct ExecutionPayloadBidBlock { - block: BeaconBlock, + signed_bid: SignedExecutionPayloadBid, } /// Newtype for testing parent execution payload processing. @@ -538,16 +538,15 @@ impl Operation for ExecutionPayloadBidBlock { } fn filename() -> String { - "block.ssz_snappy".into() + "execution_payload_bid.ssz_snappy".into() } fn is_enabled_for_fork(fork_name: ForkName) -> bool { fork_name.gloas_enabled() } - fn decode(path: &Path, _fork_name: ForkName, spec: &ChainSpec) -> Result { - ssz_decode_file_with(path, |bytes| BeaconBlock::from_ssz_bytes(bytes, spec)) - .map(|block| ExecutionPayloadBidBlock { block }) + fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result { + ssz_decode_file(path).map(|signed_bid| ExecutionPayloadBidBlock { signed_bid }) } fn apply_to( @@ -556,7 +555,7 @@ impl Operation for ExecutionPayloadBidBlock { spec: &ChainSpec, _: &Operations, ) -> Result<(), BlockProcessingError> { - process_execution_payload_bid(state, self.block.to_ref(), VerifySignatures::True, spec)?; + process_execution_payload_bid(state, &self.signed_bid, VerifySignatures::True, spec)?; Ok(()) } } diff --git a/testing/ef_tests/tests/tests.rs b/testing/ef_tests/tests/tests.rs index 0aa4f08c5a..e5b65aff97 100644 --- a/testing/ef_tests/tests/tests.rs +++ b/testing/ef_tests/tests/tests.rs @@ -805,9 +805,19 @@ mod ssz_static { #[test] fn execution_requests() { - SszStaticHandler::, MainnetEthSpec>::electra_and_later() + SszStaticHandler::, MainnetEthSpec>::electra_only( + ) + .run(); + SszStaticHandler::, MinimalEthSpec>::electra_only( + ) + .run(); + SszStaticHandler::, MainnetEthSpec>::fulu_only() .run(); - SszStaticHandler::, MinimalEthSpec>::electra_and_later() + SszStaticHandler::, MinimalEthSpec>::fulu_only() + .run(); + SszStaticHandler::, MainnetEthSpec>::gloas_only() + .run(); + SszStaticHandler::, MinimalEthSpec>::gloas_only() .run(); }