From 622204be5603e898b8e476939f5b584c17376a40 Mon Sep 17 00:00:00 2001 From: shane-moore Date: Fri, 26 Sep 2025 16:56:50 -0700 Subject: [PATCH 1/5] gloas envelope helpers --- .../types/src/execution_payload_envelope.rs | 15 ++++++++++++++ .../src/signed_execution_payload_envelope.rs | 20 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/consensus/types/src/execution_payload_envelope.rs b/consensus/types/src/execution_payload_envelope.rs index 50a7ac97299..f04916c4e18 100644 --- a/consensus/types/src/execution_payload_envelope.rs +++ b/consensus/types/src/execution_payload_envelope.rs @@ -4,6 +4,7 @@ use beacon_block_body::KzgCommitments; use derivative::Derivative; use serde::de::{Deserializer, Error as _}; use serde::{Deserialize, Serialize}; +use ssz::{Decode, DecodeError}; use ssz_derive::{Decode, Encode}; use superstruct::superstruct; use test_random_derive::TestRandom; @@ -59,6 +60,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> { @@ -70,6 +72,19 @@ impl<'a, E: EthSpec> ExecutionPayloadEnvelopeRef<'a, E> { } } +impl ExecutionPayloadEnvelope { + /// Custom SSZ decoder that takes a `ForkName` as context. + pub fn from_ssz_bytes_for_fork(bytes: &[u8], fork_name: ForkName) -> Result { + match fork_name { + ForkName::Gloas => ExecutionPayloadEnvelopeGloas::from_ssz_bytes(bytes) + .map(ExecutionPayloadEnvelope::Gloas), + _ => Err(DecodeError::BytesInvalid(format!( + "ExecutionPayloadEnvelope does not support fork {fork_name:?}" + ))), + } + } +} + impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for ExecutionPayloadEnvelope { fn context_deserialize(deserializer: D, context: ForkName) -> Result where diff --git a/consensus/types/src/signed_execution_payload_envelope.rs b/consensus/types/src/signed_execution_payload_envelope.rs index bba7b149fd3..96276a764ba 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), From d5e7f0b7bb3cc4f24a5546c04393f8586db12f96 Mon Sep 17 00:00:00 2001 From: shane-moore Date: Tue, 7 Oct 2025 11:47:59 -0700 Subject: [PATCH 2/5] rename execution_bid to execution_payload_bid --- beacon_node/store/src/partial_beacon_state.rs | 9 ++++++--- consensus/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 ++-- .../{execution_bid.rs => execution_payload_bid.rs} | 9 ++++----- consensus/types/src/lib.rs | 8 ++++---- ...cution_bid.rs => signed_execution_payload_bid.rs} | 12 ++++++------ 8 files changed, 30 insertions(+), 28 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 298291eb4a8..bd9153ecfd0 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 628af7c5c91..d95b42343c7 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 bd47418ad64..87fb2406eae 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 d6c6149b4d9..242fac8888d 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))] @@ -533,7 +533,7 @@ impl From>> voluntary_exits, sync_aggregate, bls_to_execution_changes, - signed_execution_bid, + signed_execution_payload_bid, payload_attestations, _phantom, } = body; @@ -549,7 +549,7 @@ impl From>> voluntary_exits, sync_aggregate, bls_to_execution_changes, - signed_execution_bid, + signed_execution_payload_bid, payload_attestations, _phantom: PhantomData, } @@ -867,7 +867,7 @@ impl From>> voluntary_exits, sync_aggregate, bls_to_execution_changes, - signed_execution_bid, + signed_execution_payload_bid, payload_attestations, _phantom, } = body; @@ -884,7 +884,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 17d56e46447..b4f07b3c612 100644 --- a/consensus/types/src/beacon_state.rs +++ b/consensus/types/src/beacon_state.rs @@ -518,7 +518,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))] @@ -2144,7 +2144,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/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 a3672daeacc..1449dbc90f3 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/lib.rs b/consensus/types/src/lib.rs index 1e8adf50024..63d986055d0 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/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 4be520565a6..58a50977b30 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); } From a187c43a88df08690715e0836ef88a10e8efc0c9 Mon Sep 17 00:00:00 2001 From: shane-moore Date: Wed, 8 Oct 2025 12:32:39 -0700 Subject: [PATCH 3/5] builder_payment_threshold_numerator and builder_payment_threshold_denominator are not configurable but are constants --- consensus/types/src/chain_spec.rs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/consensus/types/src/chain_spec.rs b/consensus/types/src/chain_spec.rs index 92cccf2b6fb..577c7b9d41b 100644 --- a/consensus/types/src/chain_spec.rs +++ b/consensus/types/src/chain_spec.rs @@ -1709,12 +1709,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, @@ -1878,14 +1872,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 @@ -2190,9 +2176,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, @@ -2284,8 +2267,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, @@ -2359,8 +2340,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, From 93dcf05b9f88c73665d2eda20aede8b9598347b5 Mon Sep 17 00:00:00 2001 From: shane-moore Date: Thu, 16 Oct 2025 08:28:49 -0700 Subject: [PATCH 4/5] update payload attestation message signature to be unaggregated type --- consensus/types/src/payload_attestation_message.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/consensus/types/src/payload_attestation_message.rs b/consensus/types/src/payload_attestation_message.rs index 46179e1deac..d1b42cc03f8 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)] From f3e822b277709d6e6098461ba9c9d3d49d47f00b Mon Sep 17 00:00:00 2001 From: shane-moore Date: Thu, 16 Oct 2025 13:51:02 -0700 Subject: [PATCH 5/5] updates per pr review --- consensus/types/src/execution_payload_envelope.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/consensus/types/src/execution_payload_envelope.rs b/consensus/types/src/execution_payload_envelope.rs index f04916c4e18..81539e519a7 100644 --- a/consensus/types/src/execution_payload_envelope.rs +++ b/consensus/types/src/execution_payload_envelope.rs @@ -4,7 +4,6 @@ use beacon_block_body::KzgCommitments; use derivative::Derivative; use serde::de::{Deserializer, Error as _}; use serde::{Deserialize, Serialize}; -use ssz::{Decode, DecodeError}; use ssz_derive::{Decode, Encode}; use superstruct::superstruct; use test_random_derive::TestRandom; @@ -72,19 +71,6 @@ impl<'a, E: EthSpec> ExecutionPayloadEnvelopeRef<'a, E> { } } -impl ExecutionPayloadEnvelope { - /// Custom SSZ decoder that takes a `ForkName` as context. - pub fn from_ssz_bytes_for_fork(bytes: &[u8], fork_name: ForkName) -> Result { - match fork_name { - ForkName::Gloas => ExecutionPayloadEnvelopeGloas::from_ssz_bytes(bytes) - .map(ExecutionPayloadEnvelope::Gloas), - _ => Err(DecodeError::BytesInvalid(format!( - "ExecutionPayloadEnvelope does not support fork {fork_name:?}" - ))), - } - } -} - impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for ExecutionPayloadEnvelope { fn context_deserialize(deserializer: D, context: ForkName) -> Result where