From 433f4ac3713d70ac16ed84ce715bcdbda26a3e61 Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Fri, 6 May 2022 12:32:55 +0200 Subject: [PATCH 1/3] Bump wasmvm to v1.0.0-rc.0 --- CHANGELOG.md | 3 +++ Dockerfile | 8 ++++---- README.md | 3 ++- go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f26517ec..b56d67ca37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased](https://github.com/CosmWasm/wasmd/tree/HEAD) +**API Breaking** +Yes **Fixed bugs:** @@ -8,6 +10,7 @@ - Fix SudoContractProposal and ExecuteContractProposal [\#808](https://github.com/CosmWasm/wasmd/pull/808) ([the-frey](https://github.com/the-frey)) **Implemented Enhancements** +- Upgrade wasmvm to v1.0.0-rc.0 [\#844](https://github.com/CosmWasm/wasmd/pull/844) - Support state sync [\#478](https://github.com/CosmWasm/wasmd/issues/478) - Upgrade to ibc-go v3 [\#806](https://github.com/CosmWasm/wasmd/issues/806) - Initial ICA integration [\#837](https://github.com/CosmWasm/wasmd/pull/837) ([ethanfrey](https://github.com/ethanfrey)) diff --git a/Dockerfile b/Dockerfile index c528d432f0..902a61859d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,10 +16,10 @@ WORKDIR /code COPY . /code/ # See https://github.com/CosmWasm/wasmvm/releases -ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-beta10/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a -ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-beta10/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a -RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 5b7abfdd307568f5339e2bea1523a6aa767cf57d6a8c72bc813476d790918e44 -RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 2f44efa9c6c1cda138bd1f46d8d53c5ebfe1f4a53cf3457b01db86472c4917ac +ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-rc.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a +ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-rc.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a +RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 91a3f54e209345afa9a49aff50786d0a1ece510aa8e8530f5e68d9b42f6e0868 +RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep eda70adcd2f09a0ae0a6c1e53ecc318809e6d57244bda7b7a29ccd9cf591aa37 # 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 diff --git a/README.md b/README.md index 3689c70ab4..5b220a318b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,8 @@ version is communicated by the contract via a Wasm export. This is the current compatibility list: | wasmd | wasmvm | cosmwasm-vm | cosmwasm-std | -| ----- | ------------ | ----------- | ------------ | +|-------|--------------| ----------- | ------------ | +| 0.27 | v1.0.0-rc.0 | | 1.0 | | 0.26 | 1.0.0-beta10 | | 1.0 | | 0.25 | 1.0.0-beta10 | | 1.0 | | 0.24 | 1.0.0-beta7 | 1.0.0-beta6 | 1.0 | diff --git a/go.mod b/go.mod index fb5c1b0da5..b63b21b9a9 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/CosmWasm/wasmd go 1.17 require ( - github.com/CosmWasm/wasmvm v1.0.0-beta10 + github.com/CosmWasm/wasmvm v1.0.0-rc.0 github.com/cosmos/cosmos-sdk v0.45.4 github.com/cosmos/iavl v0.17.3 github.com/cosmos/ibc-go/v3 v3.0.0 diff --git a/go.sum b/go.sum index bb728911b3..a9283ec937 100644 --- a/go.sum +++ b/go.sum @@ -80,8 +80,8 @@ github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= -github.com/CosmWasm/wasmvm v1.0.0-beta10 h1:N99+PRcrh4FeDP1xQuJGaAsr+7U+TZAHKG8mybnAsKU= -github.com/CosmWasm/wasmvm v1.0.0-beta10/go.mod h1:y+yd9piV8KlrB7ISRZz1sDwH4UVm4Q9rEX9501dBNog= +github.com/CosmWasm/wasmvm v1.0.0-rc.0 h1:YI0ytwQZewPhSNxlqsrZ3/bVKTYXmrR1bfVapleCXWk= +github.com/CosmWasm/wasmvm v1.0.0-rc.0/go.mod h1:ei0xpvomwSdONsxDuONzV7bL1jSET1M8brEx0FCXc+A= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= From 0d16725f422dbcfe9960641ec5184840f7c65b27 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 6 May 2022 14:08:18 +0200 Subject: [PATCH 2/3] Fix linter warning --- x/wasm/keeper/msg_dispatcher.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x/wasm/keeper/msg_dispatcher.go b/x/wasm/keeper/msg_dispatcher.go index da8fc0fd49..a3e7e3a142 100644 --- a/x/wasm/keeper/msg_dispatcher.go +++ b/x/wasm/keeper/msg_dispatcher.go @@ -117,8 +117,8 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk continue } - // otherwise, we create a SubcallResult and pass it into the calling contract - var result wasmvmtypes.SubcallResult + // otherwise, we create a SubMsgResult and pass it into the calling contract + var result wasmvmtypes.SubMsgResult if err == nil { // just take the first one for now if there are multiple sub-sdk messages // and safely return nothing if no data @@ -126,8 +126,8 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk if len(data) > 0 { responseData = data[0] } - result = wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{ + result = wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{ Events: sdkEventsToWasmVMEvents(filteredEvents), Data: responseData, }, @@ -135,7 +135,7 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk } else { // Issue #759 - we don't return error string for worries of non-determinism moduleLogger(ctx).Info("Redacting submessage error", "cause", err) - result = wasmvmtypes.SubcallResult{ + result = wasmvmtypes.SubMsgResult{ Err: redactError(err).Error(), } } From 3936c7f3cc1229e816c7f4d4d8332ea0b6af090f Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Fri, 6 May 2022 14:29:03 +0200 Subject: [PATCH 3/3] Replace deprecated types --- x/wasm/keeper/gas_register_test.go | 36 +++++++++++++++--------------- x/wasm/keeper/submsg_test.go | 10 ++++----- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/x/wasm/keeper/gas_register_test.go b/x/wasm/keeper/gas_register_test.go index b3ca5b9c86..5aa8184ab2 100644 --- a/x/wasm/keeper/gas_register_test.go +++ b/x/wasm/keeper/gas_register_test.go @@ -183,8 +183,8 @@ func TestReplyCost(t *testing.T) { }{ "subcall response with events and data - pinned": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{ + Result: wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{ Events: []wasmvmtypes.Event{ {Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: "myData"}}}, }, @@ -198,8 +198,8 @@ func TestReplyCost(t *testing.T) { }, "subcall response with events - pinned": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{ + Result: wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{ Events: []wasmvmtypes.Event{ {Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: "myData"}}}, }, @@ -212,8 +212,8 @@ func TestReplyCost(t *testing.T) { }, "subcall response with events exceeds free tier- pinned": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{ + Result: wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{ Events: []wasmvmtypes.Event{ {Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: strings.Repeat("x", DefaultEventAttributeDataFreeTier), Value: "myData"}}}, }, @@ -226,7 +226,7 @@ func TestReplyCost(t *testing.T) { }, "subcall response error - pinned": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ + Result: wasmvmtypes.SubMsgResult{ Err: "foo", }, }, @@ -236,8 +236,8 @@ func TestReplyCost(t *testing.T) { }, "subcall response with events and data - unpinned": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{ + Result: wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{ Events: []wasmvmtypes.Event{ {Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: "myData"}}}, }, @@ -250,8 +250,8 @@ func TestReplyCost(t *testing.T) { }, "subcall response with events - unpinned": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{ + Result: wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{ Events: []wasmvmtypes.Event{ {Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: "myData"}}}, }, @@ -263,8 +263,8 @@ func TestReplyCost(t *testing.T) { }, "subcall response with events exceeds free tier- unpinned": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{ + Result: wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{ Events: []wasmvmtypes.Event{ {Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: strings.Repeat("x", DefaultEventAttributeDataFreeTier), Value: "myData"}}}, }, @@ -276,7 +276,7 @@ func TestReplyCost(t *testing.T) { }, "subcall response error - unpinned": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ + Result: wasmvmtypes.SubMsgResult{ Err: "foo", }, }, @@ -285,8 +285,8 @@ func TestReplyCost(t *testing.T) { }, "subcall response with empty events": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{ + Result: wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{ Events: make([]wasmvmtypes.Event, 10), }, }, @@ -296,8 +296,8 @@ func TestReplyCost(t *testing.T) { }, "subcall response with events unset": { src: wasmvmtypes.Reply{ - Result: wasmvmtypes.SubcallResult{ - Ok: &wasmvmtypes.SubcallResponse{}, + Result: wasmvmtypes.SubMsgResult{ + Ok: &wasmvmtypes.SubMsgResponse{}, }, }, srcConfig: DefaultGasRegisterConfig(), diff --git a/x/wasm/keeper/submsg_test.go b/x/wasm/keeper/submsg_test.go index f253efa17d..abcc4f0738 100644 --- a/x/wasm/keeper/submsg_test.go +++ b/x/wasm/keeper/submsg_test.go @@ -196,16 +196,16 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { } } - type assertion func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubcallResult) + type assertion func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) assertReturnedEvents := func(expectedEvents int) assertion { - return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubcallResult) { + return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { require.Len(t, response.Ok.Events, expectedEvents) } } assertGasUsed := func(minGas, maxGas uint64) assertion { - return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubcallResult) { + return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { gasUsed := ctx.GasMeter().GasConsumed() assert.True(t, gasUsed >= minGas, "Used %d gas (less than expected %d)", gasUsed, minGas) assert.True(t, gasUsed <= maxGas, "Used %d gas (more than expected %d)", gasUsed, maxGas) @@ -213,12 +213,12 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { } assertErrorString := func(shouldContain string) assertion { - return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubcallResult) { + return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { assert.Contains(t, response.Err, shouldContain) } } - assertGotContractAddr := func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubcallResult) { + assertGotContractAddr := func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { // should get the events emitted on new contract event := response.Ok.Events[0] require.Equal(t, event.Type, "instantiate")