You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Total difficulty can be stored lower than before without fork choice re-weighing #387
total_difficulty::settle can store a total difficulty lower than what was
stored before, and fork choice does not re-weigh afterwards.
Total difficulty is the tiebreak that decides which branch wins. If a stored
value can decrease without fork choice reconsidering, a branch can keep a
position it would no longer earn on a fresh comparison.
Why it is filed Low
The reviewer did not demonstrate a reachable case, and nothing observed on
mainnet points at it. It is a shape-level concern about an invariant — "stored
total difficulty is monotonic for a given block" — that may simply not hold any
more.
What would settle it
State the intended invariant in settle's doc comment, then either enforce it or
trigger a fork-choice re-evaluation when a stored value decreases. A test that
settles a lower value and asserts the resulting head is the one we want would pin
whichever answer is correct.
Related: #258 (OverstatedDifficulty ceiling omits uncle work) and #253 (the
sampled difficulty bound runs only in snapshot sync) touch the same machinery.
Reported by the external reviewer; the anchor is theirs and has not been
re-derived here.
Activity