feat: Remove RandomizedParams from the AppModuleSimulation interface (#12846)
* remove RandomizedParams from AppModuleSimulation interface * add changelog * add upgrading doc * nit fix Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
parent
f7e46ae6d3
commit
7496aa3d27
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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) {}
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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) {}
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user