Payload builder version

This commit is contained in:
Eitan Seri-Levi
2026-06-21 17:57:16 +03:00
parent e35a96cc1c
commit affdfb0d13
10 changed files with 49 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ use state_processing::signature_sets::{
use tracing::debug;
use types::{
BeaconState, ChainSpec, EthSpec, ExecutionPayloadBid, SignedExecutionPayloadBid,
SignedProposerPreferences, Slot,
SignedProposerPreferences, Slot, consts::gloas::PAYLOAD_BUILDER_VERSION,
};
/// Verify that an execution payload bid is consistent with the current chain state
@@ -64,6 +64,14 @@ pub(crate) fn verify_bid_consistency<E: EthSpec>(
return Err(PayloadBidError::InvalidBuilder { builder_index });
}
let builder_version = head_state.get_builder(builder_index)?.version;
if builder_version != PAYLOAD_BUILDER_VERSION {
return Err(PayloadBidError::InvalidBuilderVersion {
builder_index,
version: builder_version,
});
}
if !head_state.can_builder_cover_bid(builder_index, bid.value, spec)? {
return Err(PayloadBidError::BuilderCantCoverBid {
builder_index,

View File

@@ -30,6 +30,8 @@ pub enum PayloadBidError {
BuilderAlreadySeen { builder_index: u64, slot: Slot },
/// Builder is not valid/active for the given epoch
InvalidBuilder { builder_index: u64 },
/// The builder's version is not `PAYLOAD_BUILDER_VERSION`.
InvalidBuilderVersion { builder_index: u64, version: u8 },
/// The bid value is lower than the currently cached bid.
BidValueBelowCached {
cached_value: u64,

View File

@@ -16,6 +16,7 @@ use types::{
Address, ChainSpec, Checkpoint, Domain, Epoch, EthSpec, ExecutionBlockHash,
ExecutionPayloadBid, Hash256, MinimalEthSpec, ProposerPreferences, SignedBeaconBlock,
SignedExecutionPayloadBid, SignedProposerPreferences, SignedRoot, Slot,
consts::gloas::PAYLOAD_BUILDER_VERSION,
};
use proto_array::{Block as ProtoBlock, ExecutionStatus, PayloadStatus};
@@ -86,6 +87,7 @@ impl TestContext {
state
.add_builder_to_registry(
PublicKeyBytes::from(keypair.pk.clone()),
PAYLOAD_BUILDER_VERSION,
creds,
BUILDER_BALANCE,
Slot::new(0),
@@ -117,6 +119,7 @@ impl TestContext {
let inactive_builder_index = state
.add_builder_to_registry(
PublicKeyBytes::from(inactive_keypair.pk.clone()),
PAYLOAD_BUILDER_VERSION,
inactive_creds,
BUILDER_BALANCE,
Slot::new(E::slots_per_epoch()),

View File

@@ -4021,10 +4021,11 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
Err(
PayloadBidError::BadSignature
| PayloadBidError::InvalidBuilder { .. }
| PayloadBidError::InvalidBuilderVersion { .. }
| PayloadBidError::InvalidFeeRecipient
| PayloadBidError::ExecutionPaymentNonZero { .. }
| PayloadBidError::InvalidBlobKzgCommitments { .. }
| PayloadBidError::BidNotDescendantOfParent { .. },
| PayloadBidError::BidNotDescendantOfParent { .. }
| PayloadBidError::InvalidPrevRandao { .. },
) => {
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Reject);