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

fix(x/mint): fix sim failure #12459

Closed
wants to merge 1 commit into from
Closed

Conversation

kocubinski
Copy link
Member

Description

This fixes a recently introduced sim failure:

    simulate.go:302: error on block  1/50, operation (270/367) from x/gov:
        recovered: parameter InflationRateChange not registered
        stack:
        goroutine 73 [running]:
        stack:
        goroutine 103 [running]:
        runtime/debug.Stack()
        	/home/mkoco/sdk/go1.18.2/src/runtime/debug/stack.go:24 +0x65
        github.com/cosmos/cosmos-sdk/baseapp.newDefaultRecoveryMiddleware.func1({0x1bd1f20, 0xc000b12290})
<...snip...>
        github.com/cosmos/cosmos-sdk/x/params/types.Subspace.Update({{0x7fd83c4489c0, 0xc00049eb10}, 0xc000038650, {0x28f3380, 0xc000dd2100}, {0x28f33d0, 0xc000dd2400}, {0xc000d48e78, 0x4, 0x8}, ...}, ...)
        	/home/mkoco/dev/regen/cosmos-sdk/x/params/types/subspace.go:212 +0x3fb
        github.com/cosmos/cosmos-sdk/x/params.handleParameterChangeProposal({{0x2908f30, 0xc000058100}, {0x2916660, 0xc0031a1340}, {{0x0, 0x0}, {0x1f0a790, 0xe}, 0x1, {0x0, ...}, ...}, ...}, ...)
        	/home/mkoco/dev/regen/cosmos-sdk/x/params/proposal_handler.go:37 +0x445
        github.com/cosmos/cosmos-sdk/x/params.NewParamChangeProposalHandler.func1({{0x2908f30, 0xc000058100}, {0x2916660, 0xc0031a1340}, {{0x0, 0x0}, {0x1f0a790, 0xe}, 0x1, {0x0, ...}, ...}, ...}, ...)
        	/home/mkoco/dev/regen/cosmos-sdk/x/params/proposal_handler.go:18 +0xbe
        github.com/cosmos/cosmos-sdk/x/gov/keeper.msgServer.ExecLegacyContent({0x40d505?}, {0x2908fa0?, 0xc0031c6720?}, 0x0?)
        	/home/mkoco/dev/regen/cosmos-sdk/x/gov/keeper/msg_server.go:103 +0x568
<...snip...>

However it also reintroduces the dependency x/mint -> x/params which was removed in #12363


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@kocubinski kocubinski requested a review from a team as a code owner July 5, 2022 19:55
@kocubinski kocubinski requested a review from alexanderbez July 5, 2022 19:55
@kocubinski kocubinski changed the title fix(x/mint) fix sim failure fix(x/mint): fix sim failure Jul 5, 2022
@codecov
Copy link

codecov bot commented Jul 5, 2022

Codecov Report

Merging #12459 (19c9ef3) into main (ec0c809) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12459      +/-   ##
==========================================
- Coverage   65.65%   65.62%   -0.04%     
==========================================
  Files         684      683       -1     
  Lines       71637    71564      -73     
==========================================
- Hits        47035    46964      -71     
- Misses      21954    21958       +4     
+ Partials     2648     2642       -6     
Impacted Files Coverage Δ
x/mint/keeper/keeper.go 77.96% <100.00%> (+1.18%) ⬆️
x/mint/module.go 58.76% <100.00%> (+0.42%) ⬆️
x/distribution/simulation/operations.go 80.85% <0.00%> (-9.58%) ⬇️
core/appconfig/config.go

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We removed x/params from x/mint on purpose and we're going to do this for every module. Instead, I think we need to return an empty slice for RandomizedParams

@alexanderbez
Copy link
Contributor

#12461 should do it

I'm not sure how the original PR was green though as the simulation fails

@@ -40,6 +42,11 @@
panic(fmt.Sprintf("the x/%s module account has not been set", types.ModuleName))
}

// set KeyTable if it has not already been set
if !paramSpace.HasKeyTable() {
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())

Check warning

Code scanning / CodeQL

Useless assignment to local variable

This definition of paramSpace is never used.
@kocubinski
Copy link
Member Author

#12461 should do it

I'm not sure how the original PR was green though as the simulation fails

I don't think Sims run in PR checks.

@alexanderbez
Copy link
Contributor

The single seed non-determinism one does. I found the issue and resolved it in my PR 👍

@alexanderbez alexanderbez deleted the kocubinski/mint-sims-fix branch July 5, 2022 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants