Clarifications for proposer boost reorgs

This commit is contained in:
Michael Sproul 2023-10-26 17:44:48 +11:00
parent 35d444b9d2
commit 3f1bc20512
No known key found for this signature in database
GPG Key ID: 77B1309D2E54E914
4 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)` |
@ -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
@ -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
```