From 76cb8d59e658cfb62b028d9315d958cecc1a9b83 Mon Sep 17 00:00:00 2001 From: Shane K Moore <41407272+shane-moore@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:28:49 -0400 Subject: [PATCH] Gloas containers additions (#8227) * gloas envelope helpers * rename execution_bid to execution_payload_bid * builder_payment_threshold_numerator and builder_payment_threshold_denominator are not configurable but are constants * update payload attestation message signature to be unaggregated type * updates per pr review --- beacon_node/store/src/partial_beacon_state.rs | 9 +++++--- .../state_processing/src/upgrade/gloas.rs | 4 ++-- consensus/types/src/beacon_block.rs | 2 +- consensus/types/src/beacon_block_body.rs | 10 ++++----- consensus/types/src/beacon_state.rs | 4 ++-- consensus/types/src/chain_spec.rs | 21 ------------------- ...cution_bid.rs => execution_payload_bid.rs} | 9 ++++---- .../types/src/execution_payload_envelope.rs | 1 + consensus/types/src/lib.rs | 8 +++---- .../types/src/payload_attestation_message.rs | 2 +- ...bid.rs => signed_execution_payload_bid.rs} | 12 +++++------ .../src/signed_execution_payload_envelope.rs | 20 ++++++++++++++++++ 12 files changed, 52 insertions(+), 50 deletions(-) rename consensus/types/src/{execution_bid.rs => execution_payload_bid.rs} (74%) rename consensus/types/src/{signed_execution_bid.rs => signed_execution_payload_bid.rs} (65%) diff --git a/beacon_node/store/src/partial_beacon_state.rs b/beacon_node/store/src/partial_beacon_state.rs index 298291eb4a..bd9153ecfd 100644 --- a/beacon_node/store/src/partial_beacon_state.rs +++ b/beacon_node/store/src/partial_beacon_state.rs @@ -116,8 +116,11 @@ where )] pub latest_execution_payload_header: ExecutionPayloadHeaderFulu, - #[superstruct(only(Gloas), partial_getter(rename = "latest_execution_bid_gloas"))] - pub latest_execution_bid: ExecutionBid, + #[superstruct( + only(Gloas), + partial_getter(rename = "latest_execution_payload_bid_gloas") + )] + pub latest_execution_payload_bid: ExecutionPayloadBid, // Capella #[superstruct(only(Capella, Deneb, Electra, Fulu, Gloas))] @@ -480,7 +483,7 @@ impl TryInto> for PartialBeaconState { current_sync_committee, next_sync_committee, inactivity_scores, - latest_execution_bid, + latest_execution_payload_bid, next_withdrawal_index, next_withdrawal_validator_index, deposit_requests_start_index, diff --git a/consensus/state_processing/src/upgrade/gloas.rs b/consensus/state_processing/src/upgrade/gloas.rs index 628af7c5c9..d95b42343c 100644 --- a/consensus/state_processing/src/upgrade/gloas.rs +++ b/consensus/state_processing/src/upgrade/gloas.rs @@ -2,7 +2,7 @@ use bls::Hash256; use std::mem; use types::{ BeaconState, BeaconStateError as Error, BeaconStateGloas, BitVector, BuilderPendingPayment, - ChainSpec, EthSpec, ExecutionBid, Fork, List, Vector, + ChainSpec, EthSpec, ExecutionPayloadBid, Fork, List, Vector, }; /// Transform a `Fulu` state into a `Gloas` state. @@ -68,7 +68,7 @@ pub fn upgrade_state_to_gloas( current_sync_committee: pre.current_sync_committee.clone(), next_sync_committee: pre.next_sync_committee.clone(), // Execution Bid - latest_execution_bid: ExecutionBid::default(), + latest_execution_payload_bid: ExecutionPayloadBid::default(), // Capella next_withdrawal_index: pre.next_withdrawal_index, next_withdrawal_validator_index: pre.next_withdrawal_validator_index, diff --git a/consensus/types/src/beacon_block.rs b/consensus/types/src/beacon_block.rs index 9bffedec22..01882d588a 100644 --- a/consensus/types/src/beacon_block.rs +++ b/consensus/types/src/beacon_block.rs @@ -673,7 +673,7 @@ impl> EmptyBlock for BeaconBlockGloa voluntary_exits: VariableList::empty(), sync_aggregate: SyncAggregate::empty(), bls_to_execution_changes: VariableList::empty(), - signed_execution_bid: SignedExecutionBid::empty(), + signed_execution_payload_bid: SignedExecutionPayloadBid::empty(), payload_attestations: VariableList::empty(), _phantom: PhantomData, }, diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index 3069ffbcd1..41d979b7f7 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -135,7 +135,7 @@ pub struct BeaconBlockBody = FullPay #[superstruct(only(Electra, Fulu))] pub execution_requests: ExecutionRequests, #[superstruct(only(Gloas))] - pub signed_execution_bid: SignedExecutionBid, + pub signed_execution_payload_bid: SignedExecutionPayloadBid, #[superstruct(only(Gloas))] pub payload_attestations: VariableList, E::MaxPayloadAttestations>, #[superstruct(only(Base, Altair, Gloas))] @@ -521,7 +521,7 @@ impl From>> voluntary_exits, sync_aggregate, bls_to_execution_changes, - signed_execution_bid, + signed_execution_payload_bid, payload_attestations, _phantom, } = body; @@ -537,7 +537,7 @@ impl From>> voluntary_exits, sync_aggregate, bls_to_execution_changes, - signed_execution_bid, + signed_execution_payload_bid, payload_attestations, _phantom: PhantomData, } @@ -855,7 +855,7 @@ impl From>> voluntary_exits, sync_aggregate, bls_to_execution_changes, - signed_execution_bid, + signed_execution_payload_bid, payload_attestations, _phantom, } = body; @@ -872,7 +872,7 @@ impl From>> voluntary_exits, sync_aggregate, bls_to_execution_changes, - signed_execution_bid, + signed_execution_payload_bid, payload_attestations, _phantom: PhantomData, }, diff --git a/consensus/types/src/beacon_state.rs b/consensus/types/src/beacon_state.rs index 2d1eab2e1e..085b2fb988 100644 --- a/consensus/types/src/beacon_state.rs +++ b/consensus/types/src/beacon_state.rs @@ -532,7 +532,7 @@ where pub latest_execution_payload_header: ExecutionPayloadHeaderFulu, #[superstruct(only(Gloas))] #[metastruct(exclude_from(tree_lists))] - pub latest_execution_bid: ExecutionBid, + pub latest_execution_payload_bid: ExecutionPayloadBid, #[superstruct(only(Capella, Deneb, Electra, Fulu, Gloas), partial_getter(copy))] #[serde(with = "serde_utils::quoted_u64")] #[metastruct(exclude_from(tree_lists))] @@ -2214,7 +2214,7 @@ impl BeaconState { | BeaconState::Electra(_) | BeaconState::Fulu(_) => true, BeaconState::Gloas(state) => { - state.latest_execution_bid.block_hash == state.latest_block_hash + state.latest_execution_payload_bid.block_hash == state.latest_block_hash } } } diff --git a/consensus/types/src/chain_spec.rs b/consensus/types/src/chain_spec.rs index 364dc6c731..1e4c477386 100644 --- a/consensus/types/src/chain_spec.rs +++ b/consensus/types/src/chain_spec.rs @@ -1737,12 +1737,6 @@ pub struct Config { #[serde(serialize_with = "serialize_fork_epoch")] #[serde(deserialize_with = "deserialize_fork_epoch")] pub gloas_fork_epoch: Option>, - #[serde(default = "default_builder_payment_threshold_numerator")] - #[serde(with = "serde_utils::quoted_u64")] - pub builder_payment_threshold_numerator: u64, - #[serde(default = "default_builder_payment_threshold_denominator")] - #[serde(with = "serde_utils::quoted_u64")] - pub builder_payment_threshold_denominator: u64, #[serde(with = "serde_utils::quoted_u64")] seconds_per_slot: u64, @@ -1906,14 +1900,6 @@ fn default_gloas_fork_version() -> [u8; 4] { [0xff, 0xff, 0xff, 0xff] } -fn default_builder_payment_threshold_numerator() -> u64 { - 6 -} - -fn default_builder_payment_threshold_denominator() -> u64 { - 10 -} - /// Placeholder value: 2^256-2^10 (115792089237316195423570985008687907853269984665640564039457584007913129638912). /// /// Taken from https://github.com/ethereum/consensus-specs/blob/d5e4828aecafaf1c57ef67a5f23c4ae7b08c5137/configs/mainnet.yaml#L15-L16 @@ -2218,9 +2204,6 @@ impl Config { .gloas_fork_epoch .map(|epoch| MaybeQuoted { value: epoch }), - builder_payment_threshold_numerator: spec.builder_payment_threshold_numerator, - builder_payment_threshold_denominator: spec.builder_payment_threshold_denominator, - seconds_per_slot: spec.seconds_per_slot, seconds_per_eth1_block: spec.seconds_per_eth1_block, min_validator_withdrawability_delay: spec.min_validator_withdrawability_delay, @@ -2312,8 +2295,6 @@ impl Config { fulu_fork_version, gloas_fork_version, gloas_fork_epoch, - builder_payment_threshold_numerator, - builder_payment_threshold_denominator, seconds_per_slot, seconds_per_eth1_block, min_validator_withdrawability_delay, @@ -2387,8 +2368,6 @@ impl Config { fulu_fork_version, gloas_fork_version, gloas_fork_epoch: gloas_fork_epoch.map(|q| q.value), - builder_payment_threshold_numerator, - builder_payment_threshold_denominator, seconds_per_slot, seconds_per_eth1_block, min_validator_withdrawability_delay, diff --git a/consensus/types/src/execution_bid.rs b/consensus/types/src/execution_payload_bid.rs similarity index 74% rename from consensus/types/src/execution_bid.rs rename to consensus/types/src/execution_payload_bid.rs index a3672daeac..1449dbc90f 100644 --- a/consensus/types/src/execution_bid.rs +++ b/consensus/types/src/execution_payload_bid.rs @@ -11,9 +11,8 @@ use tree_hash_derive::TreeHash; #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derivative(PartialEq, Hash)] #[context_deserialize(ForkName)] -// This is what Potuz' spec calls an `ExecutionPayloadHeader` even though it's clearly a bid. -// https://github.com/ethereum/consensus-specs/blob/bba2c7be148d6d921d2ca5e1cc528f5daaf456d9/specs/gloas/beacon-chain.md#executionpayloadheader -pub struct ExecutionBid { +// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#executionpayloadbid +pub struct ExecutionPayloadBid { pub parent_block_hash: ExecutionBlockHash, pub parent_block_root: Hash256, pub block_hash: ExecutionBlockHash, @@ -29,11 +28,11 @@ pub struct ExecutionBid { pub blob_kzg_commitments_root: Hash256, } -impl SignedRoot for ExecutionBid {} +impl SignedRoot for ExecutionPayloadBid {} #[cfg(test)] mod tests { use super::*; - ssz_and_tree_hash_tests!(ExecutionBid); + ssz_and_tree_hash_tests!(ExecutionPayloadBid); } diff --git a/consensus/types/src/execution_payload_envelope.rs b/consensus/types/src/execution_payload_envelope.rs index 50a7ac9729..81539e519a 100644 --- a/consensus/types/src/execution_payload_envelope.rs +++ b/consensus/types/src/execution_payload_envelope.rs @@ -59,6 +59,7 @@ pub struct ExecutionPayloadEnvelope { pub state_root: Hash256, } +impl SignedRoot for ExecutionPayloadEnvelope {} impl<'a, E: EthSpec> SignedRoot for ExecutionPayloadEnvelopeRef<'a, E> {} impl<'a, E: EthSpec> ExecutionPayloadEnvelopeRef<'a, E> { diff --git a/consensus/types/src/lib.rs b/consensus/types/src/lib.rs index 1e8adf5002..63d986055d 100644 --- a/consensus/types/src/lib.rs +++ b/consensus/types/src/lib.rs @@ -42,9 +42,9 @@ pub mod dumb_macros; pub mod enr_fork_id; pub mod eth1_data; pub mod eth_spec; -pub mod execution_bid; pub mod execution_block_hash; pub mod execution_payload; +pub mod execution_payload_bid; pub mod execution_payload_envelope; pub mod execution_payload_header; pub mod fork; @@ -77,7 +77,7 @@ pub mod signed_beacon_block; pub mod signed_beacon_block_header; pub mod signed_bls_to_execution_change; pub mod signed_contribution_and_proof; -pub mod signed_execution_bid; +pub mod signed_execution_payload_bid; pub mod signed_execution_payload_envelope; pub mod signed_voluntary_exit; pub mod signing_data; @@ -178,7 +178,6 @@ pub use crate::enr_fork_id::EnrForkId; pub use crate::epoch_cache::{EpochCache, EpochCacheError, EpochCacheKey}; pub use crate::eth_spec::EthSpecId; pub use crate::eth1_data::Eth1Data; -pub use crate::execution_bid::ExecutionBid; pub use crate::execution_block_hash::ExecutionBlockHash; pub use crate::execution_block_header::{EncodableExecutionBlockHeader, ExecutionBlockHeader}; pub use crate::execution_payload::{ @@ -186,6 +185,7 @@ pub use crate::execution_payload::{ ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionPayloadGloas, ExecutionPayloadRef, Transaction, Transactions, Withdrawals, }; +pub use crate::execution_payload_bid::ExecutionPayloadBid; pub use crate::execution_payload_envelope::{ ExecutionPayloadEnvelope, ExecutionPayloadEnvelopeGloas, ExecutionPayloadEnvelopeNextFork, ExecutionPayloadEnvelopeRef, @@ -266,7 +266,7 @@ pub use crate::signed_beacon_block::{ pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader; pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange; pub use crate::signed_contribution_and_proof::SignedContributionAndProof; -pub use crate::signed_execution_bid::SignedExecutionBid; +pub use crate::signed_execution_payload_bid::SignedExecutionPayloadBid; pub use crate::signed_execution_payload_envelope::SignedExecutionPayloadEnvelope; pub use crate::signed_voluntary_exit::SignedVoluntaryExit; pub use crate::signing_data::{SignedRoot, SigningData}; diff --git a/consensus/types/src/payload_attestation_message.rs b/consensus/types/src/payload_attestation_message.rs index 46179e1dea..d1b42cc03f 100644 --- a/consensus/types/src/payload_attestation_message.rs +++ b/consensus/types/src/payload_attestation_message.rs @@ -12,7 +12,7 @@ pub struct PayloadAttestationMessage { #[serde(with = "serde_utils::quoted_u64")] pub validator_index: u64, pub data: PayloadAttestationData, - pub signature: AggregateSignature, + pub signature: Signature, } #[cfg(test)] diff --git a/consensus/types/src/signed_execution_bid.rs b/consensus/types/src/signed_execution_payload_bid.rs similarity index 65% rename from consensus/types/src/signed_execution_bid.rs rename to consensus/types/src/signed_execution_payload_bid.rs index 4be520565a..58a50977b3 100644 --- a/consensus/types/src/signed_execution_bid.rs +++ b/consensus/types/src/signed_execution_payload_bid.rs @@ -12,16 +12,16 @@ use tree_hash_derive::TreeHash; #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derivative(PartialEq, Hash)] #[context_deserialize(ForkName)] -// https://github.com/ethereum/consensus-specs/blob/bba2c7be148d6d921d2ca5e1cc528f5daaf456d9/specs/gloas/beacon-chain.md#signedexecutionpayloadheader -pub struct SignedExecutionBid { - pub message: ExecutionBid, +// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#signedexecutionpayloadbid +pub struct SignedExecutionPayloadBid { + pub message: ExecutionPayloadBid, pub signature: Signature, } -impl SignedExecutionBid { +impl SignedExecutionPayloadBid { pub fn empty() -> Self { Self { - message: ExecutionBid::default(), + message: ExecutionPayloadBid::default(), signature: Signature::empty(), } } @@ -31,5 +31,5 @@ impl SignedExecutionBid { mod tests { use super::*; - ssz_and_tree_hash_tests!(SignedExecutionBid); + ssz_and_tree_hash_tests!(SignedExecutionPayloadBid); } diff --git a/consensus/types/src/signed_execution_payload_envelope.rs b/consensus/types/src/signed_execution_payload_envelope.rs index bba7b149fd..96276a764b 100644 --- a/consensus/types/src/signed_execution_payload_envelope.rs +++ b/consensus/types/src/signed_execution_payload_envelope.rs @@ -48,6 +48,26 @@ pub struct SignedExecutionPayloadEnvelope { } impl SignedExecutionPayloadEnvelope { + /// Create a new `SignedExecutionPayloadEnvelope` from an `ExecutionPayloadEnvelope` and `Signature`. + pub fn from_envelope(envelope: ExecutionPayloadEnvelope, signature: Signature) -> Self { + match envelope { + ExecutionPayloadEnvelope::Gloas(message) => SignedExecutionPayloadEnvelope::Gloas( + signed_execution_payload_envelope::SignedExecutionPayloadEnvelopeGloas { + message, + signature, + }, + ), + ExecutionPayloadEnvelope::NextFork(message) => { + SignedExecutionPayloadEnvelope::NextFork( + signed_execution_payload_envelope::SignedExecutionPayloadEnvelopeNextFork { + message, + signature, + }, + ) + } + } + } + pub fn message(&self) -> ExecutionPayloadEnvelopeRef<'_, E> { match self { Self::Gloas(signed) => ExecutionPayloadEnvelopeRef::Gloas(&signed.message),