Skip to content
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

[Bug]: x/simulation: State is resetting to genesis between blocks. #20541

Closed
1 task done
SpicyLemon opened this issue Jun 4, 2024 · 3 comments · Fixed by #20936
Closed
1 task done

[Bug]: x/simulation: State is resetting to genesis between blocks. #20541

SpicyLemon opened this issue Jun 4, 2024 · 3 comments · Fixed by #20936

Comments

@SpicyLemon
Copy link
Collaborator

SpicyLemon commented Jun 4, 2024

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

I ran the TestAppImportExport sim twice, once for 1 block, once for 10, and compared the exported genesis json files. A lot of modules do not have any differences, even though there are ops in the logs indicating that the state was successfully changed.

I first found this in my own chain's sim. For a specific seed (that got used randomly), in block 3, op 11 is a x/group SubmitProposal which involves picking a random group, and calling the GroupInfo query. That query returns a "not found" error when the group doesn't exist, and the op isn't expecting an error for that case, so the error is propagated up and ultimately stops the sim early. This seed's genesis doesn't have any group entries. On blocks 1 and 2, the first x/group op is CreateGroup, which means the later ops (in the same block) have at least one group to randomly pick from. But in block 3, the first x/group op is SubmitProposal, so it tries to get group 0 resulting in that "not found" error.

The genesis json files for each seed (1 block vs 10 blocks) showed differences in these modules: bank, distribution, evidence, mint, slashing, and staking. But they have identical values for these modules: auth, authz, circuit, crisis, feegrant, genutil, gov, group, nft, upgrade, and vesting.

To be sure, I added some fmt.Printf calls in the group keeper to ouput values coming from groupTable.Sequence(). During each block, the numbers go up as expected, but the first x/group op in each block shows that the sequence has gone back to its genesis value. This is true for all the sims, and also for all the seeds that I've tried. I also tried both the memdb and golangdb backends, and both had the same symptoms.

Cosmos SDK Version

v0.50.6

How to reproduce?

In a terminal:

  1. Check out git checkout v0.50.6 -b tag-v0.50.6
  2. cd simapp
  3. runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 1 5 TestAppImportExport and make note of the temporary directory being used.
  4. runsim -Jobs=4 -SimAppPkg=. -ExitOnFail 10 5 TestAppImportExport and make note of the temporary directory being used.

Compare the sim_state-x.json files between the two temp directories for any given seed value x.

@ggrieco-tob
Copy link
Contributor

@alpe do you know if this affects #20490 in fuzzing mode as well?

@SpicyLemon
Copy link
Collaborator Author

@alpe do you know if this affects #20490 in fuzzing mode as well?

It affects anything that uses the SimulateFromSeed function.

@alpe
Copy link
Contributor

alpe commented Jul 11, 2024

Sorry for the late response. I can confirm and replicate the issue on my box.

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🥳 Done in Cosmos-SDK Legacy Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: 🥳 Done
Development

Successfully merging a pull request may close this issue.

4 participants