fix(consensus): correct vote-seal delay window math#421
Open
blakebyrnes wants to merge 1 commit intomainfrom
Open
fix(consensus): correct vote-seal delay window math#421blakebyrnes wants to merge 1 commit intomainfrom
blakebyrnes wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes vote-seal delay scheduling so miners are delayed to their intended percentile position within the current tick window, accounting for time already elapsed in the tick.
Changes:
- Correct delay math by computing a remaining delay (
target_offset - elapsed) rather than applying the full percentile offset from “now”. - Extract helper methods (
remaining_delay_for_percentile,percentile_tick_offset) to make the delay calculation testable and clearer. - Replace a timing-flaky test with deterministic unit tests for the delay math.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Schedule delayed vote-seal attempts from the remaining time in the current tick window instead of reapplying the full percentile offset. Add deterministic coverage for partial-elapsed tick cases.
60577b6 to
32ac45d
Compare
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.
Summary
Fix the vote-seal delay calculation so delayed miners are scheduled at the intended point within the current tick window.
Why
The existing delay logic could push delayed vote attempts later than intended once part of the tick had already elapsed.
Validation
cargo test -p argon-node-consensus --lib notebook_tick_checker