Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
48fdac7
Defer payload processing to next block
nflaig Apr 10, 2026
baa90e2
don't seed anchor_root in payloads
nflaig Apr 10, 2026
d723e0b
move execution requests match the bid commitment check
nflaig Apr 10, 2026
4efcb35
remove unncessary state copy & mutation
nflaig Apr 10, 2026
6a02647
cleanup
nflaig Apr 10, 2026
5d259e9
A little more cleanup
jtraglia Apr 10, 2026
2a762fe
wording
nflaig Apr 11, 2026
b5998c2
recompute state root to verify beacon block root
nflaig Apr 11, 2026
1041bf4
comments
nflaig Apr 11, 2026
b1bb1a7
update heze
nflaig Apr 11, 2026
5a47768
nits
nflaig Apr 11, 2026
9c7d24d
move payload availability update after verification
nflaig Apr 11, 2026
9de223e
add missing payloads=set()
nflaig Apr 11, 2026
3883ee8
Merge branch 'master' into deferred-payload-processing
nflaig Apr 11, 2026
2ea00dd
wording
nflaig Apr 12, 2026
2267bcc
remove is_parent_block_full
nflaig Apr 13, 2026
edfc9f2
drop redundant parent block checks from gossip and on_block
nflaig Apr 13, 2026
b8dce83
use should_extend_payload
nflaig Apr 13, 2026
7321908
update builder instructions
nflaig Apr 13, 2026
8014017
rename to verify_execution_payload
nflaig Apr 13, 2026
ec3fd1b
rename to verify_execution_payload_envelope
nflaig Apr 13, 2026
a7f02ca
wording
nflaig Apr 14, 2026
e307112
cleanup
nflaig Apr 14, 2026
1000bf8
Update tests
jtraglia Apr 14, 2026
2e53b0f
Move verification functions to fork-choice.md
jtraglia Apr 14, 2026
2154fb6
Do not run capella process_execution_payload test in Gloas
jtraglia Apr 14, 2026
50c6210
update prepare_execution_payload
nflaig Apr 14, 2026
3fdde79
don't seed anchor_root in payloads
nflaig Apr 14, 2026
1f219f0
refactor
nflaig Apr 14, 2026
21dccc2
move verification functions back to beacon-chain.md
nflaig Apr 14, 2026
2fa1768
fix sections
nflaig Apr 14, 2026
d967e8f
update note
nflaig Apr 14, 2026
9c00e07
Merge branch 'master' into deferred-payload-processing
nflaig Apr 14, 2026
b1557f6
update references to on_execution_payload_envelope
nflaig Apr 14, 2026
cdf8dbf
restructure beacon-chain.md
nflaig Apr 14, 2026
d1b8306
remove helper change
nflaig Apr 14, 2026
97073fb
move execution payload section
nflaig Apr 14, 2026
a8c4391
typo
nflaig Apr 14, 2026
8e222c2
update tests
nflaig Apr 14, 2026
11e2a30
Fix some issues with tests
jtraglia Apr 14, 2026
6e7da52
Update test comments
jtraglia Apr 14, 2026
f870edc
set execution_requests_root on genesis/anchor block bodies
nflaig Apr 14, 2026
31b788e
use should_extend_payload again
nflaig Apr 14, 2026
ab3d73e
lint
nflaig Apr 14, 2026
3284032
wording
nflaig Apr 14, 2026
6b37268
add is_payload_verified
nflaig Apr 15, 2026
26ed32e
Refactor verify_execution_payload_envelope
jtraglia Apr 15, 2026
0a4bb37
Merge branch 'master' into deferred-payload-processing
nflaig Apr 15, 2026
f3f53bd
Merge branch 'master' into deferred-payload-processing
jtraglia Apr 15, 2026
dfce0c0
Fix process_parent_execution_payload tests
jtraglia Apr 15, 2026
ada2db4
Deprecate process_execution_payload
jtraglia Apr 15, 2026
6be2385
Move verification function to fork-choice specs
jtraglia Apr 15, 2026
5597ae2
Remove confusing note
jtraglia Apr 16, 2026
0923d8a
Fix builder payment issue after missed epochs
jtraglia Apr 16, 2026
ffcf9f8
Rename helper to settle_builder_payment
jtraglia Apr 16, 2026
8d6b635
nits
nflaig Apr 16, 2026
f2ff66f
Merge branch 'master' into deferred-payload-processing
jtraglia Apr 16, 2026
d6293cf
remove verify_execution_payload_envelope note
nflaig Apr 16, 2026
f48d980
add guard to should_extend_payload for missing payloads
nflaig Apr 16, 2026
cfcd9b6
Merge branch 'master' into deferred-payload-processing
jtraglia Apr 16, 2026
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
1 change: 1 addition & 0 deletions pysetup/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def combine_dicts(old_dict: dict[str, T], new_dict: dict[str, T]) -> dict[str, T
"ProgressiveBitlist",
"ProgressiveList",
"Sequence",
"set",
"Set",
"Tuple",
"uint128",
Expand Down
146 changes: 91 additions & 55 deletions specs/gloas/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
- [New `is_builder_withdrawal_credential`](#new-is_builder_withdrawal_credential)
- [New `is_attestation_same_slot`](#new-is_attestation_same_slot)
- [New `is_valid_indexed_payload_attestation`](#new-is_valid_indexed_payload_attestation)
- [New `is_parent_block_full`](#new-is_parent_block_full)
- [New `is_pending_validator`](#new-is_pending_validator)
- [Misc](#misc-2)
- [New `convert_builder_index_to_validator_index`](#new-convert_builder_index_to_validator_index)
Expand All @@ -69,6 +68,8 @@
- [New `process_builder_pending_payments`](#new-process_builder_pending_payments)
- [New `process_ptc_window`](#new-process_ptc_window)
- [Block processing](#block-processing)
- [Parent execution payload](#parent-execution-payload)
- [New `process_parent_execution_payload`](#new-process_parent_execution_payload)
- [Withdrawals](#withdrawals)
- [New `get_builder_withdrawals`](#new-get_builder_withdrawals)
- [New `get_builders_sweep_withdrawals`](#new-get_builders_sweep_withdrawals)
Expand Down Expand Up @@ -265,6 +266,7 @@ class ExecutionPayloadBid(Container):
value: Gwei
execution_payment: Gwei
blob_kzg_commitments: List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK]
execution_requests_root: Root
```

#### `SignedExecutionPayloadBid`
Expand All @@ -284,7 +286,6 @@ class ExecutionPayloadEnvelope(Container):
builder_index: BuilderIndex
beacon_block_root: Root
slot: Slot
state_root: Root
```

#### `SignedExecutionPayloadEnvelope`
Expand Down Expand Up @@ -324,6 +325,8 @@ class BeaconBlockBody(Container):
signed_execution_payload_bid: SignedExecutionPayloadBid
# [New in Gloas:EIP7732]
payload_attestations: List[PayloadAttestation, MAX_PAYLOAD_ATTESTATIONS]
# [New in Gloas:EIP7732]
parent_execution_requests: ExecutionRequests
```

#### `BeaconState`
Expand Down Expand Up @@ -480,18 +483,6 @@ def is_valid_indexed_payload_attestation(
return bls.FastAggregateVerify(pubkeys, signing_root, attestation.signature)
```

#### New `is_parent_block_full`

*Note*: This function returns true if the last committed payload bid was
fulfilled with a payload, which can only happen when both beacon block and
payload were present. This function must be called on a beacon state before
processing the execution payload bid in the block.

```python
def is_parent_block_full(state: BeaconState) -> bool:
return state.latest_execution_payload_bid.block_hash == state.latest_block_hash
```

#### New `is_pending_validator`

*Note*: This function naively revalidates deposit signatures on every call.
Expand Down Expand Up @@ -797,12 +788,15 @@ transitions that trigger an unhandled exception (e.g. a failed `assert` or an
out-of-range list access) are considered invalid. State transitions that cause a
`uint64` overflow or underflow are also considered invalid.

The post-state corresponding to a pre-state `state` and a signed execution
payload envelope `signed_envelope` is defined as
`process_execution_payload(state, signed_envelope, execution_engine)`. State
transitions that trigger an unhandled exception (e.g. a failed `assert` or an
out-of-range list access) are considered invalid. State transitions that cause
an `uint64` overflow or underflow are also considered invalid.
The validity of a signed execution payload envelope `signed_envelope` against a
pre-state `state` is checked by
`process_execution_payload(state, signed_envelope, execution_engine)`. Deferred
effects from the parent payload from execution requests, builder payment,
payload availability, and latest block hash are applied in the next beacon block
via `process_parent_execution_payload`. Payloads that trigger an unhandled
exception (e.g. a failed `assert` or an out-of-range list access) are considered
invalid. Payloads that cause a `uint64` overflow or underflow are also
considered invalid.

### Modified `process_slot`

Expand Down Expand Up @@ -890,6 +884,8 @@ def process_ptc_window(state: BeaconState) -> None:

```python
def process_block(state: BeaconState, block: BeaconBlock) -> None:
# [New in Gloas:EIP7732]
process_parent_execution_payload(state, block)
process_block_header(state, block)
# [Modified in Gloas:EIP7732]
process_withdrawals(state)
Expand All @@ -904,6 +900,68 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
process_sync_aggregate(state, block.body.sync_aggregate)
```

#### Parent execution payload

##### New `process_parent_execution_payload`

```python
def process_parent_execution_payload(state: BeaconState, block: BeaconBlock) -> None:
"""
Process deferred effects from the parent's execution payload.
Must run first in ``process_block``, before ``process_block_header``, because it reads
``state.latest_block_header.slot`` and ``state.latest_execution_payload_bid``
which are overwritten by ``process_block_header`` and ``process_execution_payload_bid``.
"""
bid = block.body.signed_execution_payload_bid.message
parent_bid = state.latest_execution_payload_bid

# True if this block built on the parent's full payload
is_parent_block_full = bid.parent_block_hash == parent_bid.block_hash

if not is_parent_block_full:
# Parent was EMPTY -- no execution requests expected
assert block.body.parent_execution_requests == ExecutionRequests()
return

parent_slot = state.latest_block_header.slot
parent_epoch = compute_epoch_at_slot(parent_slot)

# Verify execution requests match the bid commitment
requests = block.body.parent_execution_requests
assert hash_tree_root(requests) == parent_bid.execution_requests_root

# Process deferred execution requests from parent's payload. The execution
# requests are processed at state.slot (child's slot), not the parent's slot.
def for_ops(operations: Sequence[Any], fn: Callable[[BeaconState, Any], None]) -> None:
for operation in operations:
fn(state, operation)

for_ops(requests.deposits, process_deposit_request)
for_ops(requests.withdrawals, process_withdrawal_request)
for_ops(requests.consolidations, process_consolidation_request)

# Queue the builder payment
if parent_epoch == get_current_epoch(state):
payment_index = SLOTS_PER_EPOCH + parent_slot % SLOTS_PER_EPOCH
elif parent_epoch == get_previous_epoch(state):
payment_index = parent_slot % SLOTS_PER_EPOCH
else:
# If parent is older than previous_epoch, the payment entry has
# already been settled or evicted by process_builder_pending_payments
Comment thread
nflaig marked this conversation as resolved.
Resolved
# at epoch boundaries. No action needed.
payment_index = None

if payment_index is not None:
payment = state.builder_pending_payments[payment_index]
if payment.withdrawal.amount > 0:
Comment thread
nflaig marked this conversation as resolved.
Resolved
state.builder_pending_withdrawals.append(payment.withdrawal)
state.builder_pending_payments[payment_index] = BuilderPendingPayment()

# Update parent payload availability and latest block hash
state.execution_payload_availability[parent_slot % SLOTS_PER_HISTORICAL_ROOT] = 0b1
state.latest_block_hash = bid.parent_block_hash
Comment thread
nflaig marked this conversation as resolved.
Resolved
```

#### Withdrawals

##### New `get_builder_withdrawals`
Expand Down Expand Up @@ -1076,8 +1134,9 @@ def update_next_withdrawal_builder_index(
*Note*: This is modified to only take the `state` as parameter. Withdrawals are
deterministic given the beacon state, any execution payload that has the
corresponding block as parent beacon block is required to honor these
withdrawals in the execution layer. `process_withdrawals` must be called before
`process_execution_payload_bid` as the latter function affects validator
withdrawals in the execution layer. `process_withdrawals` must be called after
`process_parent_execution_payload` (which updates `state.latest_block_hash`) and
before `process_execution_payload_bid` as the latter function affects validator
balances.

```python
Expand All @@ -1088,7 +1147,7 @@ def process_withdrawals(
) -> None:
# [New in Gloas:EIP7732]
# Return early if the parent block is empty
if not is_parent_block_full(state):
if state.latest_block_hash != state.latest_execution_payload_bid.block_hash:
return

# Get expected withdrawals
Expand Down Expand Up @@ -1545,9 +1604,11 @@ def verify_execution_payload_envelope_signature(

#### New `process_execution_payload`

*Note*: `process_execution_payload` is now an independent check in state
transition. It is called when importing a signed execution payload proposed by
the builder of the current slot.
*Note*: `process_execution_payload` is a verification function called by
Comment thread
nflaig marked this conversation as resolved.
Resolved
fork-choice when importing a signed execution payload. It verifies the payload
against the execution engine without processing execution requests or updating
state. Actual state mutations are deferred to `process_parent_execution_payload`
in the next block.

```python
def process_execution_payload(
Comment thread
nflaig marked this conversation as resolved.
Resolved
Expand All @@ -1568,18 +1629,18 @@ def process_execution_payload(
assert verify_execution_payload_envelope_signature(state, signed_envelope)

# Cache latest block header state root
previous_state_root = hash_tree_root(state)
if state.latest_block_header.state_root == Root():
state.latest_block_header.state_root = previous_state_root
header = copy(state.latest_block_header)
header.state_root = hash_tree_root(state)

# Verify consistency with the beacon block
assert envelope.beacon_block_root == hash_tree_root(state.latest_block_header)
assert envelope.beacon_block_root == hash_tree_root(header)
assert envelope.slot == state.slot

# Verify consistency with the committed bid
committed_bid = state.latest_execution_payload_bid
assert envelope.builder_index == committed_bid.builder_index
assert committed_bid.prev_randao == payload.prev_randao
assert hash_tree_root(envelope.execution_requests) == committed_bid.execution_requests_root

# Verify consistency with expected withdrawals
assert hash_tree_root(payload.withdrawals) == hash_tree_root(state.payload_expected_withdrawals)
Expand Down Expand Up @@ -1607,29 +1668,4 @@ def process_execution_payload(
execution_requests=requests,
)
)

Comment thread
nflaig marked this conversation as resolved.
Resolved
def for_ops(operations: Sequence[Any], fn: Callable[[BeaconState, Any], None]) -> None:
for operation in operations:
fn(state, operation)

for_ops(requests.deposits, process_deposit_request)
for_ops(requests.withdrawals, process_withdrawal_request)
for_ops(requests.consolidations, process_consolidation_request)

# Queue the builder payment
payment = state.builder_pending_payments[SLOTS_PER_EPOCH + state.slot % SLOTS_PER_EPOCH]
amount = payment.withdrawal.amount
if amount > 0:
state.builder_pending_withdrawals.append(payment.withdrawal)
state.builder_pending_payments[SLOTS_PER_EPOCH + state.slot % SLOTS_PER_EPOCH] = (
BuilderPendingPayment()
)

# Cache the execution payload hash
state.execution_payload_availability[state.slot % SLOTS_PER_HISTORICAL_ROOT] = 0b1
state.latest_block_hash = payload.block_hash

# Verify the state root
if verify:
assert envelope.state_root == hash_tree_root(state)
```
17 changes: 9 additions & 8 deletions specs/gloas/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,17 @@ proposer what it promised whether it submits the payload or not.
Builders can broadcast a payload bid for the current or the next slot's proposer
to include. They produce a `SignedExecutionPayloadBid` as follows.

01. Set `bid.parent_block_hash` to the current head of the execution chain (this
can be obtained from the beacon state as `state.latest_block_hash`).
02. Set `bid.parent_block_root` to be the head of the consensus chain; this can
01. Set `bid.parent_block_hash` to the current head of the execution chain. This
is `state.latest_execution_payload_bid.block_hash` if the parent block has
been verified
(`hash_tree_root(state.latest_block_header) in store.payloads`), otherwise
`state.latest_execution_payload_bid.parent_block_hash`.
02. Set `bid.parent_block_root` to be the head of the consensus chain. This can
be obtained from the beacon state as
`hash_tree_root(state.latest_block_header)`. The `parent_block_root` and
`parent_block_hash` must be compatible, in the sense that they both should
come from the same `state` by the method described in this and the previous
point.
come from the same `state` and `store` by the method described in this and
the previous point.
03. Construct an execution payload. This can be performed with an external
execution engine via a call to `engine_getPayloadV5`.
04. Set `bid.block_hash` to be the block hash of the constructed payload, that
Expand Down Expand Up @@ -244,9 +247,7 @@ After setting these parameters, the builder assembles
`signed_execution_payload_envelope = SignedExecutionPayloadEnvelope(message=envelope, signature=BLSSignature())`,
then verify that the envelope is valid with
`process_execution_payload(state, signed_execution_payload_envelope, execution_engine, verify=False)`.
This function should not trigger an exception.

7. Set `envelope.state_root` to `hash_tree_root(state)`.
This function should not trigger an exception and does not mutate `state`.

After preparing the `envelope` the builder should sign the envelope using:

Expand Down
Loading
Loading