Gloas alpha spec 8 (#9315)

https://github.com/ethereum/consensus-specs/releases/tag/v1.7.0-alpha.8


  


Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
Eitan Seri-Levi
2026-05-21 23:21:20 -07:00
committed by GitHub
parent b5d5644eeb
commit 60abd4b5b9
36 changed files with 863 additions and 243 deletions

View File

@@ -178,6 +178,8 @@ pub struct PayloadAttributes {
pub parent_beacon_block_root: Hash256,
#[superstruct(only(V4), partial_getter(copy))]
pub slot_number: u64,
#[superstruct(only(V4), partial_getter(copy))]
pub target_gas_limit: u64,
}
impl PayloadAttributes {
@@ -188,19 +190,29 @@ impl PayloadAttributes {
withdrawals: Option<Vec<Withdrawal>>,
parent_beacon_block_root: Option<Hash256>,
slot_number: Option<u64>,
target_gas_limit: Option<u64>,
) -> Self {
match (withdrawals, parent_beacon_block_root, slot_number) {
(Some(withdrawals), Some(parent_beacon_block_root), Some(slot_number)) => {
PayloadAttributes::V4(PayloadAttributesV4 {
timestamp,
prev_randao,
suggested_fee_recipient,
withdrawals,
parent_beacon_block_root,
slot_number,
})
}
(Some(withdrawals), Some(parent_beacon_block_root), None) => {
match (
withdrawals,
parent_beacon_block_root,
slot_number,
target_gas_limit,
) {
(
Some(withdrawals),
Some(parent_beacon_block_root),
Some(slot_number),
Some(target_gas_limit),
) => PayloadAttributes::V4(PayloadAttributesV4 {
timestamp,
prev_randao,
suggested_fee_recipient,
withdrawals,
parent_beacon_block_root,
slot_number,
target_gas_limit,
}),
(Some(withdrawals), Some(parent_beacon_block_root), _, _) => {
PayloadAttributes::V3(PayloadAttributesV3 {
timestamp,
prev_randao,
@@ -209,13 +221,13 @@ impl PayloadAttributes {
parent_beacon_block_root,
})
}
(Some(withdrawals), None, _) => PayloadAttributes::V2(PayloadAttributesV2 {
(Some(withdrawals), None, _, _) => PayloadAttributes::V2(PayloadAttributesV2 {
timestamp,
prev_randao,
suggested_fee_recipient,
withdrawals,
}),
(None, _, _) => PayloadAttributes::V1(PayloadAttributesV1 {
(None, _, _, _) => PayloadAttributes::V1(PayloadAttributesV1 {
timestamp,
prev_randao,
suggested_fee_recipient,
@@ -260,7 +272,7 @@ impl From<PayloadAttributes> for SsePayloadAttributes {
withdrawals,
parent_beacon_block_root,
}),
// V4 maps to V3 for SSE (slot_number is not part of the SSE spec)
// V4 maps to V3 for SSE (slot_number/target_gas_limit are not part of the SSE spec)
PayloadAttributes::V4(PayloadAttributesV4 {
timestamp,
prev_randao,
@@ -268,6 +280,7 @@ impl From<PayloadAttributes> for SsePayloadAttributes {
withdrawals,
parent_beacon_block_root,
slot_number: _,
target_gas_limit: _,
}) => Self::V3(SsePayloadAttributesV3 {
timestamp,
prev_randao,

View File

@@ -777,6 +777,9 @@ pub struct JsonPayloadAttributes {
#[superstruct(only(V4))]
#[serde(with = "serde_utils::u64_hex_be")]
pub slot_number: u64,
#[superstruct(only(V4))]
#[serde(with = "serde_utils::u64_hex_be")]
pub target_gas_limit: u64,
}
impl From<PayloadAttributes> for JsonPayloadAttributes {
@@ -807,6 +810,7 @@ impl From<PayloadAttributes> for JsonPayloadAttributes {
withdrawals: pa.withdrawals.into_iter().map(Into::into).collect(),
parent_beacon_block_root: pa.parent_beacon_block_root,
slot_number: pa.slot_number,
target_gas_limit: pa.target_gas_limit,
}),
}
}
@@ -840,6 +844,7 @@ impl From<JsonPayloadAttributes> for PayloadAttributes {
withdrawals: jpa.withdrawals.into_iter().map(Into::into).collect(),
parent_beacon_block_root: jpa.parent_beacon_block_root,
slot_number: jpa.slot_number,
target_gas_limit: jpa.target_gas_limit,
}),
}
}

View File

@@ -73,6 +73,8 @@ pub const DEFAULT_EXECUTION_ENDPOINT: &str = "http://localhost:8551/";
/// Name for the default file used for the jwt secret.
pub const DEFAULT_JWT_FILE: &str = "jwt.hex";
pub const DEFAULT_GAS_LIMIT: u64 = 60_000_000;
/// A fee recipient address for use during block production. Only used as a very last resort if
/// there is no address provided by the user.
///
@@ -358,7 +360,10 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> BlockProposalContents<E, Paylo
#[derive(Clone, Copy, Debug)]
pub struct PayloadParameters<'a> {
pub parent_hash: ExecutionBlockHash,
pub parent_gas_limit: u64,
// NOTE: The `parent_gas_limit` is a bit scuffed. We made it optional for Gloas because it
// isn't currently required, but it should possibly be made non-optional again if needed.
// Or we should superstruct this type.
pub parent_gas_limit: Option<u64>,
pub proposer_gas_limit: Option<u64>,
pub payload_attributes: &'a PayloadAttributes,
pub forkchoice_update_params: &'a ForkchoiceUpdateParameters,
@@ -2082,7 +2087,7 @@ fn verify_builder_bid<E: EthSpec>(
let payload_withdrawals_root = header.withdrawals_root().ok();
let expected_gas_limit = proposer_gas_limit
.and_then(|target_gas_limit| expected_gas_limit(parent_gas_limit, target_gas_limit, spec));
.and_then(|target_gas_limit| expected_gas_limit(parent_gas_limit?, target_gas_limit, spec));
if header.parent_hash() != parent_hash {
Err(Box::new(InvalidBuilderPayload::ParentHash {

View File

@@ -282,7 +282,7 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
#[derive(Clone)]
pub struct PayloadParametersCloned {
pub parent_hash: ExecutionBlockHash,
pub parent_gas_limit: u64,
pub parent_gas_limit: Option<u64>,
pub proposer_gas_limit: Option<u64>,
pub payload_attributes: PayloadAttributes,
pub forkchoice_update_params: ForkchoiceUpdateParameters,
@@ -903,6 +903,7 @@ impl<E: EthSpec> MockBuilder<E> {
expected_withdrawals,
None,
None,
None,
),
ForkName::Deneb | ForkName::Electra | ForkName::Fulu => PayloadAttributes::new(
timestamp,
@@ -911,6 +912,7 @@ impl<E: EthSpec> MockBuilder<E> {
expected_withdrawals,
Some(head_block_root),
None,
None,
),
ForkName::Gloas => PayloadAttributes::new(
timestamp,
@@ -919,6 +921,7 @@ impl<E: EthSpec> MockBuilder<E> {
expected_withdrawals,
Some(head_block_root),
Some(slot.as_u64()),
None, // TODO(gloas): pass target_gas_limit
),
ForkName::Base | ForkName::Altair => {
return Err("invalid fork".to_string());
@@ -969,7 +972,7 @@ impl<E: EthSpec> MockBuilder<E> {
let payload_parameters = PayloadParametersCloned {
parent_hash: head_execution_hash,
parent_gas_limit: head_gas_limit,
parent_gas_limit: Some(head_gas_limit),
proposer_gas_limit: Some(proposer_gas_limit),
payload_attributes,
forkchoice_update_params,

View File

@@ -105,6 +105,7 @@ impl<E: EthSpec> MockExecutionLayer<E> {
None,
None,
None,
None,
);
// Insert a proposer to ensure the fork choice updated command works.
@@ -146,11 +147,12 @@ impl<E: EthSpec> MockExecutionLayer<E> {
None,
None,
None,
None,
);
let payload_parameters = PayloadParameters {
parent_hash,
parent_gas_limit,
parent_gas_limit: Some(parent_gas_limit),
proposer_gas_limit: None,
payload_attributes: &payload_attributes,
forkchoice_update_params: &forkchoice_update_params,
@@ -199,11 +201,12 @@ impl<E: EthSpec> MockExecutionLayer<E> {
None,
None,
None,
None,
);
let payload_parameters = PayloadParameters {
parent_hash,
parent_gas_limit,
parent_gas_limit: Some(parent_gas_limit),
proposer_gas_limit: None,
payload_attributes: &payload_attributes,
forkchoice_update_params: &forkchoice_update_params,