Repository navigation
kona-gossip: make block timestamp bound tests clock-safe - #23981
Merged
Merged
Conversation
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>
joshklop
approved these changes
Nov 8, 2026
joshklop
left a comment
Contributor
There was a problem hiding this comment.
Maybe we should increase by more than 10 even, just to make it airtight.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a flake in
test_block_invalid_timestamp_too_far. The test builds a block at wall-clock secondtwith timestampt + 6.block_validthen reads the clock again. If a second boundary passes between the two reads, the validator seest + 1, so the block is exactly at thecurrent + 5bound 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(-= 61against 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 + 6edge, but it is a larger refactor than this one flake needs.rust-code-reviewerran on the diff: no findings beyond a comment-wording nit, which is applied.🤖 Generated with Claude Code