Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to wasmvm 2.0.0-rc.1 #1804

Merged
merged 45 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b1c5bfb
Update to wasmvm 2.0.0-rc.1
chipshort Feb 6, 2024
c7ba88f
Adjust to type changes and renamings
chipshort Feb 6, 2024
d4e6417
Adjust to nested results
chipshort Feb 6, 2024
e4d95c2
Fix StoreCode gas usage
chipshort Feb 7, 2024
54670c4
Add ValidateAddress impl
chipshort Feb 7, 2024
73e7ebb
go mod tidy
chipshort Feb 7, 2024
cca0005
Fix lint
chipshort Feb 7, 2024
244c55a
Reduce gas factor
chipshort Feb 7, 2024
c8f84ff
Fix wasmvm path in CI
chipshort Feb 7, 2024
ec2c70b
Fix address validation
chipshort Feb 8, 2024
ffe6aaa
Fix dockerfile
chipshort Feb 8, 2024
db25a82
Add cosmwasm_2_0 capability
chipshort Feb 8, 2024
dd992b0
Use different tempdir for each test run
chipshort Feb 14, 2024
5984896
Add cosmwasm_2_0 capability to README
chipshort Feb 15, 2024
6d7c91c
Remove unnecessary conversion
chipshort Feb 15, 2024
2ec0628
Fix TestAppStateDeterminism
chipshort Feb 15, 2024
137cb26
Fix TestAppImportExport
chipshort Feb 15, 2024
1d77a66
Fix errors
chipshort Feb 15, 2024
1037fc8
Use updated reflect contract
chipshort Feb 15, 2024
5e2d766
Update to wasmvm rc.2
chipshort Feb 16, 2024
3539fe9
Fix gas numbers
chipshort Feb 16, 2024
b88f84a
Fix Dockerfile
chipshort Feb 16, 2024
2887105
Handle TransferMsg.Memo field
chipshort Feb 16, 2024
a30e083
Add flattened msgResponses to SubMsgResponse
webmaster128 Jan 31, 2024
d6ec8d4
Fix MockMessageHandler
chipshort Feb 16, 2024
219da83
Run gofumpt
chipshort Feb 19, 2024
7f88c95
Format imports
chipshort Feb 19, 2024
0ca56bd
Pass Payload from submsg to reply
chipshort Feb 19, 2024
97694f1
Add extra error for wasmvm errors
chipshort Feb 20, 2024
d94360c
Do not redact contract errors
chipshort Feb 21, 2024
9cc1a5a
Implement grpc query
chipshort Feb 21, 2024
4f8d513
Fix spelling
chipshort Feb 21, 2024
4c2d28a
Remove unnecessary comments
chipshort Feb 26, 2024
5dc97d5
Rename reflect.wasm to stargate_reflect.wasm
chipshort Feb 26, 2024
77504d8
Cleanup
chipshort Feb 26, 2024
8663a85
Add msgResponses in IBCRawPacketHandler
chipshort Feb 26, 2024
e982aab
Apply suggestions from code review
chipshort Feb 26, 2024
f41bb6f
Fix costValidate
chipshort Feb 26, 2024
8607164
Add validateAddress test
chipshort Feb 26, 2024
044caab
Update capability table
chipshort Feb 27, 2024
1ee2c49
Use reflect contract from 1.5
chipshort Feb 27, 2024
4e7e534
Add DeterministicError type for redactError
chipshort Feb 28, 2024
3e960ee
Fix DeterministicError docs
chipshort Feb 29, 2024
ad93ad3
Add contract error integration test
chipshort Mar 4, 2024
62eaa6e
Add nil checks
chipshort Mar 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
- "profiles/*"
- store_artifacts:
path: /tmp/logs

test-system:
executor: golang
parallelism: 1
Expand Down Expand Up @@ -189,15 +189,15 @@ jobs:
command: |
IN_DOCKER=$(docker run --rm "cosmwasm/wasmd:${CIRCLE_SHA1}" /usr/bin/wasmd query wasm libwasmvm-version)
echo "Runtime libwasmvm-version in docker: $IN_DOCKER"
IN_GOMOD=$(go list -m github.com/CosmWasm/wasmvm | cut -d" " -f2 | cut -d"v" -f2)
IN_GOMOD=$(go list -m github.com/CosmWasm/wasmvm/v2 | cut -d" " -f2 | cut -d"v" -f2)
echo "wasmvm version in go.mod: $IN_GOMOD"
if [[ "$IN_DOCKER" != "$IN_GOMOD" ]]; then
echo "Mismatch of wasmvm versions detected"
exit 1
fi
- when:
condition:
equal: [ main, << pipeline.git.branch >> ]
equal: [main, << pipeline.git.branch >>]
steps:
- run:
name: Push application Docker image to docker hub
Expand Down
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ RUN apk add git
WORKDIR /code
COPY . /code/
# See https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.5.2/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.5.2/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep e78b224c15964817a3b75a40e59882b4d0e06fd055b39514d61646689cef8c6e
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep e660a38efb2930b34ee6f6b0bb12730adccb040b6ab701b8f82f34453a426ae7

# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
RUN cp /lib/libwasmvm_muslc.${arch}.a /lib/libwasmvm_muslc.a
chipshort marked this conversation as resolved.
Show resolved Hide resolved
ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.0.0-rc.2/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.0.0-rc.2/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 6101550283308b4a57694faf558e47ec171c763321157825b48114e9d5a14bd2
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ec20d6df9c69a0fad61d224648a262d78996f7eb43afaf4775a30064148466b6

# force it to use static lib (from above) not standard libgo_cosmwasm.so file
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build
Expand All @@ -45,4 +42,4 @@ EXPOSE 26656
# tendermint rpc
EXPOSE 26657

CMD ["/usr/bin/wasmd", "version"]
CMD ["/usr/bin/wasmd", "version"]
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ Also CosmWasm 2.0 contracts remain compatible at the Wasm interface level.
To extend the feature set over time, contracts can specify required [capabilities](https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES.md) through cargo features in cosmwasm-std.
The following table shows which of the [latest capabilities](https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md) are supported by certain wasmd versions.

| capability | >= 0.42 | >= 0.41 | >= 0.31 | >= 0.29 | 0.28 |
| ------------ | ------- | ------- | ------- | ------- | ---- |
| iterator | x | x | x | x | x |
| stargate | x | x | x | x | x |
| staking | x | x | x | x | x |
| cosmwasm_1_1 | x | x | x | x | |
| cosmwasm_1_2 | x | x | x | | |
| cosmwasm_1_3 | x | x | | | |
| cosmwasm_1_4 | x | | | | |
| capability | >= 0.51 | >= 0.42 | >= 0.41 | >= 0.31 | >= 0.29 | 0.28 |
| ------------ | ------- | ------- | ------- | ------- | ------- | ---- |
| iterator | x | x | x | x | x | x |
| stargate | x | x | x | x | x | x |
| staking | x | x | x | x | x | x |
| cosmwasm_1_1 | x | x | x | x | x | |
| cosmwasm_1_2 | x | x | x | x | | |
| cosmwasm_1_3 | x | x | x | | | |
| cosmwasm_1_4 | x | x | | | | |
| cosmwasm_2_0 | x | | | | | |

### For node developers

Expand Down
4 changes: 1 addition & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"sort"
"strings"
"sync"

abci "github.com/cometbft/cometbft/abci/types"
Expand Down Expand Up @@ -629,7 +628,6 @@ func NewWasmApp(

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
availableCapabilities := strings.Join(AllCapabilities(), ",")
app.WasmKeeper = wasmkeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[wasmtypes.StoreKey]),
Expand All @@ -646,7 +644,7 @@ func NewWasmApp(
app.GRPCQueryRouter(),
wasmDir,
wasmConfig,
availableCapabilities,
AllCapabilities(),
chipshort marked this conversation as resolved.
Show resolved Hide resolved
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
wasmOpts...,
)
Expand Down
5 changes: 4 additions & 1 deletion app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ func TestAppImportExport(t *testing.T) {
require.NoError(t, os.RemoveAll(newDir))
}()

appOptions[flags.FlagHome] = t.TempDir() // ensure a unique folder for the new app

newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID))
require.Equal(t, "WasmApp", newApp.Name())

Expand Down Expand Up @@ -318,7 +320,6 @@ func TestAppStateDeterminism(t *testing.T) {
appOptions.SetDefault(key, value)
}
}
appOptions.SetDefault(flags.FlagHome, t.TempDir()) // ensure a unique folder
appOptions.SetDefault(server.FlagInvCheckPeriod, simcli.FlagPeriodValue)

for i := 0; i < numSeeds; i++ {
Expand All @@ -331,6 +332,8 @@ func TestAppStateDeterminism(t *testing.T) {
logger = log.NewNopLogger()
}

appOptions.SetDefault(flags.FlagHome, t.TempDir()) // ensure a unique folder per run
chipshort marked this conversation as resolved.
Show resolved Hide resolved

db := dbm.NewMemDB()
app := NewWasmApp(logger, db, nil, true, appOptions, emptyWasmOpts, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID))

