Skip to content

consensus: add calculation for proposal step waits from pbts - #7290

Merged
williambanfield merged 9 commits into
wb/proposer-based-timestampsfrom
wb/proposer-waits-until
Nov 23, 2021
Merged

williambanfield merged 9 commits into
wb/proposer-based-timestampsfrom
wb/proposer-waits-until

Conversation

@williambanfield

@williambanfield williambanfield commented Nov 16, 2021 •

Copy link
Copy Markdown
Contributor

This pull requests implements helper functions to for calculating sleep durations during the propose phase.

For more information on the inequalities in these functions, please see the proposer-based timestamps ADR. Specifically, this pull requests implements the proposer waits and changes to propose step timeout calculations.

Related to: #6942

Comment thread internal/consensus/state.go Resolved
Comment thread internal/consensus/state.go Resolved

@tychoish tychoish 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.

the new functions in state.go aren't actually called in any non-test functions, are you planning on doing a separate integration pass?

@williambanfield

williambanfield commented Nov 16, 2021 •

Copy link
Copy Markdown
Contributor Author

the new functions in state.go aren't actually called in any non-test functions, are you planning on doing a separate integration pass?

yeah, I'd like to get all of the pieces in place first. Once things are integrated, they'll begin to impact consensus and I want to make sure it looks good/is correct before I actually do that.

@cason cason left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I really did not understand the goal of the proposalStepWaitingTime method.

For me, the timeout propose event should be just scheduled to occur in timeout_propose duration plus proposalStepWaitingTime.

And if timeout_propose < 2 * Precision + msgDelay, well, we risk to prevote nil at a time at which we could still accept a timely Proposal. This is a poor choice of parameters, not a wrong behavior.

Comment thread internal/consensus/state.go Resolved
Comment thread internal/consensus/state.go Resolved
@williambanfield

williambanfield commented Nov 23, 2021 •

Copy link
Copy Markdown
Contributor Author

I really did not understand the goal of the proposalStepWaitingTime method.

For me, the timeout propose event should be just scheduled to occur in timeout_propose duration plus proposalStepWaitingTime.
And if timeout_propose < 2 * Precision + msgDelay, well, we risk to prevote nil at a time at which we could still accept a timely Proposal. This is a poor choice of parameters, not a wrong behavior.

The proposalStepWaitingTime method calculates the waitingTime defined here in the spec. I think we should discuss whether we want this to algorithm to just use the timeout-propose when timeout-propose is smaller than waitingTime on the upcoming spec changes. It will mean that picking the correct timeout-propose would affect liveness in a similar way it does now: if a block has not arrived by timeout-propose we prevote nil. This is the same as the current implementation, so I think that's a fine change, but I'd like further input from before making that change at the code level.

EDIT: I'm realizing that liveness may be affected by just using timeout-propose since the proposer now waits until after the Header.Time to proposer its block.

@williambanfield
williambanfield merged commit 1bb11c3 into wb/proposer-based-timestamps Nov 23, 2021
@williambanfield
williambanfield deleted the wb/proposer-waits-until branch November 23, 2021 20:32
williambanfield added a commit that referenced this pull request Nov 24, 2021
* initial proposerWaitsUntil implementation

* switch to duration for easier use with timeout scheduling

* add proposal step waiting time with tests

* minor aesthetic change to IsTimely

* minor language fix

* Update internal/consensus/state.go

Co-authored-by: M. J. Fromberger <[email protected]>

* reword comment

* change accuracy to precision

* move tests to separate pbts test file

Co-authored-by: M. J. Fromberger <[email protected]>
williambanfield added a commit that referenced this pull request Jan 15, 2022
* initial proposerWaitsUntil implementation

* switch to duration for easier use with timeout scheduling

* add proposal step waiting time with tests

* minor aesthetic change to IsTimely

* minor language fix

* Update internal/consensus/state.go

Co-authored-by: M. J. Fromberger <[email protected]>

* reword comment

* change accuracy to precision

* move tests to separate pbts test file

Co-authored-by: M. J. Fromberger <[email protected]>
@williambanfield
williambanfield restored the wb/proposer-waits-until branch September 9, 2022 16:13
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.

5 participants