refactor(sims)!: Remove Baseapp from sims (#21039)

This commit is contained in:
Alexander Peters
2024-07-24 12:40:01 +00:00
committed by GitHub
parent b536d11532
commit 1f0ce2f5b5
36 changed files with 140 additions and 255 deletions
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"cosmossdk.io/x/protocolpool/keeper"
"cosmossdk.io/x/protocolpool/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -47,7 +46,7 @@ func WeightedOperations(
// a random account sends a random amount of its funds to the community pool.
func SimulateMsgFundCommunityPool(txConfig client.TxConfig, ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
r *rand.Rand, app simtypes.AppEntrypoint, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
funder, _ := simtypes.RandomAcc(r, accs)
+3 -2
View File
@@ -1,6 +1,7 @@
package simulation
import (
"context"
"math/rand"
coreaddress "cosmossdk.io/core/address"
@@ -20,7 +21,7 @@ const (
func ProposalMsgs() []simtypes.WeightedProposalMsg {
return []simtypes.WeightedProposalMsg{
simulation.NewWeightedProposalMsg(
simulation.NewWeightedProposalMsgX(
OpWeightMsgCommunityPoolSpend,
DefaultWeightMsgCommunityPoolSpend,
SimulateMsgCommunityPoolSpend,
@@ -28,7 +29,7 @@ func ProposalMsgs() []simtypes.WeightedProposalMsg {
}
}
func SimulateMsgCommunityPoolSpend(r *rand.Rand, _ []simtypes.Account, cdc coreaddress.Codec) (sdk.Msg, error) {
func SimulateMsgCommunityPoolSpend(_ context.Context, r *rand.Rand, _ []simtypes.Account, cdc coreaddress.Codec) (sdk.Msg, error) {
// use the default gov module account address as authority
var authority sdk.AccAddress = address.Module("gov")
+2 -1
View File
@@ -1,6 +1,7 @@
package simulation_test
import (
"context"
"math/rand"
"testing"
@@ -32,7 +33,7 @@ func TestProposalMsgs(t *testing.T) {
assert.Equal(t, simulation.OpWeightMsgCommunityPoolSpend, w0.AppParamsKey())
assert.Equal(t, simulation.DefaultWeightMsgCommunityPoolSpend, w0.DefaultWeight())
msg, err := w0.MsgSimulatorFn()(r, accounts, addressCodec)
msg, err := w0.MsgSimulatorFn()(context.Background(), r, accounts, addressCodec)
assert.NilError(t, err)
msgCommunityPoolSpend, ok := msg.(*pooltypes.MsgCommunityPoolSpend)
assert.Assert(t, ok)