Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
8 changes: 6 additions & 2 deletions fork_choice/safe-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ def get_safe_execution_block_hash(store: Store) -> Hash32:
safe_block_root = retrieve_fast_confirmed_root()
safe_block = store.blocks[safe_block_root]

# Return Hash32() if no payload is yet justified
if compute_epoch_at_slot(safe_block.slot) >= GLOAS_FORK_EPOCH:
safe_block_bid = safe_block.body.signed_execution_payload_bid.message
return safe_block_bid.parent_block_hash

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.

Just curious, why not safe_block_bid.block_hash?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because we yet don’t know if this payload is going to be canonical, do we?

if compute_epoch_at_slot(safe_block.slot) >= BELLATRIX_FORK_EPOCH:
return safe_block.body.execution_payload.block_hash
else:
# Return Hash32() if no safe block is yet available
return Hash32()
```

*Note*: This helper uses beacon block container extended in
[Bellatrix](../specs/bellatrix/beacon-chain.md).
[Bellatrix](../specs/bellatrix/beacon-chain.md) and
[Gloas](../specs/gloas/beacon-chain.md).
21 changes: 21 additions & 0 deletions specs/gloas/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- [Introduction](#introduction)
- [Types](#types)
- [Constants](#constants)
- [Protocols](#protocols)
- [`ExecutionEngine`](#executionengine)
- [`notify_forkchoice_updated`](#notify_forkchoice_updated)
- [Helpers](#helpers)
- [New `ForkChoiceNode`](#new-forkchoicenode)
- [Modified `PayloadAttributes`](#modified-payloadattributes)
Expand Down Expand Up @@ -75,6 +78,24 @@ This is the modification of the fork-choice accompanying the Gloas upgrade.
| `PTC_TIMELINESS_INDEX` | `1` |
| `NUM_BLOCK_TIMELINESS_DEADLINES` | `2` |

## Protocols

### `ExecutionEngine`

#### `notify_forkchoice_updated`

In Gloas, `finalized_block_hash` and `safe_block_hash` values **MUST** be
computed as the following. All other semantics of `notify_forkchoice_updated`
and its invocation are inherited from prior forks.

- `finalized_block_hash = finalized_block_bid.parent_block_hash`,
- `safe_block_hash = get_safe_execution_block_hash(store)`.

Where:

- `finalized_block = store.blocks[store.finalized_checkpoint.root]`,
- `finalized_block_bid = finalized_block.body.signed_execution_payload_bid.message`.

## Helpers

### New `ForkChoiceNode`
Expand Down