forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sim): implement the beginning of a replacement simulator
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)
- Loading branch information
1 parent
9411747
commit dc967dd
Showing
20 changed files
with
516 additions
and
1,073 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.