From 47eb2594186a5a7b45d02b4ea496d775118994f2 Mon Sep 17 00:00:00 2001 From: chatton Date: Thu, 21 Nov 2024 15:44:56 +0000 Subject: [PATCH] chore: fixing simulation functions --- .../simulation/proposals_test.go | 4 +++- modules/apps/transfer/simulation/proposals_test.go | 12 +++++------- modules/core/simulation/proposals_test.go | 4 +++- .../08-wasm/simulation/proposals_test.go | 4 +++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/modules/apps/27-interchain-accounts/simulation/proposals_test.go b/modules/apps/27-interchain-accounts/simulation/proposals_test.go index d10ab78c4fa..f3d5cc3becd 100644 --- a/modules/apps/27-interchain-accounts/simulation/proposals_test.go +++ b/modules/apps/27-interchain-accounts/simulation/proposals_test.go @@ -1,6 +1,7 @@ package simulation_test import ( + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" "math/rand" "testing" @@ -23,6 +24,7 @@ func TestProposalMsgs(t *testing.T) { r := rand.New(s) ctx := sdk.NewContext(nil, true, nil) + codec := codecaddress.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) accounts := simtypes.RandomAccounts(r, 3) tests := []struct { @@ -84,7 +86,7 @@ func TestProposalMsgs(t *testing.T) { require.Equal(t, simulation.OpWeightMsgUpdateParams, weightedMsg.AppParamsKey()) require.Equal(t, simulation.DefaultWeightMsgUpdateParams, weightedMsg.DefaultWeight()) - msg, err := weightedMsg.MsgSimulatorFn()(ctx, r, accounts, nil) + msg, err := weightedMsg.MsgSimulatorFn()(ctx, r, accounts, codec) require.NoError(t, err) if msgUpdateHostParams, ok := msg.(*hosttypes.MsgUpdateParams); ok { diff --git a/modules/apps/transfer/simulation/proposals_test.go b/modules/apps/transfer/simulation/proposals_test.go index 90add4d33da..3f27b4e6887 100644 --- a/modules/apps/transfer/simulation/proposals_test.go +++ b/modules/apps/transfer/simulation/proposals_test.go @@ -6,8 +6,9 @@ import ( "github.com/stretchr/testify/require" + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" + typesaddress "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/simulation" @@ -28,15 +29,12 @@ func TestProposalMsgs(t *testing.T) { w0 := weightedProposalMsgs[0] - // tests w0 interface: - require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) - require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) - - msg, err := w0.MsgSimulatorFn()(ctx, r, accounts, nil) + codec := codecaddress.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + msg, err := w0.MsgSimulatorFn()(ctx, r, accounts, codec) require.NoError(t, err) msgUpdateParams, ok := msg.(*types.MsgUpdateParams) require.True(t, ok) - require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Signer) + require.Equal(t, sdk.AccAddress(typesaddress.Module("gov")).String(), msgUpdateParams.Signer) require.EqualValues(t, msgUpdateParams.Params.SendEnabled, false) } diff --git a/modules/core/simulation/proposals_test.go b/modules/core/simulation/proposals_test.go index e34901e5228..23578134a1e 100644 --- a/modules/core/simulation/proposals_test.go +++ b/modules/core/simulation/proposals_test.go @@ -1,6 +1,7 @@ package simulation_test import ( + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" "math/rand" "testing" "time" @@ -34,7 +35,8 @@ func TestProposalMsgs(t *testing.T) { require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) require.Equal(t, simulation.DefaultWeight, w0.DefaultWeight()) - msg, err := w0.MsgSimulatorFn()(ctx, r, accounts, nil) + codec := codecaddress.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + msg, err := w0.MsgSimulatorFn()(ctx, r, accounts, codec) require.NoError(t, err) msgUpdateParams, ok := msg.(*clienttypes.MsgUpdateParams) require.True(t, ok) diff --git a/modules/light-clients/08-wasm/simulation/proposals_test.go b/modules/light-clients/08-wasm/simulation/proposals_test.go index 945b85863a9..441fd60e36d 100644 --- a/modules/light-clients/08-wasm/simulation/proposals_test.go +++ b/modules/light-clients/08-wasm/simulation/proposals_test.go @@ -1,6 +1,7 @@ package simulation_test import ( + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" "math/rand" "testing" @@ -30,7 +31,8 @@ func TestProposalMsgs(t *testing.T) { require.Equal(t, simulation.OpWeightMsgStoreCode, w0.AppParamsKey()) require.Equal(t, simulation.DefaultWeightMsgStoreCode, w0.DefaultWeight()) - msg, err := w0.MsgSimulatorFn()(ctx, r, accounts, nil) + codec := codecaddress.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + msg, err := w0.MsgSimulatorFn()(ctx, r, accounts, codec) require.NoError(t, err) msgStoreCode, ok := msg.(*types.MsgStoreCode) require.True(t, ok)