Skip to content

Commit

Permalink
Clarifications for proposer boost reorgs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Oct 26, 2023
1 parent 35d444b commit 3f1bc20
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CHURN_LIMIT_QUOTIENT: 65536
# 40%
PROPOSER_SCORE_BOOST: 40
# 20%
REORG_WEIGHT_THRESHOLD: 20
REORG_HEAD_WEIGHT_THRESHOLD: 20
# 160%
REORG_PARENT_WEIGHT_THRESHOLD: 160
# `2` epochs
Expand Down
2 changes: 1 addition & 1 deletion configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ CHURN_LIMIT_QUOTIENT: 32
# 40%
PROPOSER_SCORE_BOOST: 40
# 20%
REORG_WEIGHT_THRESHOLD: 20
REORG_HEAD_WEIGHT_THRESHOLD: 20
# 160%
REORG_PARENT_WEIGHT_THRESHOLD: 160
# `2` epochs
Expand Down
4 changes: 2 additions & 2 deletions specs/bellatrix/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ of the block to be proposed (due to withdrawals).

If `should_override_forkchoice_update` returns `True` but `get_proposer_head` later chooses the
canonical head rather than its parent, then this is a misprediction that will cause the node
to construct a payload with less notice. The result of `get_proposer_head` MUST be honoured in
preference to the heuristic method.
to construct a payload with less notice. The result of `get_proposer_head` MUST be preferred over
the result of `should_override_forkchoice_update` (when proposer reorgs are enabled).

## Helpers

Expand Down
5 changes: 3 additions & 2 deletions specs/phase0/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Any of the above handlers that trigger an unhandled exception (e.g. a failed ass
| Name | Value |
| ------------------------------------- | ------------ |
| `PROPOSER_SCORE_BOOST` | `uint64(40)` |
| `REORG_WEIGHT_THRESHOLD` | `uint64(20)` |
| `REORG_HEAD_WEIGHT_THRESHOLD` | `uint64(20)` |
| `REORG_PARENT_WEIGHT_THRESHOLD` | `uint64(160)`|
| `REORG_MAX_EPOCHS_SINCE_FINALIZATION` | `Epoch(2)` |

Expand Down Expand Up @@ -431,6 +431,7 @@ def is_finalization_ok(store: Store, slot: Slot) -> bool:

```python
def is_proposing_on_time(store: Store) -> bool:
# Use half `SECONDS_PER_SLOT // INTERVALS_PER_SLOT` as the proposer reorg deadline
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
proposer_reorg_cutoff = SECONDS_PER_SLOT // INTERVALS_PER_SLOT // 2
return time_into_slot <= proposer_reorg_cutoff
Expand All @@ -441,7 +442,7 @@ def is_proposing_on_time(store: Store) -> bool:
```python
def is_head_weak(store: Store, head_root: Root) -> bool:
justified_state = store.checkpoint_states[store.justified_checkpoint]
reorg_threshold = calculate_committee_fraction(justified_state, REORG_WEIGHT_THRESHOLD)
reorg_threshold = calculate_committee_fraction(justified_state, REORG_HEAD_WEIGHT_THRESHOLD)
head_weight = get_weight(store, head_root)
return head_weight < reorg_threshold
```
Expand Down

0 comments on commit 3f1bc20

Please sign in to comment.