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
This commit is contained in:
Shane K Moore
2025-10-21 12:28:49 -04:00
committed by GitHub
parent fa39549cc3
commit 76cb8d59e6
12 changed files with 52 additions and 50 deletions

View File

@@ -116,8 +116,11 @@ where
)] )]
pub latest_execution_payload_header: ExecutionPayloadHeaderFulu<E>, pub latest_execution_payload_header: ExecutionPayloadHeaderFulu<E>,
#[superstruct(only(Gloas), partial_getter(rename = "latest_execution_bid_gloas"))] #[superstruct(
pub latest_execution_bid: ExecutionBid, only(Gloas),
partial_getter(rename = "latest_execution_payload_bid_gloas")
)]
pub latest_execution_payload_bid: ExecutionPayloadBid,
// Capella // Capella
#[superstruct(only(Capella, Deneb, Electra, Fulu, Gloas))] #[superstruct(only(Capella, Deneb, Electra, Fulu, Gloas))]
@@ -480,7 +483,7 @@ impl<E: EthSpec> TryInto<BeaconState<E>> for PartialBeaconState<E> {
current_sync_committee, current_sync_committee,
next_sync_committee, next_sync_committee,
inactivity_scores, inactivity_scores,
latest_execution_bid, latest_execution_payload_bid,
next_withdrawal_index, next_withdrawal_index,
next_withdrawal_validator_index, next_withdrawal_validator_index,
deposit_requests_start_index, deposit_requests_start_index,

View File

@@ -2,7 +2,7 @@ use bls::Hash256;
use std::mem; use std::mem;
use types::{ use types::{
BeaconState, BeaconStateError as Error, BeaconStateGloas, BitVector, BuilderPendingPayment, 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. /// Transform a `Fulu` state into a `Gloas` state.
@@ -68,7 +68,7 @@ pub fn upgrade_state_to_gloas<E: EthSpec>(
current_sync_committee: pre.current_sync_committee.clone(), current_sync_committee: pre.current_sync_committee.clone(),
next_sync_committee: pre.next_sync_committee.clone(), next_sync_committee: pre.next_sync_committee.clone(),
// Execution Bid // Execution Bid
latest_execution_bid: ExecutionBid::default(), latest_execution_payload_bid: ExecutionPayloadBid::default(),
// Capella // Capella
next_withdrawal_index: pre.next_withdrawal_index, next_withdrawal_index: pre.next_withdrawal_index,
next_withdrawal_validator_index: pre.next_withdrawal_validator_index, next_withdrawal_validator_index: pre.next_withdrawal_validator_index,

View File

@@ -673,7 +673,7 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockGloa
voluntary_exits: VariableList::empty(), voluntary_exits: VariableList::empty(),
sync_aggregate: SyncAggregate::empty(), sync_aggregate: SyncAggregate::empty(),
bls_to_execution_changes: VariableList::empty(), bls_to_execution_changes: VariableList::empty(),
signed_execution_bid: SignedExecutionBid::empty(), signed_execution_payload_bid: SignedExecutionPayloadBid::empty(),
payload_attestations: VariableList::empty(), payload_attestations: VariableList::empty(),
_phantom: PhantomData, _phantom: PhantomData,
}, },

View File

@@ -135,7 +135,7 @@ pub struct BeaconBlockBody<E: EthSpec, Payload: AbstractExecPayload<E> = FullPay
#[superstruct(only(Electra, Fulu))] #[superstruct(only(Electra, Fulu))]
pub execution_requests: ExecutionRequests<E>, pub execution_requests: ExecutionRequests<E>,
#[superstruct(only(Gloas))] #[superstruct(only(Gloas))]
pub signed_execution_bid: SignedExecutionBid, pub signed_execution_payload_bid: SignedExecutionPayloadBid,
#[superstruct(only(Gloas))] #[superstruct(only(Gloas))]
pub payload_attestations: VariableList<PayloadAttestation<E>, E::MaxPayloadAttestations>, pub payload_attestations: VariableList<PayloadAttestation<E>, E::MaxPayloadAttestations>,
#[superstruct(only(Base, Altair, Gloas))] #[superstruct(only(Base, Altair, Gloas))]
@@ -521,7 +521,7 @@ impl<E: EthSpec> From<BeaconBlockBodyGloas<E, BlindedPayload<E>>>
voluntary_exits, voluntary_exits,
sync_aggregate, sync_aggregate,
bls_to_execution_changes, bls_to_execution_changes,
signed_execution_bid, signed_execution_payload_bid,
payload_attestations, payload_attestations,
_phantom, _phantom,
} = body; } = body;
@@ -537,7 +537,7 @@ impl<E: EthSpec> From<BeaconBlockBodyGloas<E, BlindedPayload<E>>>
voluntary_exits, voluntary_exits,
sync_aggregate, sync_aggregate,
bls_to_execution_changes, bls_to_execution_changes,
signed_execution_bid, signed_execution_payload_bid,
payload_attestations, payload_attestations,
_phantom: PhantomData, _phantom: PhantomData,
} }
@@ -855,7 +855,7 @@ impl<E: EthSpec> From<BeaconBlockBodyGloas<E, FullPayload<E>>>
voluntary_exits, voluntary_exits,
sync_aggregate, sync_aggregate,
bls_to_execution_changes, bls_to_execution_changes,
signed_execution_bid, signed_execution_payload_bid,
payload_attestations, payload_attestations,
_phantom, _phantom,
} = body; } = body;
@@ -872,7 +872,7 @@ impl<E: EthSpec> From<BeaconBlockBodyGloas<E, FullPayload<E>>>
voluntary_exits, voluntary_exits,
sync_aggregate, sync_aggregate,
bls_to_execution_changes, bls_to_execution_changes,
signed_execution_bid, signed_execution_payload_bid,
payload_attestations, payload_attestations,
_phantom: PhantomData, _phantom: PhantomData,
}, },

