Skip to content

Commit 39dd5d9

Browse files
authored
Add wasmvm v1.5.2 back for tracing (#73)
* add v1.5.2 engine back * dedupe * add suffix * rename * update linker
1 parent 48e1c81 commit 39dd5d9

35 files changed

+5290
-2
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.
2121
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc
2222
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479
2323

24-
# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
24+
# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm152_muslc`
2525
RUN cp /lib/libwasmvm_muslc.${arch}.a /lib/libwasmvm_muslc.a
2626

2727
# force it to use static lib (from above) not standard libgo_cosmwasm.so file

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
github.com/dvsekhvalnov/jose2go v1.5.0
1313
github.com/gogo/protobuf v1.3.3
1414
github.com/golang/protobuf v1.5.3
15+
github.com/google/btree v1.1.2
1516
github.com/google/gofuzz v1.2.0
1617
github.com/gorilla/mux v1.8.0
1718
github.com/grpc-ecosystem/grpc-gateway v1.16.0
@@ -77,7 +78,6 @@ require (
7778
github.com/golang/glog v1.1.0 // indirect
7879
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
7980
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
80-
github.com/google/btree v1.1.2 // indirect
8181
github.com/google/flatbuffers v1.12.1 // indirect
8282
github.com/google/orderedcode v0.0.1 // indirect
8383
github.com/google/uuid v1.3.0 // indirect
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package api
2+
3+
import (
4+
"encoding/json"
5+
"io/ioutil"
6+
"testing"
7+
8+
"github.com/stretchr/testify/require"
9+
10+
"github.com/CosmWasm/wasmvm/types"
11+
)
12+
13+
func TestValidateAddressFailure(t *testing.T) {
14+
cache, cleanup := withCache(t)
15+
defer cleanup()
16+
17+
// create contract
18+
wasm, err := ioutil.ReadFile("../../testdata/hackatom.wasm")
19+
require.NoError(t, err)
20+
checksum, err := StoreCode(cache, wasm)
21+
require.NoError(t, err)
22+
23+
gasMeter := NewMockGasMeter(TESTING_GAS_LIMIT)
24+
// instantiate it with this store
25+
store := NewLookup(gasMeter)
26+
api := NewMockAPI()
27+
querier := DefaultQuerier(MOCK_CONTRACT_ADDR, types.Coins{types.NewCoin(100, "ATOM")})
28+
env := MockEnvBin(t)
29+
info := MockInfoBin(t, "creator")
30+
31+
// if the human address is larger than 32 bytes, this will lead to an error in the go side
32+
longName := "long123456789012345678901234567890long"
33+
msg := []byte(`{"verifier": "` + longName + `", "beneficiary": "bob"}`)
34+
35+
// make sure the call doesn't error, but we get a JSON-encoded error result from ContractResult
36+
igasMeter := types.GasMeter(gasMeter)
37+
res, _, err := Instantiate(cache, checksum, env, info, msg, &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG)
38+
require.NoError(t, err)
39+
var result types.ContractResult
40+
err = json.Unmarshal(res, &result)
41+
require.NoError(t, err)
42+
43+
// ensure the error message is what we expect
44+
require.Nil(t, result.Ok)
45+
// with this error
46+
require.Equal(t, "Generic error: addr_validate errored: human encoding too long", result.Err)
47+
}

0 commit comments

Comments
 (0)