-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat(sims): Add sims2 framework and factory methods (backport #21613) #21752
feat(sims): Add sims2 framework and factory methods (backport #21613) #21752
Conversation
(cherry picked from commit bf77680) # Conflicts: # CHANGELOG.md # go.mod # simapp/sim_bench_test.go # testutil/sims/state_helpers.go # x/params/go.mod # x/staking/go.mod
Cherry-pick of bf77680 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Please cherry-pick this PR in here: #21763 |
Please enter the commit message for your changes. Lines starting
(cherry picked from commit 3314cfb)
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.
Looks good now
Description
This PR introduces some new helper types to simplify message construction for simulations (sims). The focus is on better dev UX for new message factories.
Technically, they are adapters that build upon the existing sims framework.
This PR also included the refactoring for all
x</module>/simulation/operations
into the new factory structures.(Reviewer note at the end)
* Message factory
Simple functions as factories for dedicated sdk.Msgs. They have access to the context, reporter and test data environment. For example:
* Sims registry
A new helper to register message factories with a default weight value. They can be overwritten by a parameters file as before. The registry is passed to the AppModule type. For example:
* Reporter
The reporter is a flow control structure that can be used in message factories to skip execution at any point. The idea is similar to the testing.T Skip in Go stdlib. Internally, it converts skip, success and failure events to legacy sim messages.
The reporter also provides some capability to print an execution summary.
It is also used to interact with the test data environment to not have errors checked all the time.
Message factories may want to abort early via
* Test data environment
The test data environment provides simple access to accounts and other test data used in most message factories. It also encapsulates some app internals like bank keeper or address codec.
Note to the reviewers
Apologies for this big PR. 🙈 It created too much extra work to keep the smaller PRs updated with changes in main as they pile up.
Please note. the
gov
module is the most complex one compared to the others due to the proposal and legacy support.simsx
is not necessarily the best name. If somebody would come up with a better name, I would refactor this in a new PR. Naming is hardSummary by CodeRabbit
New Features
SelectBy
method in the API for enhanced thread-safe operations.sims2
framework with factory methods for simplified message creation.Bug Fixes
Refactor
Documentation
Tests
This is an automatic backport of pull request #21613 done by [Mergify](https://mergify.com).