-
Notifications
You must be signed in to change notification settings - Fork 347
chore: wait in the precommit step without re-scheduling #2619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
won't merge until I run the script long enough and we're confident |
consensus/state.go
Outdated
| if !cs.rs.StartedPrecommitSleep.Load() { | ||
| cs.rs.StartedPrecommitSleep.Store(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use CompareAndSwap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evan-forbes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't call this a tolerance, but a wait (for the pr title) 🤷
the tolerance I would associate with #2621
cmwaters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little nervous about the logic but I can't think of any scenario that would be problematic
| cs.scheduleTimeout(waitTime, height, round, cstypes.RoundStepPrevoteWait) | ||
| if !cs.rs.StartedPrecommitSleep.Load() { | ||
| cs.rs.StartedPrecommitSleep.Store(true) | ||
| waitTime := cs.precommitDelay() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid the timer and unlocking relocking, if the waitTime is 0
We could even add the check prior like:
waitTime := ps.precommitDelay()
if !cs.rs.StartedPrecommitSleep.Load() && waitTime > 0 {
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the check above would complicate the if statement given the else branch that will return
…ecommit-race # Conflicts: # consensus/state.go
| decideProposal func(height int64, round int32) | ||
| doPrevote func(height int64, round int32) | ||
| setProposal func(proposal *types.Proposal) error | ||
| StartedPrecommitSleep atomic.Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to the state instead of the round state because we copy the latter in multiple places and it's not worth handling that now.
Closes celestiaorg/celestia-app#6124