HomePhabricator

[avalanche] Only allow contender cache cleanup up to the height of the last…

Description

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

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

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17075

Details

Provenance
roqqitAuthored on Nov 4 2024, 20:08
roqqitPushed on Nov 5 2024, 00:05
Reviewer
Restricted Owners Package
Differential Revision
D17075: [avalanche] Only allow contender cache cleanup up to the height of the last promoted block
Parents
rABC5e91e0989f8b: [avalanche] Always print the finalization messages
Branches
Unknown
Tags
Unknown