Page MenuHomePhabricator

[avalanche] Only allow contender cache cleanup up to the height of the last promoted block
ClosedPublic

Authored by roqqit on Nov 4 2024, 20:35.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABCa66b32711df2: [avalanche] Only allow contender cache cleanup up to the height of the last…
Summary

If contender cache cleanup occurs at height N before promoteToBlock() has been called at that height, data loss could occur by cleaning up cached remote proofs that have not been promoted yet.

In practice, the cache is always promoting entries ahead of the cleanup height, which is the height of the last finalized block. However, promotions do not occur until the first block is finalized in order to prevent uncontrolled cache growth, so this change also ensures proofs received before the first finalized block are not cleaned up until they are promoted.

Test Plan
ninja check-avalanche-stakecontendercache_tests

Diff Detail

Event Timeline

Owners added a reviewer: Restricted Owners Package.Nov 4 2024, 20:35
roqqit requested review of this revision.Nov 4 2024, 20:35
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/avalanche/stakecontendercache.h
91 ↗(On Diff #50651)

style nit

This revision is now accepted and ready to land.Nov 4 2024, 21:26