diff --git a/CHANGELOG.md b/CHANGELOG.md index d6dc151f97..6b1179bbee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* [#12846](https://github.com/cosmos/cosmos-sdk/pull/12846) Remove `RandomizedParams` from the `AppModuleSimulation` interface which is no longer needed. * (events) [#12850](https://github.com/cosmos/cosmos-sdk/pull/12850) Add a new `fee_payer` attribute to the `tx` event that is emitted from the `DeductFeeDecorator` AnteHandler decorator. * (ci) [#12854](https://github.com/cosmos/cosmos-sdk/pull/12854) Use ghcr.io to host the proto builder image. Update proto builder image to go 1.19 * (x/bank) [#12706](https://github.com/cosmos/cosmos-sdk/pull/12706) Added the `chain-id` flag to the `AddTxFlagsToCmd` API. There is no longer a need to explicitly register this flag on commands whens `AddTxFlagsToCmd` is already called. diff --git a/UPGRADING.md b/UPGRADING.md index 35d548ce00..d171edac70 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -4,6 +4,10 @@ This guide provides instructions for upgrading to specific versions of Cosmos SD ## [Unreleased] +### Simulation + +Remove `RandomizedParams` from `AppModuleSimulation` interface. Previously, it used to generate random parameter changes during simulations, however, it does so through ParamChangeProposal which is now legacy. Since all modules were migrated, we can now safely remove this from `AppModuleSimulation` interface. + ### AppModule Interface Remove `Querier`, `Route` and `LegacyQuerier` from the app module interface. This removes and fully deprecates all legacy queriers. All modules no longer support the REST API previously known as the LCD, and the `sdk.Msg#Route` method won't be used anymore. diff --git a/simapp/utils.go b/simapp/utils.go index 4ab5434641..b18ff77dbe 100644 --- a/simapp/utils.go +++ b/simapp/utils.go @@ -67,7 +67,6 @@ func SimulationOperations(app App, cdc codec.JSONCodec, config simtypes.Config) } } - simState.ParamChanges = app.SimulationManager().GenerateParamChanges(config.Seed) simState.Contents = app.SimulationManager().GetProposalContents(simState) return app.SimulationManager().WeightedOperations(simState) } diff --git a/types/module/simulation.go b/types/module/simulation.go index 8cba909345..28f9b3b1cc 100644 --- a/types/module/simulation.go +++ b/types/module/simulation.go @@ -21,9 +21,6 @@ type AppModuleSimulation interface { // content functions used to simulate governance proposals ProposalContents(simState SimulationState) []simulation.WeightedProposalContent - // randomized module parameters for param change proposals - RandomizedParams(r *rand.Rand) []simulation.ParamChange - // register a func to decode the each module's defined types from their corresponding store key RegisterStoreDecoder(sdk.StoreDecoderRegistry) @@ -106,18 +103,6 @@ func (sm *SimulationManager) GenerateGenesisStates(simState *SimulationState) { } } -// GenerateParamChanges generates randomized contents for creating params change -// proposal transactions -func (sm *SimulationManager) GenerateParamChanges(seed int64) (paramChanges []simulation.ParamChange) { - r := rand.New(rand.NewSource(seed)) - - for _, module := range sm.Modules { - paramChanges = append(paramChanges, module.RandomizedParams(r)...) - } - - return -} - // WeightedOperations returns all the modules' weighted operations of an application func (sm *SimulationManager) WeightedOperations(simState SimulationState) []simulation.WeightedOperation { wOps := make([]simulation.WeightedOperation, 0, len(sm.Modules)) diff --git a/x/auth/module.go b/x/auth/module.go index 2505e44bbc..8f8165a916 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" modulev1 "cosmossdk.io/api/cosmos/auth/module/v1" "cosmossdk.io/core/appmodule" @@ -168,11 +167,6 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We return nil } -// RandomizedParams creates randomized auth param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder for auth module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.accountKeeper) diff --git a/x/authz/module/module.go b/x/authz/module/module.go index bced6e7a89..9890fed910 100644 --- a/x/authz/module/module.go +++ b/x/authz/module/module.go @@ -3,7 +3,6 @@ package authz import ( "context" "encoding/json" - "math/rand" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -209,11 +208,6 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes return nil } -// RandomizedParams creates randomized authz param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - // RegisterStoreDecoder registers a decoder for authz module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[keeper.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/bank/module.go b/x/bank/module.go index 0ca4e015eb..ab2167980a 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "time" modulev1 "cosmossdk.io/api/cosmos/bank/module/v1" @@ -183,15 +182,6 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP return nil } -// RandomizedParams creates randomized distribution param changes for the simulator. - -// TODO: Returns an empty slice which will make parameter changes a no-op during -// simulations. Once all modules are migrated, remove RandomizedParams from -// the simulation interface. -func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder for supply module's types func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} diff --git a/x/capability/module.go b/x/capability/module.go index 23ecad8e7c..f37be6984a 100644 --- a/x/capability/module.go +++ b/x/capability/module.go @@ -3,7 +3,6 @@ package capability import ( "encoding/json" "fmt" - "math/rand" "time" "cosmossdk.io/core/appmodule" @@ -159,11 +158,6 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes return nil } -// RandomizedParams creates randomized capability param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - // RegisterStoreDecoder registers a decoder for capability module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/distribution/module.go b/x/distribution/module.go index 068f50fcee..fdda3e932b 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" modulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" "cosmossdk.io/core/appmodule" @@ -184,15 +183,6 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes return simulation.ProposalContents(am.keeper) } -// RandomizedParams creates randomized distribution param changes for the simulator. - -// TODO: Returns an empty slice which will make parameter changes a no-op during -// simulations. Once all modules are migrated, remove RandomizedParams from -// the simulation interface. -func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder for distribution module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/evidence/module.go b/x/evidence/module.go index 03c9135a50..083a292170 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "cosmossdk.io/core/appmodule" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -174,11 +173,6 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes return nil } -// RandomizedParams creates randomized evidence param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - // RegisterStoreDecoder registers a decoder for evidence module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.keeper) diff --git a/x/feegrant/module/module.go b/x/feegrant/module/module.go index 402dc449e5..766173e1e9 100644 --- a/x/feegrant/module/module.go +++ b/x/feegrant/module/module.go @@ -3,7 +3,6 @@ package module import ( "context" "encoding/json" - "math/rand" "cosmossdk.io/core/appmodule" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -215,11 +214,6 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We return nil } -// RandomizedParams creates randomized feegrant param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - // RegisterStoreDecoder registers a decoder for feegrant module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[feegrant.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/gov/module.go b/x/gov/module.go index 3aa73ccfb0..d71c75ffec 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -6,7 +6,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "sort" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -334,13 +333,6 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We return simulation.ProposalContents() } -// TODO: Returns an empty slice which will make parameter changes a no-op during -// simulations. Once all modules are migrated, remove RandomizedParams from -// the simulation interface. -func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder for gov module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/group/module/module.go b/x/group/module/module.go index c0ad9a540c..1b0bfb0c6c 100644 --- a/x/group/module/module.go +++ b/x/group/module/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "cosmossdk.io/core/appmodule" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -206,11 +205,6 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes return nil } -// RandomizedParams creates randomized group param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - // RegisterStoreDecoder registers a decoder for group module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[group.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/mint/module.go b/x/mint/module.go index 6ee35876e8..ef01316142 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" modulev1 "cosmossdk.io/api/cosmos/mint/module/v1" "cosmossdk.io/core/appmodule" @@ -187,15 +186,6 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We return nil } -// RandomizedParams creates randomized mint param changes for the simulator. -// -// TODO: Returns an empty slice which will make parameter changes a no-op during -// simulations. Once all modules are migrated, remove RandomizedParams from -// the simulation interface. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder for mint module's types. func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/nft/module/module.go b/x/nft/module/module.go index b8054addf0..c03b535ed2 100644 --- a/x/nft/module/module.go +++ b/x/nft/module/module.go @@ -3,7 +3,6 @@ package module import ( "context" "encoding/json" - "math/rand" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -159,11 +158,6 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes return nil } -// RandomizedParams creates randomized nft param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - // RegisterStoreDecoder registers a decoder for nft module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[keeper.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/params/module.go b/x/params/module.go index 82ccd75c48..fb32960ab4 100644 --- a/x/params/module.go +++ b/x/params/module.go @@ -3,7 +3,6 @@ package params import ( "context" "encoding/json" - "math/rand" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -114,11 +113,6 @@ func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes return nil } -// RandomizedParams creates randomized distribution param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - // RegisterStoreDecoder doesn't register any type. func (AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {} diff --git a/x/slashing/module.go b/x/slashing/module.go index e0e5de62e3..a01a8b37de 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" modulev1 "cosmossdk.io/api/cosmos/slashing/module/v1" "cosmossdk.io/core/appmodule" @@ -179,11 +178,6 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We return nil } -// RandomizedParams creates randomized slashing param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder for slashing module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/staking/module.go b/x/staking/module.go index 6a2f740724..fd77ea806a 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "sort" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -288,11 +287,6 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We return nil } -// RandomizedParams creates randomized staking param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder for staking module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc)