factory: simplify validator and genesis factory functions#7305
Merged
williambanfield merged 2 commits intowb/proposer-based-timestampsfrom Nov 22, 2021
Merged
factory: simplify validator and genesis factory functions#7305williambanfield merged 2 commits intowb/proposer-based-timestampsfrom
williambanfield merged 2 commits intowb/proposer-based-timestampsfrom
Conversation
creachadair
approved these changes
Nov 22, 2021
creachadair
left a comment
There was a problem hiding this comment.
An optional suggestion, but otherwise LGTM.
williambanfield
added a commit
that referenced
this pull request
Nov 24, 2021
williambanfield
added a commit
that referenced
this pull request
Jan 15, 2022
1 task
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.
This pull requests makes a few changes that will be helpful for writing the proposer-based timestamps tests. It simplifies a few of the existing test helpers and allows the addition of needed parameters.
First, the
Validatorconstructors in thetest/factorypackage took aboolparameter that indicated if a random amount of voting power should be added to the passed inminPower. Thisboolwas set totrueat very few call sites, but was threaded all the way through the helper functions that used theValidatorconstructor. This change removes theboolparameter and instead updates the few places where a random amount of voting power is required to generate a random number.Additionally, the
Genesisconsuctor has been updated to take atime.Timeto be used as the genesis time. It has also been updated to take atypes.ConsensusParamsinstead of just using the default. The helper functions that wrap the constructor have been updated to usetypes.DefaultConsensusParams()so the functionality is identical for most callers.