Skip to content

feat(engine/ssz): add target_gas_limit to PayloadAttributesV4 wire#11647

Merged
benaadams merged 1 commit into
NethermindEth:feat/engine-payload-attrs-target-gas-limitfrom
barnabasbusa:bbusa/ssz-payload-attrs-v4-target-gas-limit-master
May 18, 2026
Merged

feat(engine/ssz): add target_gas_limit to PayloadAttributesV4 wire#11647
benaadams merged 1 commit into
NethermindEth:feat/engine-payload-attrs-target-gas-limitfrom
barnabasbusa:bbusa/ssz-payload-attrs-v4-target-gas-limit-master

Conversation

@barnabasbusa
Copy link
Copy Markdown

Summary

Stacked on top of #11611. Plumbs the new `TargetGasLimit` field through the SSZ-REST wire schema for `engine_forkchoiceUpdatedV4` (introduced in #11611 for JSON-RPC).

  • `PayloadAttributesWire` gains `target_gas_limit: uint64` at the end of the container (matches execution-apis ssz-encoding.md `PayloadAttributesV4`).
  • `SszCodec.PayloadAttributesFromWire` forwards the wire `ulong` as `long` to `PayloadAttributes.TargetGasLimit`.
  • `DecodeFcuV4Request` round-trip test now also asserts `target_gas_limit` survives encode/decode, using a diverse-byte value (`0x0123456789ABCDEF`) rather than a plausible default.

Why

Without the SSZ wire counterpart, CLs that send `targetGasLimit` over the SSZ-REST transport (`POST /engine/v4/forkchoice`, advertised under execution-apis PR #764) get rejected as Malformed SSZ body — the 8 extra trailing bytes shift the inner `withdrawals` offset inside `PayloadAttributesV4`.

Spec alignment:

Fail-loud guarantee

The wire `target_gas_limit` is a required fixed-size `uint64` (per ssz-encoding.md), so a missing value fails SSZ decode directly — the V4 null-guard in `PayloadAttributes.GetInvalidPayloadAttributesMessage` (`Producers/PayloadAttributes.cs:232`) remains as defense-in-depth for the JSON path. No default-value fallback anywhere.

Sister PRs

Test plan

  • `DecodeFcuV4Request_spec_layout_roundtrips_parent_beacon_block_root_and_slot_number` now asserts `target_gas_limit` round-trips
  • CI green
  • Manual: consensoor ↔ nethermind on glamsterdam devnet — fcU v4 over SSZ no longer rejected

Plumbs the new TargetGasLimit field added in this PR through the
SSZ-REST wire schema for engine_forkchoiceUpdatedV4 (PR NethermindEth#764).

Without this, CLs that include target_gas_limit in the SSZ body get
rejected as "Malformed SSZ body" because the 8 extra trailing bytes
shift the inner withdrawals offset.

The wire field is a required fixed-size uint64 (per execution-apis
ssz-encoding.md), so a missing value fails SSZ decode directly — the
V4 null-guard in PayloadAttributes.GetInvalidPayloadAttributesMessage
remains as defense-in-depth for the JSON path.

Changes:
- PayloadAttributesWire gains target_gas_limit at the end of the
  container (matches execution-apis ssz-encoding.md PayloadAttributesV4).
- SszCodec.PayloadAttributesFromWire forwards the wire ulong as long
  to PayloadAttributes.TargetGasLimit.
- DecodeFcuV4Request roundtrip test now also asserts target_gas_limit
  survives encode/decode, using a diverse-byte value (0x0123456789ABCDEF).
@benaadams
Copy link
Copy Markdown
Member

Thank you for your contribution

@benaadams benaadams merged commit 8a82ef5 into NethermindEth:feat/engine-payload-attrs-target-gas-limit May 18, 2026
512 of 513 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants