Skip to content

Gossip: fix time-based tiebreak in test_refresh_vote_eviction#11351

Merged
alexpyattaev merged 1 commit intoanza-xyz:masterfrom
alexpyattaev:fix_test_refresh_vote_eviction
Mar 17, 2026
Merged

Gossip: fix time-based tiebreak in test_refresh_vote_eviction#11351
alexpyattaev merged 1 commit intoanza-xyz:masterfrom
alexpyattaev:fix_test_refresh_vote_eviction

Conversation

@alexpyattaev
Copy link
Copy Markdown

@alexpyattaev alexpyattaev commented Mar 17, 2026

Problem

  • Gossip can hold up to 12 votes, so when we push new votes we may need to evict old ones from CRDS.
  • This eviction is timestamp-based to facilitate refresh votes (which may be cast for the same slot).
  • test_refresh_vote_eviction ended up flaking due to identical timestamps, that resulted in the wrong items getting evicted. Failure was intermittent due to pubkey being part of the eviction tiebreak (which allowed it to pass sometimes).

Summary of Changes

  • Add sleep between inserts to ensure deterministic operation
  • This is not an issue in practice because we are not likely to switch votes within 1 ms in production environment

Context:

https://discord.com/channels/428295358100013066/560503042458517505/1483166748491518014

@alexpyattaev alexpyattaev requested a review from a team as a code owner March 17, 2026 18:43
let mut first_vote = None;
let mut prev_votes = vec![];
for slot in 1..max_vote_slot {
for slot in lowest_vote_slot..max_vote_slot {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to lowest_vote_slot to match what the variable is actually set to a few lines above.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.2%. Comparing base (5b3a874) to head (47504f6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #11351   +/-   ##
=======================================
  Coverage    83.2%    83.2%           
=======================================
  Files         841      841           
  Lines      318444   318446    +2     
=======================================
+ Hits       265125   265138   +13     
+ Misses      53319    53308   -11     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@gregcusack gregcusack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@alexpyattaev alexpyattaev added this pull request to the merge queue Mar 17, 2026
Merged via the queue into anza-xyz:master with commit fbcc946 Mar 17, 2026
51 checks passed
@alexpyattaev alexpyattaev deleted the fix_test_refresh_vote_eviction branch March 17, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants