lint fixes

This commit is contained in:
Eitan Seri-Levi
2026-06-22 14:09:29 +03:00
parent e02ba146c9
commit ccf0fb9078
9 changed files with 41 additions and 36 deletions

View File

@@ -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::<E> {
let execution_requests = ExecutionRequests::Gloas(ExecutionRequestsGloas::<E> {
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

View File

@@ -1485,7 +1485,7 @@ async fn proposer_shuffling_changing_with_lookahead() {
target_pubkey: validator_to_topup.pubkey,
};
let execution_requests = ExecutionRequests::<E> {
let execution_requests = ExecutionRequestsElectra::<E> {
deposits: VariableList::new(vec![deposit_request]).unwrap(),
withdrawals: vec![].try_into().unwrap(),
consolidations: VariableList::new(vec![consolidation_request]).unwrap(),

View File

@@ -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<E>;
@@ -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,

View File

@@ -192,7 +192,8 @@ pub fn per_block_processing<E: EthSpec, Payload: AbstractExecPayload<E>>(
let body = block.body();
if state.fork_name_unchecked().gloas_enabled() {
withdrawals::gloas::process_withdrawals::<E>(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::<E, Payload>(
@@ -671,15 +672,13 @@ pub fn settle_builder_payment<E: EthSpec>(
Ok(())
}
pub fn process_execution_payload_bid<E: EthSpec, Payload: AbstractExecPayload<E>>(
pub fn process_execution_payload_bid<E: EthSpec>(
state: &mut BeaconState<E>,
block: BeaconBlockRef<'_, E, Payload>,
signed_bid: &SignedExecutionPayloadBid<E>,
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<E: EthSpec, Payload: AbstractExecPayload<E>
// 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<E: EthSpec, Payload: AbstractExecPayload<E>
.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<E: EthSpec, Payload: AbstractExecPayload<E>
// 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<E: EthSpec, Payload: AbstractExecPayload<E>
amount,
builder_index,
},
proposer_index: block.proposer_index(),
proposer_index,
};
let payment_index = E::SlotsPerEpoch::to_usize()

View File

@@ -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;

View File

@@ -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)]

View File

@@ -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<E: EthSpec> {
block: BeaconBlock<E>,
signed_bid: SignedExecutionPayloadBid<E>,
}
/// Newtype for testing parent execution payload processing.
@@ -538,16 +538,15 @@ impl<E: EthSpec> Operation<E> for ExecutionPayloadBidBlock<E> {
}
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<Self, Error> {
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<Self, Error> {
ssz_decode_file(path).map(|signed_bid| ExecutionPayloadBidBlock { signed_bid })
}
fn apply_to(
@@ -556,7 +555,7 @@ impl<E: EthSpec> Operation<E> for ExecutionPayloadBidBlock<E> {
spec: &ChainSpec,
_: &Operations<E, Self>,
) -> 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(())
}
}

View File

@@ -805,9 +805,19 @@ mod ssz_static {
#[test]
fn execution_requests() {
SszStaticHandler::<ExecutionRequests<MainnetEthSpec>, MainnetEthSpec>::electra_and_later()
SszStaticHandler::<ExecutionRequestsElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only(
)
.run();
SszStaticHandler::<ExecutionRequests<MinimalEthSpec>, MinimalEthSpec>::electra_and_later()
SszStaticHandler::<ExecutionRequestsElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
)
.run();
SszStaticHandler::<ExecutionRequestsElectra<MainnetEthSpec>, MainnetEthSpec>::fulu_only()
.run();
SszStaticHandler::<ExecutionRequestsElectra<MinimalEthSpec>, MinimalEthSpec>::fulu_only()
.run();
SszStaticHandler::<ExecutionRequestsGloas<MainnetEthSpec>, MainnetEthSpec>::gloas_only()
.run();
SszStaticHandler::<ExecutionRequestsGloas<MinimalEthSpec>, MinimalEthSpec>::gloas_only()
.run();
}