Skip to content

consensus: ensure proposal receipt waits for maxWaitingTime - #7307

Merged
williambanfield merged 6 commits into
wb/proposer-based-timestampsfrom
wb/validator-waits-for-proposal
Nov 30, 2021
Merged

williambanfield merged 6 commits into
wb/proposer-based-timestampsfrom
wb/validator-waits-for-proposal

Conversation

@williambanfield

@williambanfield williambanfield commented Nov 22, 2021 •

Copy link
Copy Markdown
Contributor

This pull request implements the Propose Step Timeout changes described in ADR 71.

This code change implements this by taking the max of the recently added proposalStepWaitingTime(...) method and the configured timeout-propose value and changes the scheduled RoundStepPropose timeout to occur after this maximum waiting time.

This change also adds a small test harness for the ongoing proposer-based timestamp work. The test harness, aims to make it easier to write tests for the pbts timing logic. The first test cases that are added ensure that the consensus algorithm correctly prevotes nil when no block is delivered by the waitingTime and ensure that the consensus mechanism prevotes the block if it is delivered before waitingTime has elapsed but after timeout-propose has elapsed.

related to: #6942

@williambanfield
williambanfield force-pushed the wb/validator-waits-for-proposal branch 2 times, most recently from 25e52b6 to 7fc1a4d Compare November 23, 2021 21:01
@williambanfield
williambanfield marked this pull request as ready for review November 23, 2021 21:19
@williambanfield
williambanfield requested review from cason and removed request for alexanderbez and tessr November 23, 2021 21:19

@creachadair creachadair 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 have a few comments, but on a whole this seems pretty solid. I would like to request a bit more documentation on some of the unexported plumbing, while it's still fresh in your mind, but it all seems to make sense.

Comment thread internal/consensus/common_test.go Resolved
Comment thread internal/consensus/state.go Resolved
Comment thread internal/consensus/state.go Resolved
Comment thread internal/consensus/pbts_test.go Resolved
Comment thread internal/consensus/pbts_test.go Resolved
Comment thread internal/consensus/pbts_test.go Resolved
Comment thread internal/consensus/pbts_test.go Resolved
Comment thread internal/consensus/pbts_test.go Resolved
Comment thread internal/consensus/pbts_test.go Resolved
@williambanfield
williambanfield force-pushed the wb/proposer-based-timestamps branch from 1bb11c3 to 6be5efa Compare November 24, 2021 23:55
@williambanfield
williambanfield force-pushed the wb/validator-waits-for-proposal branch from d410577 to 2e0c654 Compare November 24, 2021 23:56
// The test delivers the block to the validator after the configured `timeout-propose`,
// but before the proposer-based timestamp bound on block delivery and checks that
// the consensus algorithm correctly waits for the new block to be delivered
// and issues a prevote for it.

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 think this test will become obsolete, as we don't plan to associate timeout-propose to MSGDELAY anymore, see: tendermint/spec#370

return ch
}

func subscribeToVoterBuffered(ctx context.Context, t *testing.T, cs *State, addr []byte) <-chan tmpubsub.Message {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could probably omit "Buffered" here, since by the time this merges to master, that distinction won't exist.

Comment thread internal/consensus/common_test.go Outdated
msg, err := votesSub.Next(ctx)
if err != nil {
if !errors.Is(err, pubsub.ErrTerminated) && !errors.Is(err, context.Canceled) {
t.Fatalf("error retrieving value of subscription %s", err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
t.Fatalf("error retrieving value of subscription %s", err)
t.Errorf("error retrieving value of subscription %s", err)

This is in a different goroutine from the test, so it can't safely fatal (which terminates the goroutine, but not the right one)

@williambanfield
williambanfield merged commit 1d68f34 into wb/proposer-based-timestamps Nov 30, 2021
@williambanfield
williambanfield deleted the wb/validator-waits-for-proposal branch November 30, 2021 14:45
williambanfield added a commit that referenced this pull request Jan 15, 2022
* consensus: ensure proposal receipt waits for maxWaitingTime

* rebase fixups

* lint++

* lint++

* register result chan separately

* lint++
@williambanfield
williambanfield restored the wb/validator-waits-for-proposal branch September 9, 2022 16:14
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.

3 participants