View File

@@ -532,7 +532,7 @@ where
pub latest_execution_payload_header: ExecutionPayloadHeaderFulu<E>, pub latest_execution_payload_header: ExecutionPayloadHeaderFulu<E>,
#[superstruct(only(Gloas))] #[superstruct(only(Gloas))]
#[metastruct(exclude_from(tree_lists))] #[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))] #[superstruct(only(Capella, Deneb, Electra, Fulu, Gloas), partial_getter(copy))]
#[serde(with = "serde_utils::quoted_u64")] #[serde(with = "serde_utils::quoted_u64")]
#[metastruct(exclude_from(tree_lists))] #[metastruct(exclude_from(tree_lists))]
@@ -2214,7 +2214,7 @@ impl<E: EthSpec> BeaconState<E> {
| BeaconState::Electra(_) | BeaconState::Electra(_)
| BeaconState::Fulu(_) => true, | BeaconState::Fulu(_) => true,
BeaconState::Gloas(state) => { BeaconState::Gloas(state) => {
state.latest_execution_bid.block_hash == state.latest_block_hash state.latest_execution_payload_bid.block_hash == state.latest_block_hash
} }
} }
} }

View File

@@ -1737,12 +1737,6 @@ pub struct Config {
#[serde(serialize_with = "serialize_fork_epoch")] #[serde(serialize_with = "serialize_fork_epoch")]
#[serde(deserialize_with = "deserialize_fork_epoch")] #[serde(deserialize_with = "deserialize_fork_epoch")]
pub gloas_fork_epoch: Option<MaybeQuoted<Epoch>>, pub gloas_fork_epoch: Option<MaybeQuoted<Epoch>>,
#[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")] #[serde(with = "serde_utils::quoted_u64")]
seconds_per_slot: u64, seconds_per_slot: u64,
@@ -1906,14 +1900,6 @@ fn default_gloas_fork_version() -> [u8; 4] {
[0xff, 0xff, 0xff, 0xff] [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). /// Placeholder value: 2^256-2^10 (115792089237316195423570985008687907853269984665640564039457584007913129638912).
/// ///
/// Taken from https://github.com/ethereum/consensus-specs/blob/d5e4828aecafaf1c57ef67a5f23c4ae7b08c5137/configs/mainnet.yaml#L15-L16 /// Taken from https://github.com/ethereum/consensus-specs/blob/d5e4828aecafaf1c57ef67a5f23c4ae7b08c5137/configs/mainnet.yaml#L15-L16
@@ -2218,9 +2204,6 @@ impl Config {
.gloas_fork_epoch .gloas_fork_epoch
.map(|epoch| MaybeQuoted { value: 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_slot: spec.seconds_per_slot,
seconds_per_eth1_block: spec.seconds_per_eth1_block, seconds_per_eth1_block: spec.seconds_per_eth1_block,
min_validator_withdrawability_delay: spec.min_validator_withdrawability_delay, min_validator_withdrawability_delay: spec.min_validator_withdrawability_delay,
@@ -2312,8 +2295,6 @@ impl Config {
fulu_fork_version, fulu_fork_version,
gloas_fork_version, gloas_fork_version,
gloas_fork_epoch, gloas_fork_epoch,
builder_payment_threshold_numerator,
builder_payment_threshold_denominator,
seconds_per_slot, seconds_per_slot,
seconds_per_eth1_block, seconds_per_eth1_block,
min_validator_withdrawability_delay, min_validator_withdrawability_delay,
@@ -2387,8 +2368,6 @@ impl Config {
fulu_fork_version, fulu_fork_version,
gloas_fork_version, gloas_fork_version,
gloas_fork_epoch: gloas_fork_epoch.map(|q| q.value), gloas_fork_epoch: gloas_fork_epoch.map(|q| q.value),
builder_payment_threshold_numerator,
builder_payment_threshold_denominator,
seconds_per_slot, seconds_per_slot,
seconds_per_eth1_block, seconds_per_eth1_block,
min_validator_withdrawability_delay, min_validator_withdrawability_delay,

View File

@@ -11,9 +11,8 @@ use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derivative(PartialEq, Hash)] #[derivative(PartialEq, Hash)]
#[context_deserialize(ForkName)] #[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/master/specs/gloas/beacon-chain.md#executionpayloadbid
// https://github.com/ethereum/consensus-specs/blob/bba2c7be148d6d921d2ca5e1cc528f5daaf456d9/specs/gloas/beacon-chain.md#executionpayloadheader pub struct ExecutionPayloadBid {
pub struct ExecutionBid {
pub parent_block_hash: ExecutionBlockHash, pub parent_block_hash: ExecutionBlockHash,
pub parent_block_root: Hash256, pub parent_block_root: Hash256,
pub block_hash: ExecutionBlockHash, pub block_hash: ExecutionBlockHash,
@@ -29,11 +28,11 @@ pub struct ExecutionBid {
pub blob_kzg_commitments_root: Hash256, pub blob_kzg_commitments_root: Hash256,
} }
impl SignedRoot for ExecutionBid {} impl SignedRoot for ExecutionPayloadBid {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
ssz_and_tree_hash_tests!(ExecutionBid); ssz_and_tree_hash_tests!(ExecutionPayloadBid);
} }

View File

@@ -59,6 +59,7 @@ pub struct ExecutionPayloadEnvelope<E: EthSpec> {
pub state_root: Hash256, pub state_root: Hash256,
} }
impl<E: EthSpec> SignedRoot for ExecutionPayloadEnvelope<E> {}
impl<'a, E: EthSpec> SignedRoot for ExecutionPayloadEnvelopeRef<'a, E> {} impl<'a, E: EthSpec> SignedRoot for ExecutionPayloadEnvelopeRef<'a, E> {}
impl<'a, E: EthSpec> ExecutionPayloadEnvelopeRef<'a, E> { impl<'a, E: EthSpec> ExecutionPayloadEnvelopeRef<'a, E> {

View File

@@ -42,9 +42,9 @@ pub mod dumb_macros;
pub mod enr_fork_id; pub mod enr_fork_id;
pub mod eth1_data; pub mod eth1_data;
pub mod eth_spec; pub mod eth_spec;
pub mod execution_bid;
pub mod execution_block_hash; pub mod execution_block_hash;
pub mod execution_payload; pub mod execution_payload;
pub mod execution_payload_bid;
pub mod execution_payload_envelope; pub mod execution_payload_envelope;
pub mod execution_payload_header; pub mod execution_payload_header;
pub mod fork; pub mod fork;
@@ -77,7 +77,7 @@ pub mod signed_beacon_block;
pub mod signed_beacon_block_header; pub mod signed_beacon_block_header;
pub mod signed_bls_to_execution_change; pub mod signed_bls_to_execution_change;
pub mod signed_contribution_and_proof; 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_execution_payload_envelope;
pub mod signed_voluntary_exit; pub mod signed_voluntary_exit;
pub mod signing_data; 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::epoch_cache::{EpochCache, EpochCacheError, EpochCacheKey};
pub use crate::eth_spec::EthSpecId; pub use crate::eth_spec::EthSpecId;
pub use crate::eth1_data::Eth1Data; pub use crate::eth1_data::Eth1Data;
pub use crate::execution_bid::ExecutionBid;
pub use crate::execution_block_hash::ExecutionBlockHash; pub use crate::execution_block_hash::ExecutionBlockHash;
pub use crate::execution_block_header::{EncodableExecutionBlockHeader, ExecutionBlockHeader}; pub use crate::execution_block_header::{EncodableExecutionBlockHeader, ExecutionBlockHeader};
pub use crate::execution_payload::{ pub use crate::execution_payload::{
@@ -186,6 +185,7 @@ pub use crate::execution_payload::{
ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionPayloadGloas, ExecutionPayloadRef, ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionPayloadGloas, ExecutionPayloadRef,
Transaction, Transactions, Withdrawals, Transaction, Transactions, Withdrawals,
}; };
pub use crate::execution_payload_bid::ExecutionPayloadBid;
pub use crate::execution_payload_envelope::{ pub use crate::execution_payload_envelope::{
ExecutionPayloadEnvelope, ExecutionPayloadEnvelopeGloas, ExecutionPayloadEnvelopeNextFork, ExecutionPayloadEnvelope, ExecutionPayloadEnvelopeGloas, ExecutionPayloadEnvelopeNextFork,
ExecutionPayloadEnvelopeRef, ExecutionPayloadEnvelopeRef,
@@ -266,7 +266,7 @@ pub use crate::signed_beacon_block::{
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader; pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange; pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
pub use crate::signed_contribution_and_proof::SignedContributionAndProof; 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_execution_payload_envelope::SignedExecutionPayloadEnvelope;
pub use crate::signed_voluntary_exit::SignedVoluntaryExit; pub use crate::signed_voluntary_exit::SignedVoluntaryExit;
pub use crate::signing_data::{SignedRoot, SigningData}; pub use crate::signing_data::{SignedRoot, SigningData};

View File

@@ -12,7 +12,7 @@ pub struct PayloadAttestationMessage {
#[serde(with = "serde_utils::quoted_u64")] #[serde(with = "serde_utils::quoted_u64")]
pub validator_index: u64, pub validator_index: u64,
pub data: PayloadAttestationData, pub data: PayloadAttestationData,
pub signature: AggregateSignature, pub signature: Signature,
} }
#[cfg(test)] #[cfg(test)]

View File

@@ -12,16 +12,16 @@ use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derivative(PartialEq, Hash)] #[derivative(PartialEq, Hash)]
#[context_deserialize(ForkName)] #[context_deserialize(ForkName)]
// https://github.com/ethereum/consensus-specs/blob/bba2c7be148d6d921d2ca5e1cc528f5daaf456d9/specs/gloas/beacon-chain.md#signedexecutionpayloadheader // https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#signedexecutionpayloadbid
pub struct SignedExecutionBid { pub struct SignedExecutionPayloadBid {
pub message: ExecutionBid, pub message: ExecutionPayloadBid,
pub signature: Signature, pub signature: Signature,
} }
impl SignedExecutionBid { impl SignedExecutionPayloadBid {
pub fn empty() -> Self { pub fn empty() -> Self {
Self { Self {
message: ExecutionBid::default(), message: ExecutionPayloadBid::default(),
signature: Signature::empty(), signature: Signature::empty(),
} }
} }
@@ -31,5 +31,5 @@ impl SignedExecutionBid {
mod tests { mod tests {
use super::*; use super::*;
ssz_and_tree_hash_tests!(SignedExecutionBid); ssz_and_tree_hash_tests!(SignedExecutionPayloadBid);
} }

View File

@@ -48,6 +48,26 @@ pub struct SignedExecutionPayloadEnvelope<E: EthSpec> {
} }
impl<E: EthSpec> SignedExecutionPayloadEnvelope<E> { impl<E: EthSpec> SignedExecutionPayloadEnvelope<E> {
/// Create a new `SignedExecutionPayloadEnvelope` from an `ExecutionPayloadEnvelope` and `Signature`.
pub fn from_envelope(envelope: ExecutionPayloadEnvelope<E>, 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> { pub fn message(&self) -> ExecutionPayloadEnvelopeRef<'_, E> {
match self { match self {
Self::Gloas(signed) => ExecutionPayloadEnvelopeRef::Gloas(&signed.message), Self::Gloas(signed) => ExecutionPayloadEnvelopeRef::Gloas(&signed.message),