Skip to content

Commit 04ee34c

Browse files
committed
revert to deneb-style fork-choice (is_data_available in on_block)
1 parent 80b94ba commit 04ee34c

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

specs/_features/eip7594/fork-choice.md

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
- [Introduction](#introduction)
99
- [Helpers](#helpers)
1010
- [Modified `is_data_available`](#modified-is_data_available)
11-
- [Modified `get_head`](#modified-get_head)
1211
- [Updated fork-choice handlers](#updated-fork-choice-handlers)
1312
- [Modified `on_block`](#modified-on_block)
1413

@@ -37,35 +36,11 @@ def is_data_available(beacon_block_root: Root) -> bool:
3736
)
3837
```
3938

40-
### Modified `get_head`
41-
42-
*Note*: children of the current `head` are required to be available in order to be considered by the fork-choice.
43-
44-
```python
45-
def get_head(store: Store) -> Root:
46-
# Get filtered block tree that only includes viable branches
47-
blocks = get_filtered_block_tree(store)
48-
# Execute the LMD-GHOST fork choice
49-
head = store.justified_checkpoint.root
50-
while True:
51-
# Get available children for the current slot
52-
children = [
53-
root for (root, block) in blocks.items()
54-
if block.parent_root == head and is_data_available(root)
55-
]
56-
if len(children) == 0:
57-
return head
58-
# Sort by latest attesting balance with ties broken lexicographically
59-
# Ties broken by favoring block with lexicographically higher root
60-
head = max(children, key=lambda root: (get_weight(store, root), root))
61-
```
62-
6339
## Updated fork-choice handlers
6440

6541
### Modified `on_block`
6642

67-
*Note*: The blob data availability check is removed. We import blocks regardless
68-
of their availability status, and move all filtering to the fork-choice (`get_head`).
43+
*Note*: The only modification is that `is_data_available` does not take `blob_kzg_commitments` as input.
6944

7045
```python
7146
def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
@@ -91,6 +66,9 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
9166
)
9267
assert store.finalized_checkpoint.root == finalized_checkpoint_block
9368

69+
# [Modified in EIP7594]
70+
assert is_data_available(hash_tree_root(block))
71+
9472
# Check the block is valid and compute the post-state
9573
block_root = hash_tree_root(block)
9674
state_transition(state, signed_block, True)

0 commit comments

Comments
 (0)