-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding ScenarioBuilder #4812
Adding ScenarioBuilder #4812
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great that we have documentation for how this thing works!
height: 1, | ||
nonce: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we start from 0 instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I forgot why, but block at height 0 could not be produced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall!
I like the docs, but I think they might not survive the merciless grind of time in the current form :-) I suggest pushing most of them into the API comments and doc tests
pub mod scenario_builder; | ||
|
||
pub use crate::run_test::{BlockConfig, NetworkConfig, Scenario, TransactionConfig}; | ||
pub use crate::scenario_builder::ScenarioBuilder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a minor code smell -- now the caller can use ScenarioBuilder
as either runtime_tested::ScenarioBuilder
or runtime_tester::scenario_builer::ScenarioBuilder
, and it's not immediately clear from the code which variant is preferred.
I usually prefer to make API with only one possilbe import path. For smaller crates, it's usually best for the caller if all the API is available at root, and all the internals are private.
But that's a minor point, the code looks ok as is!
Adding an easier way to create basic scenarios.