feat(sims): Add simsx support to modules (#24145)

Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
This commit is contained in:
Alexander Peters
2025-04-02 13:23:36 +00:00
committed by GitHub
co-authored by Alex | Interchain Labs
parent 99da3279be
commit ea908cef68
53 changed files with 2025 additions and 241 deletions
+9
View File
@@ -19,6 +19,7 @@ import (
sdkclient "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/simsx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
@@ -196,6 +197,7 @@ func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) {
}
// WeightedOperations returns the all the gov module operations with their respective weights.
// This method is ignored when WeightedOperationsX exists and will be removed in the future
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
return simulation.WeightedOperations(
am.registry,
@@ -203,3 +205,10 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
am.accountKeeper, am.bankKeeper, am.keeper,
)
}
// WeightedOperationsX registers weighted authz module operations for simulation.
func (am AppModule) WeightedOperationsX(weights simsx.WeightSource, reg simsx.Registry) {
reg.Add(weights.Get("msg_grant", 100), simulation.MsgGrantFactory())
reg.Add(weights.Get("msg_revoke", 90), simulation.MsgRevokeFactory(am.keeper))
reg.Add(weights.Get("msg_exec", 90), simulation.MsgExecFactory(am.keeper))
}