Skip to content

internal/consensus: proposer waits for previous block time#7376

Merged
williambanfield merged 15 commits intowb/proposer-based-timestampsfrom
wb/proposer-waits-state
Dec 8, 2021
Merged

internal/consensus: proposer waits for previous block time#7376
williambanfield merged 15 commits intowb/proposer-based-timestampsfrom
wb/proposer-waits-state

Conversation

@williambanfield
Copy link
Contributor

This change introduces the logic to have the proposer wait until the previous block time has passed before attempting to propose the next block.

The change achieves this by by adding a new clause into the enterPropose state machine method. The method now checks if the validator is the proposer and if the validator's clock is behind the previous block's time. If the validator's clock is behind the previous block time, it schedules a timeout to re-enter the enter propose method after enough time has passed.

This change also introduces a mild refactor to the pbts_test.go file. It updates the test harness to include a channel of time.Time, pubsub.Message pairs. This timestamped events channel provides a slightly more generalizable way to collect events from the observed validator associated with the time that they occured in the test.

@williambanfield williambanfield force-pushed the wb/proposer-waits-state branch from 9d5d5d5 to 67d3fb3 Compare December 3, 2021 15:08
@williambanfield williambanfield force-pushed the wb/proposer-waits-state branch from d3cb51c to a9a56a1 Compare December 3, 2021 18:37
@williambanfield williambanfield merged commit e91bac3 into wb/proposer-based-timestamps Dec 8, 2021
@williambanfield williambanfield deleted the wb/proposer-waits-state branch December 8, 2021 16:23
williambanfield added a commit that referenced this pull request Jan 15, 2022
This change introduces the logic to have the proposer wait until the previous block time has passed before attempting to propose the next block.

The change achieves this by by adding a new clause into the enterPropose state machine method. The method now checks if the validator is the proposer and if the validator's clock is behind the previous block's time. If the validator's clock is behind the previous block time, it schedules a timeout to re-enter the enter propose method after enough time has passed.
@williambanfield williambanfield restored the wb/proposer-waits-state 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.

3 participants