Skip to content

kona-gossip: make block timestamp bound tests clock-safe - #23981

Merged
joshklop merged 1 commit into
developfrom
kona-gossip-timestamp-test-clock-race
Nov 8, 2026
Merged

joshklop merged 1 commit into
developfrom
kona-gossip-timestamp-test-clock-race

Conversation

@teddyknox

Copy link
Copy Markdown
Contributor

Fixes a flake in test_block_invalid_timestamp_too_far. The test builds a block at wall-clock second t with timestamp t + 6. block_valid then reads the clock again. If a second boundary passes between the two reads, the validator sees t + 1, so the block is exactly at the current + 5 bound and is accepted. This failed on an RWX runner during the RWX CI pilot (#23151). With an offset of 10, the test fails only if more than 4 seconds pass. There is no effect on users. The production bound is unchanged.

test_block_invalid_timestamp_early (-= 61 against the 60-second bound) is not racy and is unchanged: forward clock movement only pushes its block further into the past. Only a backward clock step could break it.

I did not inject the current time into the handler. That would let tests assert the exact now + 5 / now + 6 edge, but it is a larger refactor than this one flake needs. rust-code-reviewer ran on the diff: no findings beyond a comment-wording nit, which is applied.

🤖 Generated with Claude Code

test_block_invalid_timestamp_too_far built a block at wall-clock
second t with timestamp t + 6, then validated it against a fresh
SystemTime::now(). If a second boundary passed between the two reads,
the validator saw t + 1, the block sat exactly on the current + 5
bound, and it was accepted. Use an offset of 10 so the test fails only
if more than 4 seconds pass.

test_block_invalid_timestamp_early is unchanged: forward clock movement
only pushes its block further past the 60-second bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@teddyknox
teddyknox requested a review from a team as a code owner November 6, 2026 20:12

@joshklop joshklop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we should increase by more than 10 even, just to make it airtight.

@joshklop
joshklop added this pull request to the merge queue Nov 8, 2026
Merged via the queue into develop with commit 34625bb Nov 8, 2026
120 checks passed
@joshklop
joshklop deleted the kona-gossip-timestamp-test-clock-race branch November 8, 2026 22:23
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.

2 participants