Skip to content

Commit

Permalink
Specify proposing_on_time condition
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Dec 8, 2022
1 parent 64c7231 commit 56f20f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion specs/bellatrix/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def should_override_forkchoice_update(
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
current_time_ok = (head_block.slot == current_slot or
(proposal_slot == current_slot and
time_into_slot < SECONDS_PER_SLOT // INTERVALS_PER_SLOT))
time_into_slot <= SECONDS_PER_SLOT // INTERVALS_PER_SLOT // 2))
single_slot_reorg = parent_slot_ok and current_time_ok

# Shuffling stable.
Expand Down
8 changes: 6 additions & 2 deletions specs/phase0/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ def get_proposer_head(store: Store, head_root: Root, slot: Slot) -> Root:
# Only re-org a single slot at most.
single_slot_reorg = parent_block.slot + 1 == head_block.slot and head_block.slot + 1 == slot

# Only re-org if we are proposing on-time.
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
proposing_on_time = time_into_slot <= SECONDS_PER_SLOT // INTERVALS_PER_SLOT // 2

# Do not re-org on an epoch boundary where the proposer shuffling could change.
shuffling_stable = slot % SLOTS_PER_EPOCH != 0

Expand All @@ -326,8 +330,8 @@ def get_proposer_head(store: Store, head_root: Root, slot: Slot) -> Root:
reorg_threshold = calculate_committee_fraction(justified_state, REORG_WEIGHT_THRESHOLD)
head_weak = head_weight < reorg_threshold

if all([head_late, finalization_ok, single_slot_reorg, shuffling_stable, ffg_competitive,
head_weak]):
if all([head_late, finalization_ok, single_slot_reorg, proposing_on_time, shuffling_stable,
ffg_competitive, head_weak]):
# We can re-org the current head by building upon its parent block.
return parent_root
else:
Expand Down

0 comments on commit 56f20f7

Please sign in to comment.