-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
EPIC: Simulator #14753
Comments
I know dYdX wants #13843 |
|
I have implemented simulations from 0 this week, and I have some feedback:
If anyone is interested, I can link the PR for this change to illustrate how much appears to be needed, just get started. Since this is more about features, I just leave my feedback on docs here at the bottom so they are somewhere at least:
|
This is great feedback @gjermundgaraba, thank you! |
@gjermundgaraba I'm working on the simulator rewrite I'd like to see the PR you did to integrate simulation. |
Happy to! Here it is :) |
This change implements a replacement for the current simulator based on testutil/network. Most of the changes are porting the module specific message generators to no longer rely on SimulationState, and to generate "real" messages, not simulator messages. The simulator driver is in simapp, as part of the IntegationTestSuite. The new approach aims to improve simulation in two important ways: - Simulation should more closely mimic a real network. The current simulator message delivery is implemented parallel to non-simulator message delivery, leading to loss of fidelity and higher maintenance. One symptom is cosmos#13843. - Simulation should be layered on top of modules, not part of modules. This means that modules should not import simulation packages, nor refer to its generator package (x/module/simulation). This should eventually fix cosmos#7622. There are also downsides, however. Where the current simulator is too high level, testutil/network is too low level: it runs a real network of validators which is difficult to control. For example: - AppHashes differ between runs, because modules may depend on non- deterministic state such as block header timestamps. - The validators runs in separate goroutines, which makes it hard to query app state without introducing race conditions. - Blocks are produced according tot time, and not under control by the test driver. This makes it hard to trigger processing of messages in particular blocks, which ruins determinism. Some of the issues may be worked around, for example by forcing the block headers to be deterministic; however, the real fix is to make testutil/network itself deterministic, providing the goldilock level of simulation: close enough to a real network, yet deterministic enough to generate the same chain state for a given random seed. A deterministic testutil/network is part of cosmos#18145. Future work includes: - Porting of the remaining module message generators. - Generating (and verifying) deterministic AppHashes, allowing reliable replay when a problematic message is detected. Depends on cosmos#18145. - Save/reload of state for faster debugging cycles. - Removal of the old simulator, most importantly the reference to it from module code. Updates cosmos#14753 (Simulator rewrite epic) Updates cosmos#7622 (reducing imports from modules to simulator) Updates cosmos#13843 (using real message delivery for simulation)
I started adding simulation support in our chain and agree with @gjermundgaraba. My main ask is a hands-on guide/tutorial that explains how to add simulator support to your CosmosSDK app. Happy to help! |
thank you, @alpe is doing a cleanup right now with some new changes, after this we will create a tutorial on how to write simulations. :) |
With this pr we have concluded the simulation cleanup. If you'd like new features or have feedback let us know. Thank you |
Summary
This EPIC is the start of a tracking issue for features we would like to have in a simulator. We should identify the pitfalls of the current design, if any, and aim to provide a better user experience
One feature that would be nice is extend the simulator from a dumb fuzzer to a more intelligent fuzzer where improper messages would be caught if they errored.
Work Breakdown
TBD
I'd like to invite people to comment what features they would like to see from the simulator
The text was updated successfully, but these errors were encountered: