Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
135 changes: 95 additions & 40 deletions specs/gloas/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,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 +267,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 +287,6 @@ class ExecutionPayloadEnvelope(Container):
builder_index: BuilderIndex
beacon_block_root: Root
slot: Slot
state_root: Root
```

#### `SignedExecutionPayloadEnvelope`
Expand Down Expand Up @@ -324,6 +326,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 @@ -797,12 +801,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`. Verification failures that trigger an
unhandled exception (e.g. a failed `assert` or an out-of-range list access) are
considered invalid. Verification failures that cause a `uint64` overflow or
underflow are also considered invalid.
Comment thread
nflaig marked this conversation as resolved.
Resolved

### Modified `process_slot`

Expand Down Expand Up @@ -890,6 +897,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 +913,79 @@ 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

# Determine parent payload status from block data
# Note: cannot use is_parent_block_full(state) here because latest_block_hash
# has not been updated yet -- this function is responsible for updating it.
is_parent_full = bid.parent_block_hash == parent_bid.block_hash

if is_parent_full:
parent_slot = state.latest_block_header.slot
parent_epoch = compute_epoch_at_slot(parent_slot)
current_epoch = get_current_epoch(state)
previous_epoch = get_previous_epoch(state)
Comment thread
nflaig marked this conversation as resolved.
Resolved

# Mark the parent payload as available before any later state transition logic observes it.
state.execution_payload_availability[parent_slot % SLOTS_PER_HISTORICAL_ROOT] = 0b1

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

# Process deferred execution requests from parent's payload
# Note: execution requests observe state.slot (child's slot), not the parent's.
requests = block.body.parent_execution_requests

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 == current_epoch:
payment_index = SLOTS_PER_EPOCH + parent_slot % SLOTS_PER_EPOCH
payment = state.builder_pending_payments[payment_index]
amount = payment.withdrawal.amount
if amount > 0:
state.builder_pending_withdrawals.append(payment.withdrawal)
state.builder_pending_payments[payment_index] = BuilderPendingPayment()
elif parent_epoch == previous_epoch:
payment_index = parent_slot % SLOTS_PER_EPOCH
payment = state.builder_pending_payments[payment_index]
amount = payment.withdrawal.amount
if amount > 0:
state.builder_pending_withdrawals.append(payment.withdrawal)
state.builder_pending_payments[payment_index] = BuilderPendingPayment()
# Note: if parent is older than previous_epoch, the payment entry
# has already been settled or evicted by process_builder_pending_payments
# at epoch boundaries. No action needed.
Comment thread
nflaig marked this conversation as resolved.
Resolved