Expand Down
1 change: 1 addition & 0 deletions app/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ func AllCapabilities() []string {
"cosmwasm_1_2",
"cosmwasm_1_3",
"cosmwasm_1_4",
"cosmwasm_2_0",
}
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/CosmWasm/wasmd
go 1.21

require (
github.com/CosmWasm/wasmvm v1.5.2
github.com/CosmWasm/wasmvm/v2 v2.0.0-rc.2
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.50.1
github.com/cosmos/gogogateway v1.2.0 // indirect
Expand Down Expand Up @@ -188,7 +188,7 @@ require (
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CosmWasm/wasmvm v1.5.2 h1:+pKB1Mz9GZVt1vadxB+EDdD1FOz3dMNjIKq/58/lrag=
github.com/CosmWasm/wasmvm v1.5.2/go.mod h1:Q0bSEtlktzh7W2hhEaifrFp1Erx11ckQZmjq8FLCyys=
github.com/CosmWasm/wasmvm/v2 v2.0.0-rc.2 h1:2rAO0MpNmKHKsrX/lsyo7lLjKoGDOWwMk+40hTNVfdE=
github.com/CosmWasm/wasmvm/v2 v2.0.0-rc.2/go.mod h1:su9lg5qLr7adV95eOfzjZWkGiky8WNaNIHDr7Fpu7Ck=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ=
github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
Expand Down Expand Up @@ -1340,8 +1340,8 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -61,25 +61,25 @@ func TestGovVoteByContract(t *testing.T) {
}{
"yes": {
vote: &wasmvmtypes.VoteMsg{
Vote: wasmvmtypes.Yes,
Option: wasmvmtypes.Yes,
},
expPass: true,
},
"no": {
vote: &wasmvmtypes.VoteMsg{
Vote: wasmvmtypes.No,
Option: wasmvmtypes.No,
},
expPass: false,
},
"abstain": {
vote: &wasmvmtypes.VoteMsg{
Vote: wasmvmtypes.Abstain,
Option: wasmvmtypes.Abstain,
},
expPass: true,
},
"no with veto": {
vote: &wasmvmtypes.VoteMsg{
Vote: wasmvmtypes.NoWithVeto,
Option: wasmvmtypes.NoWithVeto,
},
expPass: false,
},
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/grants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

wasmvm "github.com/CosmWasm/wasmvm"
wasmvm "github.com/CosmWasm/wasmvm/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
56 changes: 55 additions & 1 deletion tests/e2e/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestGroupWithContract(t *testing.T) {

coord := ibctesting.NewCoordinator(t, 1)
chain := coord.GetChain(ibctesting.GetChainID(1))
contractAddr := e2e.InstantiateReflectContract(t, chain)
contractAddr := e2e.InstantiateStargateReflectContract(t, chain)
chain.Fund(contractAddr, sdkmath.NewIntFromUint64(1_000_000_000))

members := []group.MemberRequest{
Expand Down Expand Up @@ -74,3 +74,57 @@ func TestGroupWithContract(t *testing.T) {
expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())
assert.Equal(t, expBalanceAmount.String(), recipientBalance.String())
}

func TestGroupWithNewReflectContract(t *testing.T) {
chipshort marked this conversation as resolved.
Show resolved Hide resolved
// Given a group with a contract as only member
// When contract submits a proposal with try_execute
// Then the payload msg is executed

coord := ibctesting.NewCoordinator(t, 1)
chain := coord.GetChain(ibctesting.GetChainID(1))
contractAddr := e2e.InstantiateReflectContract(t, chain)
chain.Fund(contractAddr, sdkmath.NewIntFromUint64(1_000_000_000))

members := []group.MemberRequest{
{
Address: contractAddr.String(),
Weight: "1",
Metadata: "my contract",
},
}
msg, err := group.NewMsgCreateGroupWithPolicy(
chain.SenderAccount.GetAddress().String(),
members,
"my group",
"my metadata",
false,
group.NewPercentageDecisionPolicy("1", time.Second, 0),
)
require.NoError(t, err)
rsp, err := chain.SendMsgs(msg)
require.NoError(t, err)

var createRsp group.MsgCreateGroupWithPolicyResponse
chain.UnwrapExecTXResult(rsp, &createRsp)
groupID, policyAddr := createRsp.GroupId, sdk.MustAccAddressFromBech32(createRsp.GroupPolicyAddress)
require.NotEmpty(t, groupID)
chain.Fund(policyAddr, sdkmath.NewIntFromUint64(1_000_000_000))
// and a proposal submitted
recipientAddr := sdk.AccAddress(rand.Bytes(address.Len))

payload := []sdk.Msg{banktypes.NewMsgSend(policyAddr, recipientAddr, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())))}
propMsg, err := group.NewMsgSubmitProposal(policyAddr.String(), []string{contractAddr.String()}, payload, "my proposal", group.Exec_EXEC_TRY, "my title", "my description")
require.NoError(t, err)

rsp = e2e.MustExecViaAnyReflectContract(t, chain, contractAddr, propMsg)
var execRsp types.MsgExecuteContractResponse
chain.UnwrapExecTXResult(rsp, &execRsp)

var groupRsp group.MsgSubmitProposalResponse
require.NoError(t, chain.Codec.Unmarshal(execRsp.Data, &groupRsp))

// and coins received
recipientBalance := chain.Balance(recipientAddr, sdk.DefaultBondDenom)
expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())
assert.Equal(t, expBalanceAmount.String(), recipientBalance.String())
}
42 changes: 38 additions & 4 deletions tests/e2e/reflect_helper.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package e2e

import (
"encoding/base64"
"encoding/json"
"fmt"
"testing"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/require"
Expand All @@ -16,9 +18,18 @@ import (
"github.com/CosmWasm/wasmd/x/wasm/types"
)

// InstantiateReflectContract store and instantiate a reflect contract instance
// InstantiateStargateReflectContract stores and instantiates the reflect contract shipped with CosmWasm 1.5.3.
// This instance still expects the old CosmosMsg.Stargate variant instead of the new CosmosMsg.Any.
func InstantiateStargateReflectContract(t *testing.T, chain *ibctesting.TestChain) sdk.AccAddress {
codeID := chain.StoreCodeFile("../../x/wasm/keeper/testdata/reflect_1_5.wasm").CodeID
contractAddr := chain.InstantiateContract(codeID, []byte(`{}`))
require.NotEmpty(t, contractAddr)
return contractAddr
}

// InstantiateReflectContract stores and instantiates a 2.0 reflect contract instance.
func InstantiateReflectContract(t *testing.T, chain *ibctesting.TestChain) sdk.AccAddress {
codeID := chain.StoreCodeFile("../../x/wasm/keeper/testdata/reflect_1_1.wasm").CodeID
codeID := chain.StoreCodeFile("../../x/wasm/keeper/testdata/reflect_2_0.wasm").CodeID
contractAddr := chain.InstantiateContract(codeID, []byte(`{}`))
require.NotEmpty(t, contractAddr)
return contractAddr
Expand All @@ -37,12 +48,35 @@ type sdkMessageType interface {
}

func MustExecViaStargateReflectContract[T sdkMessageType](t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...T) *abci.ExecTxResult {
require.NotEmpty(t, msgs)
// convert messages to stargate variant
vmMsgs := make([]string, len(msgs))
for i, m := range msgs {
bz, err := chain.Codec.Marshal(m)
require.NoError(t, err)
// json is built manually because the wasmvm CosmosMsg does not have the `Stargate` variant anymore
vmMsgs[i] = fmt.Sprintf("{\"stargate\":{\"type_url\":\"%s\",\"value\":\"%s\"}}", sdk.MsgTypeURL(m), base64.StdEncoding.EncodeToString(bz))
}
// build the complete reflect message
reflectSendBz := []byte(fmt.Sprintf("{\"reflect_msg\":{\"msgs\":%s}}", vmMsgs))

execMsg := &types.MsgExecuteContract{
Sender: chain.SenderAccount.GetAddress().String(),
Contract: contractAddr.String(),
Msg: reflectSendBz,
}
rsp, err := chain.SendMsgs(execMsg)
require.NoError(t, err)
return rsp
}

func MustExecViaAnyReflectContract[T sdkMessageType](t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...T) *abci.ExecTxResult {
vmMsgs := make([]wasmvmtypes.CosmosMsg, len(msgs))
for i, m := range msgs {
bz, err := chain.Codec.Marshal(m)
require.NoError(t, err)
vmMsgs[i] = wasmvmtypes.CosmosMsg{
Stargate: &wasmvmtypes.StargateMsg{
Any: &wasmvmtypes.AnyMsg{
TypeURL: sdk.MsgTypeURL(m),
Value: bz,
},
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/client/cli/gov_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"strings"

wasmvm "github.com/CosmWasm/wasmvm"
wasmvm "github.com/CosmWasm/wasmvm/v2"
"github.com/distribution/reference"
"github.com/pkg/errors"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os"
"strconv"

wasmvm "github.com/CosmWasm/wasmvm"
wasmvm "github.com/CosmWasm/wasmvm/v2"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"

Expand Down
2 changes: 1 addition & 1 deletion x/wasm/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package wasm
import (
"math"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
Expand Down
Loading