Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
Buf-Push / push (push) Has been cancelled
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package simulation_test
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/cosmos/cosmos-sdk/types/address"
|
|
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
|
|
|
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
|
|
|
"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/v10/simulation"
|
|
"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/v10/types"
|
|
)
|
|
|
|
func TestProposalMsgs(t *testing.T) {
|
|
// initialize parameters
|
|
s := rand.NewSource(1)
|
|
r := rand.New(s)
|
|
|
|
ctx := sdk.NewContext(nil, cmtproto.Header{}, true, nil)
|
|
accounts := simtypes.RandomAccounts(r, 3)
|
|
|
|
// execute ProposalMsgs function
|
|
weightedProposalMsgs := simulation.ProposalMsgs()
|
|
require.Equal(t, 1, len(weightedProposalMsgs))
|
|
w0 := weightedProposalMsgs[0]
|
|
|
|
require.Equal(t, simulation.OpWeightMsgStoreCode, w0.AppParamsKey())
|
|
require.Equal(t, simulation.DefaultWeightMsgStoreCode, w0.DefaultWeight())
|
|
|
|
msg := w0.MsgSimulatorFn()(r, ctx, accounts)
|
|
msgStoreCode, ok := msg.(*types.MsgStoreCode)
|
|
require.True(t, ok)
|
|
|
|
require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgStoreCode.Signer)
|
|
require.Equal(t, msgStoreCode.WasmByteCode, []byte{0x01})
|
|
}
|