Skip to content

factory: simplify validator and genesis factory functions#7305

Merged
williambanfield merged 2 commits intowb/proposer-based-timestampsfrom
wb/remove-rand-state-helpers
Nov 22, 2021
Merged

factory: simplify validator and genesis factory functions#7305
williambanfield merged 2 commits intowb/proposer-based-timestampsfrom
wb/remove-rand-state-helpers

Conversation

@williambanfield
Copy link
Contributor

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 Validator constructors in the test/factory package took a bool parameter that indicated if a random amount of voting power should be added to the passed in minPower. This bool was set to true at very few call sites, but was threaded all the way through the helper functions that used the Validator constructor. This change removes the bool parameter and instead updates the few places where a random amount of voting power is required to generate a random number.

Additionally, the Genesis consuctor has been updated to take a time.Time to be used as the genesis time. It has also been updated to take a types.ConsensusParams instead of just using the default. The helper functions that wrap the constructor have been updated to use types.DefaultConsensusParams() so the functionality is identical for most callers.

Copy link

@creachadair creachadair left a comment

Choose a reason for hiding this comment

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

An optional suggestion, but otherwise LGTM.

@williambanfield williambanfield merged commit 11e228a into wb/proposer-based-timestamps Nov 22, 2021
@williambanfield williambanfield deleted the wb/remove-rand-state-helpers branch November 22, 2021 20:55
@williambanfield williambanfield restored the wb/remove-rand-state-helpers 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.

2 participants