diff --git a/Dockerfile b/Dockerfile index dba0877c38..9249e452f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,8 @@ WORKDIR /code COPY . /code/ # See https://github.com/CosmWasm/wasmvm/releases -ADD https://github.com/CosmWasm/wasmvm/releases/download/v0.16.1/libwasmvm_muslc.a /lib/libwasmvm_muslc.a -RUN sha256sum /lib/libwasmvm_muslc.a | grep 0e62296b9f24cf3a05f8513f99cee536c7087079855ea6ffb4f89b35eccdaa66 +ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-soon/libwasmvm_muslc.a /lib/libwasmvm_muslc.a +RUN sha256sum /lib/libwasmvm_muslc.a | grep 6e82693aa64e4373ae303e82988c2f3a7216e83ee0021e9be80acbf18676ca9b # force it to use static lib (from above) not standard libgo_cosmwasm.so file RUN LEDGER_ENABLED=false BUILD_TAGS=muslc make build diff --git a/app/app.go b/app/app.go index 94924455c1..7a54e30f4c 100644 --- a/app/app.go +++ b/app/app.go @@ -355,7 +355,7 @@ func NewWasmApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks - supportedFeatures := "staking,stargate" + supportedFeatures := "iterator,staking,stargate" app.wasmKeeper = wasm.NewKeeper( appCodec, keys[wasm.StoreKey], diff --git a/go.mod b/go.mod index df6be184c2..cfbca4854b 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/CosmWasm/wasmd go 1.16 require ( - github.com/CosmWasm/wasmvm v0.16.1 + github.com/CosmWasm/wasmvm v1.0.0-soon github.com/cosmos/cosmos-sdk v0.42.9 github.com/cosmos/iavl v0.16.0 github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b diff --git a/go.sum b/go.sum index e454a05ff7..a474ba44c3 100644 --- a/go.sum +++ b/go.sum @@ -50,6 +50,8 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/CosmWasm/wasmvm v0.16.1 h1:o14Y9xnxaLaLnYiFG9rIna2ZtmB/F8BAIOLboVzXguQ= github.com/CosmWasm/wasmvm v0.16.1/go.mod h1:Id107qllDJyJjVQQsKMOy2YYF98sqPJ2t+jX1QES40A= +github.com/CosmWasm/wasmvm v1.0.0-soon h1:AUN0RDNgJ85hAv8LClUuhmm9OZOWYw3JhINiLa9NEeQ= +github.com/CosmWasm/wasmvm v1.0.0-soon/go.mod h1:Id107qllDJyJjVQQsKMOy2YYF98sqPJ2t+jX1QES40A= 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= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 835d10aa96..4c415dcee0 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -35,7 +35,7 @@ func init() { var hackatomWasm []byte -const SupportedFeatures = "staking,stargate" +const SupportedFeatures = "iterator,staking,stargate" func TestNewKeeper(t *testing.T) { _, keepers := CreateTestInput(t, false, SupportedFeatures) @@ -307,7 +307,7 @@ func TestInstantiate(t *testing.T) { gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x12206), gasAfter-gasBefore) + require.Equal(t, uint64(0x12215), gasAfter-gasBefore) } // ensure it is stored properly @@ -541,7 +541,7 @@ func TestExecute(t *testing.T) { // make sure gas is properly deducted from ctx gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x12af1), gasAfter-gasBefore) + require.Equal(t, uint64(0x12af8), gasAfter-gasBefore) } // ensure bob now exists and got both payments released bobAcct = accKeeper.GetAccount(ctx, bob) diff --git a/x/wasm/keeper/recurse_test.go b/x/wasm/keeper/recurse_test.go index 106e9cabd7..57b29dde24 100644 --- a/x/wasm/keeper/recurse_test.go +++ b/x/wasm/keeper/recurse_test.go @@ -52,12 +52,12 @@ func initRecurseContract(t *testing.T) (contract sdk.AccAddress, creator sdk.Acc func TestGasCostOnQuery(t *testing.T) { const ( - GasNoWork uint64 = 44_149 + GasNoWork uint64 = 44_162 // Note: about 100 SDK gas (10k wasmer gas) for each round of sha256 - GasWork50 uint64 = 49_809 // this is a little shy of 50k gas - to keep an eye on the limit + GasWork50 uint64 = 48_846 // this is a little shy of 50k gas - to keep an eye on the limit - GasReturnUnhashed uint64 = 256 - GasReturnHashed uint64 = 232 + GasReturnUnhashed uint64 = 253 + GasReturnHashed uint64 = 228 ) cases := map[string]struct { @@ -216,9 +216,9 @@ func TestLimitRecursiveQueryGas(t *testing.T) { const ( // Note: about 100 SDK gas (10k wasmer gas) for each round of sha256 - GasWork2k uint64 = 273_076 // = NewContractInstanceCosts + x // we have 6x gas used in cpu than in the instance + GasWork2k uint64 = 233_971 // = NewContractInstanceCosts + x // we have 6x gas used in cpu than in the instance // This is overhead for calling into a sub-contract - GasReturnHashed uint64 = 236 + GasReturnHashed uint64 = 231 ) cases := map[string]struct { @@ -244,15 +244,14 @@ func TestLimitRecursiveQueryGas(t *testing.T) { Work: 2000, }, expectQueriesFromContract: 5, - // FIXME: why -3 ... confused a bit by calculations, seems like rounding issues - expectedGas: GasWork2k + 5*(GasWork2k+GasReturnHashed) - 3, + // FIXME: why +2 ... confused a bit by calculations, seems like rounding issues + expectedGas: GasWork2k + 5*(GasWork2k+GasReturnHashed) + 2, }, // this is where we expect an error... // it has enough gas to run 4 times and die on the 5th (4th time dispatching to sub-contract) // however, if we don't charge the cpu gas before sub-dispatching, we can recurse over 20 times - // TODO: figure out how to asset how deep it went "deep recursion, should die on 5th level": { - gasLimit: 1_200_000, + gasLimit: 1_000_000, msg: Recurse{ Depth: 50, Work: 2000, diff --git a/x/wasm/keeper/testdata/burner.wasm b/x/wasm/keeper/testdata/burner.wasm index 404a457f52..e3987ee255 100644 Binary files a/x/wasm/keeper/testdata/burner.wasm and b/x/wasm/keeper/testdata/burner.wasm differ diff --git a/x/wasm/keeper/testdata/hackatom.wasm b/x/wasm/keeper/testdata/hackatom.wasm index c48bf01e27..9ac2d2ee7b 100644 Binary files a/x/wasm/keeper/testdata/hackatom.wasm and b/x/wasm/keeper/testdata/hackatom.wasm differ diff --git a/x/wasm/keeper/testdata/hackatom.wasm.gzip b/x/wasm/keeper/testdata/hackatom.wasm.gzip index 0bbfea03fa..73a976d652 100644 Binary files a/x/wasm/keeper/testdata/hackatom.wasm.gzip and b/x/wasm/keeper/testdata/hackatom.wasm.gzip differ diff --git a/x/wasm/keeper/testdata/ibc_reflect.wasm b/x/wasm/keeper/testdata/ibc_reflect.wasm index 5c4ced5047..a9c2fb3a8a 100644 Binary files a/x/wasm/keeper/testdata/ibc_reflect.wasm and b/x/wasm/keeper/testdata/ibc_reflect.wasm differ diff --git a/x/wasm/keeper/testdata/ibc_reflect_send.wasm b/x/wasm/keeper/testdata/ibc_reflect_send.wasm index 252341ca02..4920b53ab5 100644 Binary files a/x/wasm/keeper/testdata/ibc_reflect_send.wasm and b/x/wasm/keeper/testdata/ibc_reflect_send.wasm differ diff --git a/x/wasm/keeper/testdata/reflect.wasm b/x/wasm/keeper/testdata/reflect.wasm index d9f5ca0a64..bb072ba600 100644 Binary files a/x/wasm/keeper/testdata/reflect.wasm and b/x/wasm/keeper/testdata/reflect.wasm differ diff --git a/x/wasm/keeper/testdata/staking.wasm b/x/wasm/keeper/testdata/staking.wasm index 9a27812812..675fb565f1 100644 Binary files a/x/wasm/keeper/testdata/staking.wasm and b/x/wasm/keeper/testdata/staking.wasm differ diff --git a/x/wasm/keeper/testdata/version.txt b/x/wasm/keeper/testdata/version.txt index b6734ac57e..f659ddde3e 100644 --- a/x/wasm/keeper/testdata/version.txt +++ b/x/wasm/keeper/testdata/version.txt @@ -1 +1 @@ -v0.16.0+contracts +v1.0.0-soon diff --git a/x/wasm/module_test.go b/x/wasm/module_test.go index 01b02d6653..9a6341e135 100644 --- a/x/wasm/module_test.go +++ b/x/wasm/module_test.go @@ -31,7 +31,7 @@ type testData struct { } func setupTest(t *testing.T) testData { - ctx, keepers := CreateTestInput(t, false, "staking,stargate") + ctx, keepers := CreateTestInput(t, false, "iterator,staking,stargate") cdc := keeper.MakeTestCodec(t) data := testData{ module: NewAppModule(cdc, keepers.WasmKeeper, keepers.StakingKeeper),