# Update latest block hash
state.latest_block_hash = bid.parent_block_hash
else:
# Parent was EMPTY -- no execution requests expected
assert block.body.parent_execution_requests == ExecutionRequests()
Comment thread
nflaig marked this conversation as resolved.
Resolved
```

#### Withdrawals

##### New `get_builder_withdrawals`
Expand Down Expand Up @@ -1545,9 +1627,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 @@ -1567,11 +1651,6 @@ def process_execution_payload(
if verify:
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

# Verify consistency with the beacon block
assert envelope.beacon_block_root == hash_tree_root(state.latest_block_header)
assert envelope.slot == state.slot
Expand All @@ -1580,6 +1659,7 @@ def process_execution_payload(
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 +1687,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)
```
4 changes: 1 addition & 3 deletions specs/gloas/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,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
47 changes: 26 additions & 21 deletions specs/gloas/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ def update_latest_messages(

### Modified `Store`

*Note*: `Store` is modified to track the intermediate states of "empty"
consensus blocks, that is, those consensus blocks for which the corresponding
execution payload has not been revealed or has not been included on chain.
*Note*: `Store` is modified to track blocks whose execution payloads have been
verified.
Comment thread
nflaig marked this conversation as resolved.
Resolved

```python
@dataclass
Expand All @@ -146,7 +145,7 @@ class Store(object):
latest_messages: Dict[ValidatorIndex, LatestMessage] = field(default_factory=dict)
unrealized_justifications: Dict[Root, Checkpoint] = field(default_factory=dict)
# [New in Gloas:EIP7732]
payload_states: Dict[Root, BeaconState] = field(default_factory=dict)
payloads: Set[Root] = field(default_factory=set)
# [New in Gloas:EIP7732]
payload_timeliness_vote: Dict[Root, Vector[boolean, PTC_SIZE]] = field(default_factory=dict)
# [New in Gloas:EIP7732]
Expand Down Expand Up @@ -181,7 +180,7 @@ def get_forkchoice_store(anchor_state: BeaconState, anchor_block: BeaconBlock) -
checkpoint_states={justified_checkpoint: copy(anchor_state)},
unrealized_justifications={anchor_root: justified_checkpoint},
# [New in Gloas:EIP7732]
payload_states={anchor_root: copy(anchor_state)},
payloads=set(),
# [New in Gloas:EIP7732]
payload_timeliness_vote={
anchor_root: Vector[boolean, PTC_SIZE](True for _ in range(PTC_SIZE))
Expand Down Expand Up @@ -232,7 +231,7 @@ def is_payload_timely(store: Store, root: Root) -> bool:

# If the payload is not locally available, the payload
# is not considered available regardless of the PTC vote
if root not in store.payload_states:
if root not in store.payloads:
return False

return sum(store.payload_timeliness_vote[root]) > PAYLOAD_TIMELY_THRESHOLD
Expand All @@ -251,7 +250,7 @@ def is_payload_data_available(store: Store, root: Root) -> bool:

# If the payload is not locally available, the blob data
# is not considered available regardless of the PTC vote
if root not in store.payload_states:
if root not in store.payloads:
return False

return sum(store.payload_data_availability_vote[root]) > DATA_AVAILABILITY_TIMELY_THRESHOLD
Expand Down Expand Up @@ -488,7 +487,7 @@ def get_node_children(
) -> Sequence[ForkChoiceNode]:
if node.payload_status == PAYLOAD_STATUS_PENDING:
children = [ForkChoiceNode(root=node.root, payload_status=PAYLOAD_STATUS_EMPTY)]
if node.root in store.payload_states:
if node.root in store.payloads:
children.append(ForkChoiceNode(root=node.root, payload_status=PAYLOAD_STATUS_FULL))
return children
else:
Expand Down Expand Up @@ -605,7 +604,7 @@ def validate_on_attestation(store: Store, attestation: Attestation, is_from_bloc
# [New in Gloas:EIP7732]
# If attesting for a full node, the payload must be known
if attestation.data.index == 1:
assert attestation.data.beacon_block_root in store.payload_states
assert attestation.data.beacon_block_root in store.payloads

# LMD vote must be consistent with FFG vote target
assert target.root == get_checkpoint_block(
Expand Down Expand Up @@ -726,10 +725,11 @@ def get_payload_attestation_due_ms(epoch: Epoch) -> uint64:

### Modified `on_block`

*Note*: The handler `on_block` is modified to consider the pre `state` of the
given consensus beacon block depending not only on the parent block root, but
also on the parent blockhash. In addition we delay the checking of blob data
availability until the processing of the execution payload.
*Note*: The handler `on_block` is modified to verify the parent's deferred
execution requests against the parent bid's `execution_requests_root`
commitment, and to assert that the parent payload has been verified
(`store.payloads`). In addition we delay the checking of blob data availability
until the processing of the execution payload.

```python
def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
Expand All @@ -744,13 +744,16 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
parent_block = store.blocks[block.parent_root]
bid = block.body.signed_execution_payload_bid.message
parent_bid = parent_block.body.signed_execution_payload_bid.message
# Make a copy of the state to avoid mutability issues
# Verify parent execution requests against the parent bid commitment
if is_parent_node_full(store, block):
assert block.parent_root in store.payload_states
state = copy(store.payload_states[block.parent_root])
assert block.parent_root in store.payloads
assert (
hash_tree_root(block.body.parent_execution_requests)
== parent_bid.execution_requests_root
Comment thread
nflaig marked this conversation as resolved.
Resolved
)
else:
assert bid.parent_block_hash == parent_bid.parent_block_hash
Comment thread
jtraglia marked this conversation as resolved.
Resolved
state = copy(store.block_states[block.parent_root])
assert block.body.parent_execution_requests == ExecutionRequests()

# Blocks cannot be in the future. If they are, their consideration must be delayed until they are in the past.
current_slot = get_current_slot(store)
Expand All @@ -767,6 +770,9 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
)
assert store.finalized_checkpoint.root == finalized_checkpoint_block

# Make a copy of the state to avoid mutability issues
state = copy(store.block_states[block.parent_root])

# Check the block is valid and compute the post-state
block_root = hash_tree_root(block)
state_transition(state, signed_block, True)
Expand Down Expand Up @@ -830,14 +836,13 @@ def on_execution_payload(store: Store, signed_envelope: SignedExecutionPayloadEn
# If not, this payload MAY be queued and subsequently considered when blob data becomes available
assert is_data_available(envelope.beacon_block_root)

# Make a copy of the state to avoid mutability issues
state = copy(store.block_states[envelope.beacon_block_root])
state = store.block_states[envelope.beacon_block_root]
Comment thread
nflaig marked this conversation as resolved.
Resolved

# Process the execution payload
process_execution_payload(state, signed_envelope, EXECUTION_ENGINE)

# Add new state for this payload to the store
store.payload_states[envelope.beacon_block_root] = state
# Mark this block's execution payload as verified
store.payloads.add(envelope.beacon_block_root)
```

### New `on_payload_attestation_message`
Expand Down
1 change: 1 addition & 0 deletions specs/gloas/fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def upgrade_to_gloas(pre: fulu.BeaconState) -> BeaconState:
# [New in Gloas:EIP7732]
latest_execution_payload_bid=ExecutionPayloadBid(
block_hash=pre.latest_execution_payload_header.block_hash,
execution_requests_root=hash_tree_root(ExecutionRequests()),
),
next_withdrawal_index=pre.next_withdrawal_index,
next_withdrawal_validator_index=pre.next_withdrawal_validator_index,
Expand Down
8 changes: 8 additions & 0 deletions specs/gloas/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ And instead the following validations are set in place with the alias
`bid.parent_block_hash`) passes all validation.
- [REJECT] The bid's parent (defined by `bid.parent_block_root`) equals the
block's parent (defined by `block.parent_root`).
- _[REJECT]_ If the parent block was FULL (i.e.
`bid.parent_block_hash == parent_bid.block_hash` where `parent_bid` is the
parent block's `signed_execution_payload_bid.message`), verify that
`hash_tree_root(block.body.parent_execution_requests) == parent_bid.execution_requests_root`.
Comment thread
nflaig marked this conversation as resolved.
Resolved
- _[REJECT]_ If the parent block was EMPTY, verify that
`block.body.parent_execution_requests == ExecutionRequests()`.

###### `execution_payload`

Expand Down Expand Up @@ -317,6 +323,8 @@ obtained from the `state.latest_execution_payload_bid`)
- _[REJECT]_ `block.slot` equals `envelope.slot`.
- _[REJECT]_ `envelope.builder_index == bid.builder_index`
- _[REJECT]_ `payload.block_hash == bid.block_hash`
- _[REJECT]_
`hash_tree_root(envelope.execution_requests) == bid.execution_requests_root`.
- _[REJECT]_ `signed_execution_payload_envelope.signature` is valid as verified
by `verify_execution_payload_envelope_signature`.

Expand Down
Loading
Loading