Skip to content
Closed
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
4 changes: 2 additions & 2 deletions specs/gloas/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@ follows the node's payload status. For a *full* node from the previous slot, it
considers the PTC view on both payload timeliness and data availability.

```python
def should_build_on_full(store: Store, head: ForkChoiceNode) -> bool:
def should_build_on_full(store: Store, head: ForkChoiceNode, slot: Slot) -> bool:
assert head.payload_status != PAYLOAD_STATUS_PENDING
if store.blocks[head.root].slot + 1 != get_current_slot(store):
if store.blocks[head.root].slot + 1 != slot:
return head.payload_status == PAYLOAD_STATUS_FULL
if head.payload_status == PAYLOAD_STATUS_EMPTY:
return False
Expand Down
59 changes: 56 additions & 3 deletions specs/gloas/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ where `store` is the fork choice store, and the alias
limitation defined in the consensus layer -- i.e. validate that
`len(bid.blob_kzg_commitments) <= get_blob_parameters(compute_epoch_at_slot(bid.slot)).max_blobs_per_block`.
- _[IGNORE]_ this is the first signed bid seen with a valid signature from the
given builder for this slot.
given builder for the tuple
`(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.

@nflaig nflaig Jul 28, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would assume all clients do this, but need to make sure we only add a bid to seen cache if it passes the is_bid_on_current_head check below, but the gossip check here only says with a valid signature and not bid that passes validation, so maybe it's a bit ambiguous. At least in lodestar, we only add bids to seen cache if they pass all gossip checks. related to my comment here #5472 (comment)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah that is a bit misleading. The executable specs will clear it up.

- _[IGNORE]_ this bid is the highest value bid seen for the tuple
`(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
- _[IGNORE]_ `bid.value` is less or equal than the builder's excess balance --
Expand All @@ -438,8 +439,8 @@ where `store` is the fork choice store, and the alias
`is_gas_limit_target_compatible(parent_gas_limit, bid.gas_limit, proposer_preferences.target_gas_limit)`
is `True` where `parent_gas_limit` is the `gas_limit` of that execution
payload.
- _[IGNORE]_ `bid.parent_block_root` is the hash tree root of a known beacon
block in fork choice.
- _[IGNORE]_ The bid mimics what this node would propose for, i.e.
`is_bid_on_current_head(store, bid)` returns `True`.
- _[REJECT]_ The bid is for a higher slot than its parent block -- i.e. validate
that `bid.slot` is greater than the slot of the block with root
`bid.parent_block_root`.
Expand Down Expand Up @@ -467,6 +468,58 @@ def is_gas_limit_target_compatible(
return gas_limit == min_gas_limit
```

```python
def should_reorg_head(store: Store, head_root: Root, slot: Slot) -> bool:
"""
Check if this node would re-org the head block when proposing at ``slot``.
"""
head_block = store.blocks[head_root]
parent_root = head_block.parent_root
parent_block = store.blocks[parent_root]

head_late = is_head_late(store, head_root)
ffg_competitive = is_ffg_competitive(store, head_root, parent_root)
finalization_ok = is_finalization_ok(store, slot)
parent_slot_ok = parent_block.slot + Slot(1) == head_block.slot
current_time_ok = head_block.slot + Slot(1) == slot
single_slot_reorg = parent_slot_ok and current_time_ok
head_weak = is_head_weak(store, head_root)
parent_strong = is_parent_strong(store, head_root)

return all([
head_late,
ffg_competitive,
finalization_ok,
single_slot_reorg,
head_weak,
parent_strong,
])
```

```python
def is_bid_on_current_head(store: Store, bid: ExecutionPayloadBid) -> bool:
"""
Check if ``bid`` has the same parent information as this node would propose.
"""
head_node = get_head(store)
head_block = store.blocks[head_node.root]
head_bid = head_block.body.signed_execution_payload_bid.message

builds_on_parent_block = bid.parent_block_root == head_block.parent_root
builds_on_parent_payload = bid.parent_block_hash == head_bid.parent_block_hash
builds_on_head_block = bid.parent_block_root == head_node.root
builds_on_head_payload = bid.parent_block_hash == head_bid.block_hash

if should_reorg_head(store, head_node.root, bid.slot):
return builds_on_parent_block and builds_on_parent_payload
if not builds_on_head_block:
return False
if should_build_on_full(store, head_node, bid.slot):
return builds_on_head_payload

return builds_on_parent_payload
```

*Note*: Implementations SHOULD include DoS prevention measures to mitigate spam
from malicious builders submitting numerous bids with minimal value increments.
Possible strategies include: (1) only forwarding bids that exceed the current
Expand Down
21 changes: 11 additions & 10 deletions specs/gloas/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ top of a `state` MUST take the following actions in order to construct the
- The `bid.slot` is for the proposal block slot.
- The `bid.parent_block_hash` equals
`state.latest_execution_payload_bid.block_hash` if
`should_build_on_full(store, head)` is true, otherwise
`state.latest_execution_payload_bid.parent_block_hash`.
`should_build_on_full(store, head, get_current_slot(store))` is true,
otherwise `state.latest_execution_payload_bid.parent_block_hash`.
- The `bid.parent_block_root` equals the current block's `parent_root`.
- The `bid.prev_randao` equals
`get_randao_mix(state, get_current_epoch(state))`.
Expand Down Expand Up @@ -248,9 +248,9 @@ parent's execution payload. The proposer constructs this field as follows:

- If the parent block is pre-Gloas (first Gloas block), set
`parent_execution_requests` to an empty `ExecutionRequests()`.
- If `should_build_on_full(store, head)` returns `True` (the proposer is
building on the parent's full payload), set `parent_execution_requests` to
`store.payloads[head.root].execution_requests`.
- If `should_build_on_full(store, head, get_current_slot(store))` returns `True`
(the proposer is building on the parent's full payload), set
`parent_execution_requests` to `store.payloads[head.root].execution_requests`.
- Otherwise (the proposer is building on the parent's empty variant), set
`parent_execution_requests` to an empty `ExecutionRequests()`.

Expand Down Expand Up @@ -319,10 +319,11 @@ def get_execution_requests(execution_requests_list: Sequence[bytes]) -> Executio
##### ExecutionPayload

*Note*: `prepare_execution_payload` is modified to build on the parent's full
payload or its empty variant, as decided by `should_build_on_full(store, head)`,
which determines the withdrawals source and the execution head for the new
payload. When building on a full parent, `apply_parent_execution_payload` is
called so that withdrawals are computed against the post-processing state.
payload or its empty variant, as decided by
`should_build_on_full(store, head, get_current_slot(store))`, which determines
the withdrawals source and the execution head for the new payload. When building
on a full parent, `apply_parent_execution_payload` is called so that withdrawals
are computed against the post-processing state.

```python
def prepare_execution_payload(
Expand All @@ -340,7 +341,7 @@ def prepare_execution_payload(
) -> Optional[PayloadId]:
# [New in Gloas:EIP7732]
parent_bid = state.latest_execution_payload_bid
if should_build_on_full(store, head):
if should_build_on_full(store, head, get_current_slot(store)):
envelope = store.payloads[head.root]
# Make a copy of the state to avoid mutability issues
state = copy(state)
Expand Down
2 changes: 1 addition & 1 deletion specs/heze/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def prepare_execution_payload(
execution_engine: ExecutionEngine,
) -> Optional[PayloadId]:
parent_bid = state.latest_execution_payload_bid
if should_build_on_full(store, head):
if should_build_on_full(store, head, get_current_slot(store)):
envelope = store.payloads[head.root]
# Make a copy of the state to avoid mutability issues
state = copy(state)
Expand Down