Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bindings/c/src/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ pub struct CPayloadAttributesV4 {
withdrawals: CVec<CWithdrawalV1>,
parent_beacon_block_root: CH256,
slot_number: u64,
target_gas_limit: u64,
}

impl From<PayloadAttributesV4<Mainnet>> for CPayloadAttributesV4 {
Expand All @@ -427,6 +428,7 @@ impl From<PayloadAttributesV4<Mainnet>> for CPayloadAttributesV4 {
withdrawals: value.withdrawals.into_iter().map(Into::into).collect(),
parent_beacon_block_root: value.parent_beacon_block_root.into(),
slot_number: value.slot_number,
target_gas_limit: value.target_gas_limit,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions bindings/csharp/Grandine.NethermindPlugin/GrandineUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public static CPayloadValidationStatus ConvertPayloadValidationStatus(string sta
Withdrawals = WithdrawalsFromNative(attr.value.withdrawals),
ParentBeaconBlockRoot = attr.value.parent_beacon_block_root.ToHash256(),
SlotNumber = attr.value.slot_number,
TargetGasLimit = attr.value.target_gas_limit,
};
}

Expand Down
19 changes: 16 additions & 3 deletions block_producer/src/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ use types::{
SyncAggregate,
},
},
bellatrix::containers::{
BeaconBlock as BellatrixBeaconBlock, BeaconBlockBody as BellatrixBeaconBlockBody,
ExecutionPayload as BellatrixExecutionPayload,
bellatrix::{
containers::{
BeaconBlock as BellatrixBeaconBlock, BeaconBlockBody as BellatrixBeaconBlockBody,
ExecutionPayload as BellatrixExecutionPayload,
},
primitives::Gas,
},
capella::containers::{
BeaconBlock as CapellaBeaconBlock, BeaconBlockBody as CapellaBeaconBlockBody,
Expand Down Expand Up @@ -1807,6 +1810,7 @@ impl<P: Preset, W: Wait> BlockBuildContext<P, W> {
})
}
BeaconState::Gloas(state) => {
let target_gas_limit = self.gas_limit().await?;
let parent_root = state.latest_block_header().hash_tree_root();
let snapshot = self.producer_context.controller.snapshot();

Expand Down Expand Up @@ -1847,6 +1851,7 @@ impl<P: Preset, W: Wait> BlockBuildContext<P, W> {
withdrawals,
parent_beacon_block_root: parent_root,
slot_number: state.slot(),
target_gas_limit,
})
}
};
Expand Down Expand Up @@ -2253,6 +2258,14 @@ impl<P: Preset, W: Wait> BlockBuildContext<P, W> {
})
}

async fn gas_limit(&self) -> Result<Gas> {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should introduce new version of POST /eth/v1/validator/prepare_beacon_proposer to allow validator client submit their prefered gas limit to beacon node as well

cc @povi @Tumas

@povi povi May 15, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is this endpoint, which we already implement (also whole API): https://ethereum.github.io/keymanager-APIs/?urls.primaryName=dev#/Gas%20Limit/setGasLimit

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I see. but how can we load it in block building like fee_recipient?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already pass preferred gas limit to external builders: https://github.com/grandinetech/grandine/blob/develop/validator/src/validator.rs#L2295

You can do something like that in block producer.

@hangleang hangleang May 15, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that's what I did. So it's fine

let proposer_pubkey = accessors::public_key(&self.beacon_state, self.proposer_index)?;

self.producer_context
.proposer_configs
.gas_limit(*proposer_pubkey)
}

fn spawn_job<T, F>(&self, task: T) -> Job<F::Output>
where
T: FnOnce(Self) -> F,
Expand Down
2 changes: 2 additions & 0 deletions execution_engine/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ pub struct PayloadAttributesV4<P: Preset> {
pub parent_beacon_block_root: H256,
#[serde(with = "serde_utils::prefixed_hex_quantity")]
pub slot_number: Slot,
#[serde(with = "serde_utils::prefixed_hex_quantity")]
pub target_gas_limit: Gas,
}

/// [`engine_getPayloadV1` response](https://github.com/ethereum/execution-apis/blob/b7c5d3420e00648f456744d121ffbd929862924d/src/engine/paris.md#response-2).
Expand Down
5 changes: 5 additions & 0 deletions fork_choice_control/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use tap::Pipe as _;
use tokio::sync::broadcast::{self, Receiver, Sender};
use types::{
altair::containers::SignedContributionAndProof,
bellatrix::primitives::Gas,
capella::{containers::SignedBlsToExecutionChange, primitives::WithdrawalIndex},
combined::{Attestation, AttesterSlashing, DataColumnSidecar},
deneb::{
Expand Down Expand Up @@ -909,6 +910,8 @@ pub struct PayloadAttributesEventDataV4 {
pub parent_beacon_block_root: H256,
#[serde(with = "serde_utils::string_or_native")]
pub slot_number: Slot,
#[serde(with = "serde_utils::string_or_native")]
pub target_gas_limit: Gas,
}

#[derive(Clone, Copy, Debug, Serialize)]
Expand Down Expand Up @@ -1003,6 +1006,7 @@ impl<P: Preset> From<PayloadAttributesV4<P>> for PayloadAttributesEventDataV4 {
withdrawals,
parent_beacon_block_root,
slot_number,
target_gas_limit,
} = payload_attributes;

Self {
Expand All @@ -1012,6 +1016,7 @@ impl<P: Preset> From<PayloadAttributesV4<P>> for PayloadAttributesEventDataV4 {
withdrawals: withdrawals.into_iter().map(Into::into).collect::<Vec<_>>(),
parent_beacon_block_root,
slot_number,
target_gas_limit,
}
}
}
Expand Down
Loading