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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions x/mint/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper

import (
"fmt"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"

"cosmossdk.io/math"
"github.com/tendermint/tendermint/libs/log"
Expand Down Expand Up @@ -29,6 +30,7 @@ type Keeper struct {
func NewKeeper(
cdc codec.BinaryCodec,
key storetypes.StoreKey,
paramSpace paramtypes.Subspace,
sk types.StakingKeeper,
ak types.AccountKeeper,
bk types.BankKeeper,
Expand All @@ -40,6 +42,11 @@ func NewKeeper(
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.
}

return Keeper{
cdc: cdc,
storeKey: key,
Expand Down
9 changes: 6 additions & 3 deletions x/mint/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"math/rand"

modulev1 "cosmossdk.io/api/cosmos/mint/module/v1"
Expand Down Expand Up @@ -238,9 +239,10 @@ func provideModuleBasic() runtime.AppModuleBasicWrapper {
type mintInputs struct {
depinject.In

Config *modulev1.Module
Key *store.KVStoreKey
Cdc codec.Codec
Config *modulev1.Module
Key *store.KVStoreKey
Cdc codec.Codec
Subspace paramtypes.Subspace

// LegacySubspace is used solely for migration of x/params managed parameters
LegacySubspace exported.Subspace
Expand All @@ -266,6 +268,7 @@ func provideModule(in mintInputs) mintOutputs {
k := keeper.NewKeeper(
in.Cdc,
in.Key,
in.Subspace,
in.StakingKeeper,
in.AccountKeeper,
in.BankKeeper,
Expand Down