Skip to content

Commit

Permalink
Break long statement into two statements
Browse files Browse the repository at this point in the history
  • Loading branch information
saltiniroberto committed Apr 18, 2023
1 parent 334114d commit 36fcb81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion specs/bellatrix/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,12 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
assert block.slot > finalized_slot
# Check block is a descendant of the finalized block at the checkpoint finalized slot
assert store.finalized_checkpoint.root == get_checkpoint_block(
finalized_checkpoint_block = get_checkpoint_block(
store,
block.parent_root,
store.finalized_checkpoint.epoch,
)
assert store.finalized_checkpoint.root == finalized_checkpoint_block

# Check the block is valid and compute the post-state
state = pre_state.copy()
Expand Down
3 changes: 2 additions & 1 deletion specs/deneb/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
assert block.slot > finalized_slot
# Check block is a descendant of the finalized block at the checkpoint finalized slot
assert store.finalized_checkpoint.root == get_checkpoint_block(
finalized_checkpoint_block = get_checkpoint_block(
store,
block.parent_root,
store.finalized_checkpoint.epoch,
)
assert store.finalized_checkpoint.root == finalized_checkpoint_block

# [New in Deneb]
# Check if blob data is available
Expand Down
15 changes: 9 additions & 6 deletions specs/phase0/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,15 @@ def filter_block_tree(store: Store, block_root: Root, blocks: Dict[Root, BeaconB
voting_source.epoch + 2 >= current_epoch
)

finalized_checkpoint_block = get_checkpoint_block(
store,
block.parent_root,
store.finalized_checkpoint.epoch,
)

correct_finalized = (
store.finalized_checkpoint.epoch == GENESIS_EPOCH
or store.finalized_checkpoint.root == get_checkpoint_block(
store,
block_root,
store.finalized_checkpoint.epoch,
)
or store.finalized_checkpoint.root == finalized_checkpoint_block
)

# If expected finalized/justified, add to viable block-tree and signal viability to parent.
Expand Down Expand Up @@ -520,11 +522,12 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
assert block.slot > finalized_slot
# Check block is a descendant of the finalized block at the checkpoint finalized slot
assert store.finalized_checkpoint.root == get_checkpoint_block(
finalized_checkpoint_block = get_checkpoint_block(
store,
block.parent_root,
store.finalized_checkpoint.epoch,
)
assert store.finalized_checkpoint.root == finalized_checkpoint_block

# Check the block is valid and compute the post-state
state = pre_state.copy()
Expand Down

0 comments on commit 36fcb81

Please sign in to comment.