diff --git a/.github/workflows/builds_and_tests.yml b/.github/workflows/builds_and_tests.yml index d6fb13ef..da75b4d8 100644 --- a/.github/workflows/builds_and_tests.yml +++ b/.github/workflows/builds_and_tests.yml @@ -9,17 +9,17 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.57.0 + toolchain: 1.60.0 target: wasm32-unknown-unknown profile: minimal override: true - name: Checkout uses: actions/checkout@v2 - name: Cache cargo - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cargo - key: cargocache-v2-libwasmvm_sanity-rust:1.57.0-${{ hashFiles('Cargo.lock') }} + key: cargocache-v2-libwasmvm_sanity-rust:1.60.0-${{ hashFiles('Cargo.lock') }} - name: Install shellcheck run: sudo apt install shellcheck - name: Show version information @@ -113,17 +113,17 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.57.0 - target: wasm32-unknown-unknown + toolchain: 1.60.0 + target: x86_64-unknown-linux-gnu profile: minimal override: true - name: Checkout uses: actions/checkout@v2 - name: Cache cargo - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cargo - key: cargocache-v2-build_shared_library-rust:1.57.0-${{ hashFiles('Cargo.lock') }} + key: cargocache-v2-build_shared_library-rust:1.60.0-${{ hashFiles('Cargo.lock') }} - name: Show version information run: rustc --version; cargo --version; rustup --version - name: Create release build of libwasmvm @@ -132,24 +132,9 @@ jobs: uses: actions/upload-artifact@v2 with: name: libwasmvm - path: ./api/libwasmvm.x86_64.so + path: ./internal/api/libwasmvm.x86_64.so - build_static_lib: - runs-on: ubuntu-latest - steps: - - name: set up - uses: actions/setup-go@v3.2.1 - with: - go-version: 1.17 - id: go - - name: Checkout - uses: actions/checkout@v2 - - name: Build docker image - run: cd builders && make docker-image-alpine - - name: Build & Test static library - run: make release-build-alpine - - test: + test_shared_lib: needs: build_shared_library runs-on: ubuntu-latest env: @@ -169,10 +154,18 @@ jobs: name: libwasmvm path: /tmp/builds - name: Copy libwasmvm - run: cp /tmp/builds/libwasmvm.x86_64.so ./api + run: cp /tmp/builds/libwasmvm.x86_64.so ./internal/api - name: Go integration tests run: make test - name: Go tests with cgo and race condition safety checks run: make test-safety - name: Make build-go run: make build-go + + test_static_lib: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build static library and test + run: make test-alpine diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 265c8d6f..5e3fb3b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.57.0 + toolchain: 1.60.0 profile: minimal override: true - name: Checkout @@ -56,8 +56,8 @@ jobs: - name: Collect artifacts run: | mkdir artifacts - cp ./api/libwasmvm_muslc.a artifacts/libwasmvm_muslc.x86_64.a - cp ./api/libwasmvm_muslc.aarch64.a artifacts/libwasmvm_muslc.aarch64.a + cp ./internal/api/libwasmvm_muslc.a artifacts/libwasmvm_muslc.x86_64.a + cp ./internal/api/libwasmvm_muslc.aarch64.a artifacts/libwasmvm_muslc.aarch64.a - name: Create checksums working-directory: artifacts run: sha256sum * > checksums.txt && cat checksums.txt diff --git a/Makefile b/Makefile index df1ad60c..807abaec 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ .PHONY: all build build-rust build-go test # Builds the Rust library libwasmvm -BUILDERS_PREFIX := line/wasmvm-builder +BUILDERS_PREFIX := cosmwasm/go-ext-builder:0014 # Contains a full Go dev environment in order to run Go tests on the built library -ALPINE_TESTER := line/wasmvm-builder-alpine +ALPINE_TESTER := cosmwasm/go-ext-builder:0014-alpine USER_ID := $(shell id -u) USER_GROUP = $(shell id -g) @@ -39,7 +39,7 @@ build-rust: build-rust-release # In order to use "--features backtraces" here we need a Rust nightly toolchain, which we don't have by default build-rust-debug: (cd libwasmvm && cargo build) - cp libwasmvm/target/debug/$(SHARED_LIB_SRC) api/$(SHARED_LIB_DST) + cp libwasmvm/target/debug/$(SHARED_LIB_SRC) internal/api/$(SHARED_LIB_DST) make update-bindings # use release build to actually ship - smaller and much faster @@ -48,7 +48,7 @@ build-rust-debug: # enable stripping through cargo (if that is desired). build-rust-release: (cd libwasmvm && cargo build --release) - cp libwasmvm/target/release/$(SHARED_LIB_SRC) api/$(SHARED_LIB_DST) + cp libwasmvm/target/release/$(SHARED_LIB_SRC) internal/api/$(SHARED_LIB_DST) make update-bindings @ #this pulls out ELF symbols, 80% size reduction! @@ -68,20 +68,20 @@ release-build-alpine: rm -rf libwasmvm/target/release # build the muslc *.a file docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-alpine - cp libwasmvm/artifacts/libwasmvm_muslc.a api - cp libwasmvm/artifacts/libwasmvm_muslc.aarch64.a api + cp libwasmvm/artifacts/libwasmvm_muslc.a internal/api + cp libwasmvm/artifacts/libwasmvm_muslc.aarch64.a internal/api make update-bindings - # try running go tests using this lib with muslc - docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) go build -tags muslc ./... - # Use package list mode to include all subdirectores. The -count=1 turns off caching. - docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) go test -ldflags "-linkmode=external -extldflags '-Wl,-z,muldefs -static'" -tags muslc -count=1 ./... +# # try running go tests using this lib with muslc +# docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) go build -tags muslc ./... +# # Use package list mode to include all subdirectores. The -count=1 turns off caching. +# docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) go test -tags muslc -count=1 ./... # Creates a release build in a containerized build environment of the shared library for glibc Linux (.so) release-build-linux: rm -rf libwasmvm/target/release docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-centos7 - cp libwasmvm/artifacts/libwasmvm.x86_64.so api - cp libwasmvm/artifacts/libwasmvm.aarch64.so api + cp libwasmvm/artifacts/libwasmvm.x86_64.so internal/api + cp libwasmvm/artifacts/libwasmvm.aarch64.so internal/api make update-bindings # Creates a release build in a containerized build environment of the shared library for macOS (.dylib) @@ -89,21 +89,34 @@ release-build-macos: rm -rf libwasmvm/target/x86_64-apple-darwin/release rm -rf libwasmvm/target/aarch64-apple-darwin/release docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-cross build_macos.sh - cp libwasmvm/artifacts/libwasmvm.dylib api + cp libwasmvm/artifacts/libwasmvm.dylib internal/api + make update-bindings + +# Creates a release build in a containerized build environment of the shared library for Windows (.dll) +release-build-windows: + rm -rf libwasmvm/target/release + docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-cross build_windows.sh + cp libwasmvm/target/x86_64-pc-windows-gnu/release/wasmvm.dll internal/api make update-bindings update-bindings: - # After we build libwasmvm, we have to copy the generated bindings for Go code to use. - # We cannot use symlinks as those are not reliably resolved by `go get` (https://github.com/CosmWasm/wasmvm/pull/235). - cp libwasmvm/bindings.h api +# After we build libwasmvm, we have to copy the generated bindings for Go code to use. +# We cannot use symlinks as those are not reliably resolved by `go get` (https://github.com/CosmWasm/wasmvm/pull/235). + cp libwasmvm/bindings.h internal/api release-build: # Write like this because those must not run in parallel make release-build-alpine make release-build-linux make release-build-macos + make release-build-windows test-alpine: release-build-alpine +# try running go tests using this lib with muslc + docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) go build -tags muslc ./... +# Use package list mode to include all subdirectores. The -count=1 turns off caching. + docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) go test -tags muslc -count=1 ./... + @# Build a Go demo binary called ./demo that links the static library from the previous step. @# Whether the result is a statically linked or dynamically linked binary is decided by `go build` @# and it's a bit unclear how this is decided. We use `file` to see what we got. @@ -112,10 +125,10 @@ test-alpine: release-build-alpine @# Run the demo binary on Alpine machines @# See https://de.wikipedia.org/wiki/Alpine_Linux#Versionen for supported versions - docker run --rm --read-only -v $(shell pwd):/mnt/testrun -w /mnt/testrun alpine:3.15 ./demo ./api/testdata/hackatom.wasm - docker run --rm --read-only -v $(shell pwd):/mnt/testrun -w /mnt/testrun alpine:3.14 ./demo ./api/testdata/hackatom.wasm - docker run --rm --read-only -v $(shell pwd):/mnt/testrun -w /mnt/testrun alpine:3.13 ./demo ./api/testdata/hackatom.wasm - docker run --rm --read-only -v $(shell pwd):/mnt/testrun -w /mnt/testrun alpine:3.12 ./demo ./api/testdata/hackatom.wasm + docker run --rm --read-only -v $(shell pwd):/mnt/testrun -w /mnt/testrun alpine:3.15 ./demo ./testdata/hackatom.wasm + docker run --rm --read-only -v $(shell pwd):/mnt/testrun -w /mnt/testrun alpine:3.14 ./demo ./testdata/hackatom.wasm + docker run --rm --read-only -v $(shell pwd):/mnt/testrun -w /mnt/testrun alpine:3.13 ./demo ./testdata/hackatom.wasm + docker run --rm --read-only -v $(shell pwd):/mnt/testrun -w /mnt/testrun alpine:3.12 ./demo ./testdata/hackatom.wasm @# Run binary locally if you are on Linux - @# ./demo ./api/testdata/hackatom.wasm + @# ./demo ./testdata/hackatom.wasm diff --git a/api/libwasmvm.aarch64.so b/api/libwasmvm.aarch64.so deleted file mode 100755 index 6096aa0b..00000000 Binary files a/api/libwasmvm.aarch64.so and /dev/null differ diff --git a/api/libwasmvm.dylib b/api/libwasmvm.dylib deleted file mode 100755 index 7a5a71e4..00000000 Binary files a/api/libwasmvm.dylib and /dev/null differ diff --git a/api/libwasmvm.x86_64.so b/api/libwasmvm.x86_64.so deleted file mode 100755 index 7010c574..00000000 Binary files a/api/libwasmvm.x86_64.so and /dev/null differ diff --git a/api/link_glibclinux_x86_64.go b/api/link_glibclinux_x86_64.go deleted file mode 100644 index be822149..00000000 --- a/api/link_glibclinux_x86_64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build linux && !muslc && amd64 -// +build linux,!muslc,amd64 - -package api - -// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lwasmvm.x86_64 -import "C" diff --git a/builders/Dockerfile.alpine b/builders/Dockerfile.alpine index e9985b4e..89b50b95 100644 --- a/builders/Dockerfile.alpine +++ b/builders/Dockerfile.alpine @@ -1,14 +1,3 @@ -# Install C compiler for cross-compilation. This is required by -# Wasmer in https://github.com/wasmerio/wasmer/blob/2.2.1/lib/vm/build.rs. -# For newer versions this might not be needed anymore since build.rs is removed -# in https://github.com/wasmerio/wasmer/pull/2807. -# -# https://unix.stackexchange.com/questions/620205/aarch64-linux-musl-cross-has-a-broken-link-for-ld-musl-aarch64-so-1 - -# We need aarch64-linux-musl-cross to compile, wget to musl.cc is denied by github actions. -# We will use a copy from an image that already contains aarch64-linux-musl-cross. -FROM mondoolabs/golang:1.15.0-alpine AS builder - # This image is used for two things (which is not ideal, but yeah): # 1. Build the static Rust library # 2. Execute Go tests that use and test this library @@ -19,15 +8,29 @@ ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ PATH=/usr/local/cargo/bin:$PATH -RUN apk add rustup - # this comes from standard alpine nightly file # https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile # with some changes to support our toolchain, etc RUN set -eux \ && apk add --no-cache ca-certificates build-base -RUN rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.57.0 +RUN wget "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-musl/rustup-init" \ + && chmod +x rustup-init \ + && ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.63.0 \ + && rm rustup-init \ + && chmod -R a+w $RUSTUP_HOME $CARGO_HOME + +# Install C compiler for cross-compilation. This is required by +# Wasmer in https://github.com/wasmerio/wasmer/blob/2.2.1/lib/vm/build.rs. +# For newer versions this might not be needed anymore since build.rs is removed +# in https://github.com/wasmerio/wasmer/pull/2807. +# +# https://unix.stackexchange.com/questions/620205/aarch64-linux-musl-cross-has-a-broken-link-for-ld-musl-aarch64-so-1 +RUN wget https://musl.cc/aarch64-linux-musl-cross.tgz \ + && tar -xf aarch64-linux-musl-cross.tgz \ + && mv ./aarch64-linux-musl-cross /opt \ + && /opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version \ + && rm aarch64-linux-musl-cross.tgz # prepare go cache dirs RUN mkdir -p /.cache/go-build @@ -39,10 +42,6 @@ RUN chmod -R 777 /usr/local/cargo ## COPY BUILD SCRIPTS WORKDIR /code -COPY --from=builder \ - /usr/local/bin/aarch64-linux-musl-cross \ - /opt/aarch64-linux-musl-cross - # Add musl Rust targets RUN rustup target add aarch64-unknown-linux-musl x86_64-unknown-linux-musl diff --git a/builders/Dockerfile.centos7 b/builders/Dockerfile.centos7 index dd08c4d2..2d3397d7 100644 --- a/builders/Dockerfile.centos7 +++ b/builders/Dockerfile.centos7 @@ -26,7 +26,7 @@ ENV RUSTUP_HOME=/usr/local/rustup \ RUN wget "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" \ && chmod +x rustup-init \ - && ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.57.0 \ + && ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.60.0 \ && rm rustup-init \ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ && rustup --version \ diff --git a/builders/Dockerfile.cross b/builders/Dockerfile.cross index a9048c4d..ecd4d073 100644 --- a/builders/Dockerfile.cross +++ b/builders/Dockerfile.cross @@ -1,15 +1,17 @@ -FROM rust:1.57.0-bullseye +FROM rust:1.63.0-bullseye # Install build dependencies RUN apt-get update \ - && apt install -y clang gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev build-essential cmake + && apt install -y clang gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev build-essential cmake \ + # Support for Windows cross-compile + mingw-w64 ## ADD MACOS SUPPORT WORKDIR /opt -# Add macOS Rust targets -RUN rustup target add x86_64-apple-darwin aarch64-apple-darwin +# Add macOS and Windows Rust targets +RUN rustup target add x86_64-apple-darwin aarch64-apple-darwin x86_64-pc-windows-gnu # Build osxcross # See https://github.com/tpoechtrager/osxcross/blob/master/build.sh#L31-L49 for SDK overview. diff --git a/builders/Makefile b/builders/Makefile index 74f3a024..81bec32d 100644 --- a/builders/Makefile +++ b/builders/Makefile @@ -1,3 +1,6 @@ +# Versioned by a simple counter that is not bound to a specific CosmWasm version +# See builders/README.md +#BUILDERS_PREFIX := cosmwasm/go-ext-builder:0013 BUILDERS_PREFIX := line/wasmvm-builder .PHONY: docker-image-centos7 diff --git a/builders/guest/build_windows.sh b/builders/guest/build_windows.sh new file mode 100644 index 00000000..4943b7b8 --- /dev/null +++ b/builders/guest/build_windows.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -o errexit -o nounset -o pipefail + +# ref: https://www.reddit.com/r/rust/comments/5k8uab/crosscompiling_from_ubuntu_to_windows_with_rustup/ + +cargo build --release --target x86_64-pc-windows-gnu diff --git a/builders/guest/cargo-config b/builders/guest/cargo-config index a8ba3238..a983986d 100644 --- a/builders/guest/cargo-config +++ b/builders/guest/cargo-config @@ -9,3 +9,7 @@ ar = "aarch64-apple-darwin20.4-ar" [target.aarch64-unknown-linux-gnu] linker = "/usr/aarch64-linux-gnu/bin/ld" ar = "/usr/aarch64-linux-gnu/bin/ar" + +[target.x86_64-pc-windows-gnu] +linker = "x86_64-w64-mingw32-gcc" +ar = "x86_64-w64-mingw32-gcc-ar" diff --git a/ibc_test.go b/ibc_test.go index 5f9cbee3..723e87eb 100644 --- a/ibc_test.go +++ b/ibc_test.go @@ -5,13 +5,13 @@ import ( "io/ioutil" "testing" - "github.com/line/wasmvm/api" + "github.com/line/wasmvm/internal/api" "github.com/line/wasmvm/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -const IBC_TEST_CONTRACT = "./api/testdata/ibc_reflect.wasm" +const IBC_TEST_CONTRACT = "./testdata/ibc_reflect.wasm" func TestIBC(t *testing.T) { vm := withVM(t) @@ -284,6 +284,7 @@ func TestAnalyzeCode(t *testing.T) { require.NoError(t, err) require.False(t, report.HasIBCEntryPoints) require.Equal(t, "", report.RequiredFeatures) + require.Equal(t, "", report.RequiredCapabilities) // Store IBC contract wasm2, err := ioutil.ReadFile(IBC_TEST_CONTRACT) @@ -295,6 +296,7 @@ func TestAnalyzeCode(t *testing.T) { require.NoError(t, err) require.True(t, report2.HasIBCEntryPoints) require.Equal(t, "iterator,stargate", report2.RequiredFeatures) + require.Equal(t, "iterator,stargate", report2.RequiredCapabilities) } func TestIBCMsgGetChannel(t *testing.T) { diff --git a/api/api_test.go b/internal/api/api_test.go similarity index 95% rename from api/api_test.go rename to internal/api/api_test.go index 1001ff88..87c7ec1a 100644 --- a/api/api_test.go +++ b/internal/api/api_test.go @@ -15,7 +15,7 @@ func TestValidateAddressFailure(t *testing.T) { defer cleanup() // create contract - wasm, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasm, err := ioutil.ReadFile("../../testdata/hackatom.wasm") require.NoError(t, err) checksum, err := Create(cache, wasm) require.NoError(t, err) diff --git a/api/bindings.h b/internal/api/bindings.h similarity index 98% rename from api/bindings.h rename to internal/api/bindings.h index 1ac72286..1d8c973e 100644 --- a/api/bindings.h +++ b/internal/api/bindings.h @@ -1,6 +1,6 @@ -/* (c) 2019 Confio UO. Licensed under Apache-2.0 */ +/* (c) 2019 Confio OÜ. Licensed under Apache-2.0 */ -/* Generated with cbindgen:0.18.0 */ +/* Generated with cbindgen:0.24.3 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -196,17 +196,17 @@ typedef struct UnmanagedVector { /** * The result type of the FFI function analyze_code. * - * Please note that the unmanaged vector in `required_features` + * Please note that the unmanaged vector in `required_capabilities` * has to be destroyed exactly once. When calling `analyze_code` * from Go this is done via `C.destroy_unmanaged_vector`. */ typedef struct AnalysisReport { bool has_ibc_entry_points; /** - * An UTF-8 encoded comma separated list of reqired features. + * An UTF-8 encoded comma separated list of reqired capabilities. * This is never None/nil. */ - struct UnmanagedVector required_features; + struct UnmanagedVector required_capabilities; } AnalysisReport; typedef struct Metrics { @@ -304,7 +304,7 @@ typedef struct GoQuerier { } GoQuerier; struct cache_t *init_cache(struct ByteSliceView data_dir, - struct ByteSliceView supported_features, + struct ByteSliceView available_capabilities, uint32_t cache_size, uint32_t instance_memory_limit, struct UnmanagedVector *error_msg); diff --git a/api/callbacks.go b/internal/api/callbacks.go similarity index 100% rename from api/callbacks.go rename to internal/api/callbacks.go diff --git a/api/callbacks_cgo.go b/internal/api/callbacks_cgo.go similarity index 100% rename from api/callbacks_cgo.go rename to internal/api/callbacks_cgo.go diff --git a/api/iterator.go b/internal/api/iterator.go similarity index 100% rename from api/iterator.go rename to internal/api/iterator.go diff --git a/api/iterator_test.go b/internal/api/iterator_test.go similarity index 100% rename from api/iterator_test.go rename to internal/api/iterator_test.go diff --git a/api/lib.go b/internal/api/lib.go similarity index 98% rename from api/lib.go rename to internal/api/lib.go index e21ec68d..07b072f9 100644 --- a/api/lib.go +++ b/internal/api/lib.go @@ -108,9 +108,11 @@ func AnalyzeCode(cache Cache, checksum []byte) (*types.AnalysisReport, error) { if err != nil { return nil, errorWithMessage(err, errmsg) } + requiredCapabilities := string(copyAndDestroyUnmanagedVector(report.required_capabilities)) res := types.AnalysisReport{ - HasIBCEntryPoints: bool(report.has_ibc_entry_points), - RequiredFeatures: string(copyAndDestroyUnmanagedVector(report.required_features)), + HasIBCEntryPoints: bool(report.has_ibc_entry_points), + RequiredFeatures: requiredCapabilities, + RequiredCapabilities: requiredCapabilities, } return &res, nil } diff --git a/api/lib_test.go b/internal/api/lib_test.go similarity index 95% rename from api/lib_test.go rename to internal/api/lib_test.go index 1f367de8..caab944f 100644 --- a/api/lib_test.go +++ b/internal/api/lib_test.go @@ -61,7 +61,7 @@ func TestCreateAndGet(t *testing.T) { cache, cleanup := withCache(t) defer cleanup() - wasm, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasm, err := ioutil.ReadFile("../../testdata/hackatom.wasm") require.NoError(t, err) checksum, err := Create(cache, wasm) @@ -85,7 +85,7 @@ func TestPin(t *testing.T) { cache, cleanup := withCache(t) defer cleanup() - wasm, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasm, err := ioutil.ReadFile("../../testdata/hackatom.wasm") require.NoError(t, err) checksum, err := Create(cache, wasm) @@ -128,7 +128,7 @@ func TestUnpin(t *testing.T) { cache, cleanup := withCache(t) defer cleanup() - wasm, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasm, err := ioutil.ReadFile("../../testdata/hackatom.wasm") require.NoError(t, err) checksum, err := Create(cache, wasm) @@ -173,7 +173,7 @@ func TestGetMetrics(t *testing.T) { assert.Equal(t, &types.Metrics{}, metrics) // Create contract - wasm, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasm, err := ioutil.ReadFile("../../testdata/hackatom.wasm") require.NoError(t, err) checksum, err := Create(cache, wasm) require.NoError(t, err) @@ -201,7 +201,7 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint32(0), metrics.HitsMemoryCache) require.Equal(t, uint32(1), metrics.HitsFsCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Instantiate 2 msg2 := []byte(`{"verifier": "fred", "beneficiary": "susi"}`) @@ -214,7 +214,7 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint32(1), metrics.HitsMemoryCache) require.Equal(t, uint32(1), metrics.HitsFsCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Pin err = Pin(cache, checksum) @@ -227,8 +227,8 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint32(1), metrics.HitsFsCache) require.Equal(t, uint64(1), metrics.ElementsPinnedMemoryCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizePinnedMemoryCache, 0.18) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizePinnedMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Instantiate 3 msg3 := []byte(`{"verifier": "fred", "beneficiary": "bert"}`) @@ -243,8 +243,8 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint32(1), metrics.HitsFsCache) require.Equal(t, uint64(1), metrics.ElementsPinnedMemoryCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizePinnedMemoryCache, 0.18) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizePinnedMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Unpin err = Unpin(cache, checksum) @@ -259,7 +259,7 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint64(0), metrics.ElementsPinnedMemoryCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) require.Equal(t, uint64(0), metrics.SizePinnedMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Instantiate 4 msg4 := []byte(`{"verifier": "fred", "beneficiary": "jeff"}`) @@ -275,7 +275,7 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint64(0), metrics.ElementsPinnedMemoryCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) require.Equal(t, uint64(0), metrics.SizePinnedMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) } func TestInstantiate(t *testing.T) { @@ -283,7 +283,7 @@ func TestInstantiate(t *testing.T) { defer cleanup() // create contract - wasm, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasm, err := ioutil.ReadFile("../../testdata/hackatom.wasm") require.NoError(t, err) checksum, err := Create(cache, wasm) require.NoError(t, err) @@ -301,7 +301,7 @@ func TestInstantiate(t *testing.T) { res, cost, err := Instantiate(cache, checksum, env, info, msg, &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0x12e722d7c), cost) + assert.Equal(t, uint64(0x1432036ec), cost) var result types.ContractResult err = json.Unmarshal(res, &result) @@ -332,7 +332,7 @@ func TestExecute(t *testing.T) { diff := time.Now().Sub(start) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0x12e722d7c), cost) + assert.Equal(t, uint64(0x1432036ec), cost) t.Logf("Time (%d gas): %s\n", cost, diff) // execute with the same store @@ -345,7 +345,7 @@ func TestExecute(t *testing.T) { res, cost, err = Execute(cache, checksum, env, info, []byte(`{"release":{}}`), &igasMeter2, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) diff = time.Now().Sub(start) require.NoError(t, err) - assert.Equal(t, uint64(0x21f7a66d0), cost) + assert.Equal(t, uint64(0x2335827f0), cost) t.Logf("Time (%d gas): %s\n", cost, diff) // make sure it read the balance properly and we got 250 atoms @@ -396,7 +396,7 @@ func TestExecuteCpuLoop(t *testing.T) { diff := time.Now().Sub(start) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0x12e722d7c), cost) + assert.Equal(t, uint64(0x1432036ec), cost) t.Logf("Time (%d gas): %s\n", cost, diff) // execute a cpu loop @@ -547,7 +547,7 @@ func TestMultipleInstances(t *testing.T) { require.NoError(t, err) requireOkResponse(t, res, 0) // we now count wasm gas charges and db writes - assert.Equal(t, uint64(0x12c4f266c), cost) + assert.Equal(t, uint64(0x140fd2fdc), cost) // instance2 controlled by mary gasMeter2 := NewMockGasMeter(TESTING_GAS_LIMIT) @@ -558,14 +558,14 @@ func TestMultipleInstances(t *testing.T) { res, cost, err = Instantiate(cache, checksum, env, info, msg, &igasMeter2, store2, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0x12d8b01cc), cost) + assert.Equal(t, uint64(0x142390b3c), cost) // fail to execute store1 with mary - resp := exec(t, cache, checksum, "mary", store1, api, querier, 0x115070970) + resp := exec(t, cache, checksum, "mary", store1, api, querier, 0x129b512e0) require.Equal(t, "Unauthorized", resp.Err) // succeed to execute store1 with fred - resp = exec(t, cache, checksum, "fred", store1, api, querier, 0x21e7a0dd0) + resp = exec(t, cache, checksum, "fred", store1, api, querier, 0x23257cef0) require.Equal(t, "", resp.Err) require.Equal(t, 1, len(resp.Ok.Messages)) attributes := resp.Ok.Attributes @@ -574,7 +574,7 @@ func TestMultipleInstances(t *testing.T) { require.Equal(t, "bob", attributes[1].Value) // succeed to execute store2 with mary - resp = exec(t, cache, checksum, "mary", store2, api, querier, 0x21efa3a50) + resp = exec(t, cache, checksum, "mary", store2, api, querier, 0x232d7fb70) require.Equal(t, "", resp.Err) require.Equal(t, 1, len(resp.Ok.Messages)) attributes = resp.Ok.Attributes @@ -775,15 +775,15 @@ func requireQueryOk(t *testing.T, res []byte) []byte { } func createTestContract(t *testing.T, cache Cache) []byte { - return createContract(t, cache, "./testdata/hackatom.wasm") + return createContract(t, cache, "../../testdata/hackatom.wasm") } func createQueueContract(t *testing.T, cache Cache) []byte { - return createContract(t, cache, "./testdata/queue.wasm") + return createContract(t, cache, "../../testdata/queue.wasm") } func createReflectContract(t *testing.T, cache Cache) []byte { - return createContract(t, cache, "./testdata/reflect.wasm") + return createContract(t, cache, "../../testdata/reflect.wasm") } func createContract(t *testing.T, cache Cache, wasmFile string) []byte { diff --git a/api/link_glibclinux_aarch64.go b/internal/api/link_glibclinux_aarch64.go similarity index 50% rename from api/link_glibclinux_aarch64.go rename to internal/api/link_glibclinux_aarch64.go index 4509441a..69773ef0 100644 --- a/api/link_glibclinux_aarch64.go +++ b/internal/api/link_glibclinux_aarch64.go @@ -1,5 +1,5 @@ -//go:build linux && !muslc && arm64 -// +build linux,!muslc,arm64 +//go:build linux && !muslc && arm64 && !sys_wasmvm +// +build linux,!muslc,arm64,!sys_wasmvm package api diff --git a/internal/api/link_glibclinux_x86_64.go b/internal/api/link_glibclinux_x86_64.go new file mode 100644 index 00000000..c3ec8c45 --- /dev/null +++ b/internal/api/link_glibclinux_x86_64.go @@ -0,0 +1,7 @@ +//go:build linux && !muslc && amd64 && !sys_wasmvm +// +build linux,!muslc,amd64,!sys_wasmvm + +package api + +// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lwasmvm.x86_64 +import "C" diff --git a/internal/api/link_mac.go b/internal/api/link_mac.go new file mode 100644 index 00000000..ddd139e0 --- /dev/null +++ b/internal/api/link_mac.go @@ -0,0 +1,7 @@ +//go:build darwin && !sys_wasmvm +// +build darwin,!sys_wasmvm + +package api + +// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lwasmvm +import "C" diff --git a/api/link_muslc.go b/internal/api/link_muslc.go similarity index 54% rename from api/link_muslc.go rename to internal/api/link_muslc.go index c12e14c4..a6716e8d 100644 --- a/api/link_muslc.go +++ b/internal/api/link_muslc.go @@ -1,5 +1,5 @@ -//go:build linux && muslc -// +build linux,muslc +//go:build linux && muslc && !sys_wasmvm +// +build linux,muslc,!sys_wasmvm package api diff --git a/internal/api/link_system.go b/internal/api/link_system.go new file mode 100644 index 00000000..ad354ba5 --- /dev/null +++ b/internal/api/link_system.go @@ -0,0 +1,6 @@ +//go:build sys_wasmvm + +package api + +// #cgo LDFLAGS: -lwasmvm +import "C" diff --git a/api/link_mac.go b/internal/api/link_windows.go similarity index 70% rename from api/link_mac.go rename to internal/api/link_windows.go index 890a3d70..8e45cf01 100644 --- a/api/link_mac.go +++ b/internal/api/link_windows.go @@ -1,5 +1,4 @@ -//go:build darwin -// +build darwin +//go:build windows && !sys_wasmvm package api diff --git a/api/memory.go b/internal/api/memory.go similarity index 100% rename from api/memory.go rename to internal/api/memory.go diff --git a/api/memory_test.go b/internal/api/memory_test.go similarity index 100% rename from api/memory_test.go rename to internal/api/memory_test.go diff --git a/api/mock_failure.go b/internal/api/mock_failure.go similarity index 100% rename from api/mock_failure.go rename to internal/api/mock_failure.go diff --git a/api/mocks.go b/internal/api/mocks.go similarity index 99% rename from api/mocks.go rename to internal/api/mocks.go index f5015621..fe9a0275 100644 --- a/api/mocks.go +++ b/internal/api/mocks.go @@ -26,6 +26,9 @@ func MockEnv() types.Env { Time: 1578939743_987654321, ChainID: "foobar", }, + Transaction: &types.TransactionInfo{ + Index: 4, + }, Contract: types.ContractInfo{ Address: MOCK_CONTRACT_ADDR, }, diff --git a/api/version.go b/internal/api/version.go similarity index 100% rename from api/version.go rename to internal/api/version.go diff --git a/api/version_test.go b/internal/api/version_test.go similarity index 100% rename from api/version_test.go rename to internal/api/version_test.go diff --git a/lib.go b/lib.go index 6fac4764..d215c40f 100644 --- a/lib.go +++ b/lib.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/line/wasmvm/api" + "github.com/line/wasmvm/internal/api" "github.com/line/wasmvm/types" ) diff --git a/lib_test.go b/lib_test.go index 1f792ae3..5fcff369 100644 --- a/lib_test.go +++ b/lib_test.go @@ -1,11 +1,12 @@ package cosmwasm import ( + "encoding/json" "io/ioutil" "os" "testing" - "github.com/line/wasmvm/api" + "github.com/line/wasmvm/internal/api" "github.com/line/wasmvm/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -19,7 +20,8 @@ const ( TESTING_CACHE_SIZE = 100 // MiB ) -const HACKATOM_TEST_CONTRACT = "./api/testdata/hackatom.wasm" +const CYBERPUNK_TEST_CONTRACT = "./testdata/cyberpunk.wasm" +const HACKATOM_TEST_CONTRACT = "./testdata/hackatom.wasm" func withVM(t *testing.T) *VM { tmpdir, err := ioutil.TempDir("", "wasmvm-testing") @@ -97,6 +99,66 @@ func TestHappyPath(t *testing.T) { assert.Equal(t, expectedData, hres.Data) } +func TestEnv(t *testing.T) { + vm := withVM(t) + checksum := createTestContract(t, vm, CYBERPUNK_TEST_CONTRACT) + + deserCost := types.UFraction{1, 1} + gasMeter1 := api.NewMockGasMeter(TESTING_GAS_LIMIT) + // instantiate it with this store + store := api.NewLookup(gasMeter1) + goapi := api.NewMockAPI() + balance := types.Coins{types.NewCoin(250, "ATOM")} + querier := api.DefaultQuerier(api.MOCK_CONTRACT_ADDR, balance) + + // instantiate + env := api.MockEnv() + info := api.MockInfo("creator", nil) + ires, _, err := vm.Instantiate(checksum, env, info, []byte(`{}`), store, *goapi, querier, gasMeter1, TESTING_GAS_LIMIT, deserCost) + require.NoError(t, err) + require.Equal(t, 0, len(ires.Messages)) + + // Execute mirror env without Transaction + env = types.Env{ + Block: types.BlockInfo{ + Height: 444, + Time: 1955939743_123456789, + ChainID: "nice-chain", + }, + Contract: types.ContractInfo{ + Address: "wasm10dyr9899g6t0pelew4nvf4j5c3jcgv0r5d3a5l", + }, + Transaction: nil, + } + info = api.MockInfo("creator", nil) + msg := []byte(`{"mirror_env": {}}`) + ires, _, err = vm.Execute(checksum, env, info, msg, store, *goapi, querier, gasMeter1, TESTING_GAS_LIMIT, deserCost) + require.NoError(t, err) + expected, _ := json.Marshal(env) + require.Equal(t, expected, ires.Data) + + // Execute mirror env with Transaction + env = types.Env{ + Block: types.BlockInfo{ + Height: 444, + Time: 1955939743_123456789, + ChainID: "nice-chain", + }, + Contract: types.ContractInfo{ + Address: "wasm10dyr9899g6t0pelew4nvf4j5c3jcgv0r5d3a5l", + }, + Transaction: &types.TransactionInfo{ + Index: 18, + }, + } + info = api.MockInfo("creator", nil) + msg = []byte(`{"mirror_env": {}}`) + ires, _, err = vm.Execute(checksum, env, info, msg, store, *goapi, querier, gasMeter1, TESTING_GAS_LIMIT, deserCost) + require.NoError(t, err) + expected, _ = json.Marshal(env) + require.Equal(t, expected, ires.Data) +} + func TestGetMetrics(t *testing.T) { vm := withVM(t) @@ -136,7 +198,7 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint32(0), metrics.HitsMemoryCache) require.Equal(t, uint32(1), metrics.HitsFsCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Instantiate 2 msg2 := []byte(`{"verifier": "fred", "beneficiary": "susi"}`) @@ -150,7 +212,7 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint32(1), metrics.HitsMemoryCache) require.Equal(t, uint32(1), metrics.HitsFsCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Pin err = vm.Pin(checksum) @@ -163,8 +225,8 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint32(1), metrics.HitsFsCache) require.Equal(t, uint64(1), metrics.ElementsPinnedMemoryCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizePinnedMemoryCache, 0.18) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizePinnedMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Instantiate 3 msg3 := []byte(`{"verifier": "fred", "beneficiary": "bert"}`) @@ -180,8 +242,8 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint32(1), metrics.HitsFsCache) require.Equal(t, uint64(1), metrics.ElementsPinnedMemoryCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizePinnedMemoryCache, 0.18) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizePinnedMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Unpin err = vm.Unpin(checksum) @@ -196,7 +258,7 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint64(0), metrics.ElementsPinnedMemoryCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) require.Equal(t, uint64(0), metrics.SizePinnedMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) // Instantiate 4 msg4 := []byte(`{"verifier": "fred", "beneficiary": "jeff"}`) @@ -213,5 +275,5 @@ func TestGetMetrics(t *testing.T) { require.Equal(t, uint64(0), metrics.ElementsPinnedMemoryCache) require.Equal(t, uint64(1), metrics.ElementsMemoryCache) require.Equal(t, uint64(0), metrics.SizePinnedMemoryCache) - require.InEpsilon(t, 5665691, metrics.SizeMemoryCache, 0.18) + require.InEpsilon(t, 5602873, metrics.SizeMemoryCache, 0.18) } diff --git a/libwasmvm/Cargo.lock b/libwasmvm/Cargo.lock index 1260808e..c7569b35 100644 --- a/libwasmvm/Cargo.lock +++ b/libwasmvm/Cargo.lock @@ -4,11 +4,11 @@ version = 3 [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.26.1", + "gimli 0.27.0", ] [[package]] @@ -23,27 +23,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.6", + "getrandom", "once_cell", "version_check", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -56,16 +47,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.65" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ "addr2line", "cc", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.30.0", "rustc-demangle", ] @@ -77,15 +68,15 @@ checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64ct" -version = "1.5.0" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea908e7347a8c64e378c17e30ef880ad73e3b4498346b055c2c00ea342f3179" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" [[package]] name = "bitflags" @@ -102,17 +93,26 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" -version = "3.10.0" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "bytecheck" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a31f923c2db9513e4298b72df143e6e655a759b3d6a0966df18f81223fff54f" +checksum = "d11cac2c12b5adc6570dad2ee1b87eff4955dac476fe12d81e5fdd352e52406f" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -120,9 +120,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb17c862a905d912174daa27ae002326fff56dc8b8ada50a0a5f0976cb174f0" +checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf" dependencies = [ "proc-macro2", "quote", @@ -137,9 +137,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cbindgen" -version = "0.18.0" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97449daf9b8c245bcad10bbc7c9f4a37c06172c18dd5f9fac340deefc309b957" +checksum = "a6358dedf60f4d9b8db43ad187391afe959746101346fe51bb978126bec61dfb" dependencies = [ "clap", "heck", @@ -156,9 +156,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" [[package]] name = "cfg-if" @@ -168,17 +168,26 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.34.0" +version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ - "ansi_term", "atty", "bitflags", + "clap_lex", + "indexmap", "strsim", + "termcolor", "textwrap", - "unicode-width", - "vec_map", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", ] [[package]] @@ -189,9 +198,9 @@ checksum = "591ff76ca0691bd91c1b0b5b987e5cf93b21ec810ad96665c5a569c60846dd93" [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "convert_case" @@ -199,23 +208,36 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "corosensei" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9847f90f32a50b0dcbd68bc23ff242798b13080b97b0569f6ed96a45ce4cf2cd" +dependencies = [ + "autocfg", + "cfg-if", + "libc", + "scopeguard", + "windows-sys", +] + [[package]] name = "cosmwasm-crypto" -version = "1.0.0-0.6.0" -source = "git+https://github.com/line/cosmwasm?tag=v1.0.0-0.6.0#2ba51247ad5a0a06453147f6749133a2673fc3ce" +version = "1.1.9-0.7.0" +source = "git+https://github.com/line/cosmwasm?rev=6ea2dfb#6ea2dfb77929c901fa8629df5c7753457b546860" dependencies = [ - "digest", + "digest 0.10.6", "ed25519-zebra", "k256", - "rand_core 0.6.3", + "rand_core 0.6.4", "sha-1", "thiserror", ] [[package]] name = "cosmwasm-derive" -version = "1.0.0-0.6.0" -source = "git+https://github.com/line/cosmwasm?tag=v1.0.0-0.6.0#2ba51247ad5a0a06453147f6749133a2673fc3ce" +version = "1.1.9-0.7.0" +source = "git+https://github.com/line/cosmwasm?rev=6ea2dfb#6ea2dfb77929c901fa8629df5c7753457b546860" dependencies = [ "convert_case", "proc-macro2", @@ -225,13 +247,15 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.0.0-0.6.0" -source = "git+https://github.com/line/cosmwasm?tag=v1.0.0-0.6.0#2ba51247ad5a0a06453147f6749133a2673fc3ce" +version = "1.1.9-0.7.0" +source = "git+https://github.com/line/cosmwasm?rev=6ea2dfb#6ea2dfb77929c901fa8629df5c7753457b546860" dependencies = [ "base64", "cosmwasm-crypto", "cosmwasm-derive", + "derivative", "forward_ref", + "hex", "schemars", "serde", "serde-json-wasm", @@ -242,19 +266,22 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.0.0-0.6.0" -source = "git+https://github.com/line/cosmwasm?tag=v1.0.0-0.6.0#2ba51247ad5a0a06453147f6749133a2673fc3ce" +version = "1.1.9-0.7.0" +source = "git+https://github.com/line/cosmwasm?rev=6ea2dfb#6ea2dfb77929c901fa8629df5c7753457b546860" dependencies = [ + "bitflags", + "bytecheck", "clru", "cosmwasm-crypto", "cosmwasm-std", + "enumset", "hex", "loupe", "parity-wasm", "schemars", "serde", "serde_json", - "sha2", + "sha2 0.10.6", "thiserror", "wasmer", "wasmer-middlewares", @@ -262,33 +289,33 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ "libc", ] [[package]] name = "cranelift-bforest" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e6bea67967505247f54fa2c85cf4f6e0e31c4e5692c9b70e4ae58e339067333" +checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48194035d2752bdd5bdae429e3ab88676e95f52a2b1355a5d4e809f9e39b1d74" +checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b" dependencies = [ "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", - "gimli 0.25.0", + "gimli 0.26.2", "log", "regalloc", "smallvec", @@ -297,31 +324,30 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976efb22fcab4f2cd6bd4e9913764616a54d895c1a23530128d04e03633c555f" +checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24" dependencies = [ "cranelift-codegen-shared", - "cranelift-entity", ] [[package]] name = "cranelift-codegen-shared" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dabb5fe66e04d4652e434195b45ae65b5c8172d520247b8f66d8df42b2b45dc" +checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc" [[package]] name = "cranelift-entity" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3329733e4d4b8e91c809efcaa4faee80bf66f20164e3dd16d707346bd3494799" +checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf" [[package]] name = "cranelift-frontend" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279afcc0d3e651b773f94837c3d581177b348c8d69e928104b2e9fccb226f921" +checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce" dependencies = [ "cranelift-codegen", "log", @@ -340,9 +366,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if", "crossbeam-utils", @@ -350,9 +376,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -361,26 +387,24 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "lazy_static", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", - "lazy_static", ] [[package]] @@ -391,24 +415,24 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", "zeroize", ] [[package]] -name = "crypto-mac" -version = "0.11.1" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "subtle", + "typenum", ] [[package]] @@ -418,7 +442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ "byteorder", - "digest", + "digest 0.9.0", "rand_core 0.5.1", "subtle", "zeroize", @@ -426,9 +450,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.13.4" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" dependencies = [ "darling_core", "darling_macro", @@ -436,9 +460,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.13.4" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" dependencies = [ "fnv", "ident_case", @@ -449,9 +473,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" dependencies = [ "darling_core", "quote", @@ -460,11 +484,23 @@ dependencies = [ [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -476,11 +512,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "digest" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer 0.10.3", + "crypto-common", + "subtle", +] + [[package]] name = "dyn-clone" -version = "1.0.5" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e50f3adc76d6a43f5ed73b698a87d0760ca74617f60f7c3b879003536fdd28" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "dynasm" @@ -510,9 +557,9 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -522,38 +569,40 @@ dependencies = [ [[package]] name = "ed25519-zebra" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403ef3e961ab98f0ba902771d29f842058578bb1ce7e3c59dad5a6a93e784c69" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek", + "hashbrown 0.12.3", "hex", - "rand_core 0.6.3", + "rand_core 0.6.4", "serde", - "sha2", - "thiserror", + "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array", "group", - "rand_core 0.6.3", + "pkcs8", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -581,18 +630,18 @@ dependencies = [ [[package]] name = "enumset" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" +checksum = "19be8061a06ab6f3a6cf21106c873578bf01bd42ad15e0311a9c76161cb1c753" dependencies = [ "enumset_derive", ] [[package]] name = "enumset_derive" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" +checksum = "03e7b551eba279bf0fa88b83a46330168c1560a52a94f5126f892f0b364ab3e0" dependencies = [ "darling", "proc-macro2", @@ -629,20 +678,20 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", ] @@ -660,9 +709,9 @@ checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -670,31 +719,20 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "gimli" -version = "0.25.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", "indexmap", @@ -703,18 +741,18 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", ] @@ -729,21 +767,18 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash", ] [[package]] name = "heck" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" @@ -754,6 +789,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -762,12 +806,11 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hmac" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "crypto-mac", - "digest", + "digest 0.10.6", ] [[package]] @@ -778,12 +821,12 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "1.8.2" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown 0.11.2", + "hashbrown 0.12.3", "serde", ] @@ -798,30 +841,29 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" -version = "0.3.57" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "sec1", - "sha2", + "sha2 0.10.6", ] [[package]] @@ -838,15 +880,15 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.126" +version = "0.2.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" [[package]] name = "libloading" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", "winapi", @@ -899,9 +941,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.5.3" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f" +checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" dependencies = [ "libc", ] @@ -915,11 +957,20 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "miniz_oxide" -version = "0.5.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -932,11 +983,11 @@ checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -952,11 +1003,20 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" -version = "1.12.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" @@ -964,6 +1024,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "os_str_bytes" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + [[package]] name = "parity-wasm" version = "0.42.2" @@ -978,13 +1044,12 @@ checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pkcs8" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ "der", "spki", - "zeroize", ] [[package]] @@ -1013,9 +1078,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] @@ -1042,9 +1107,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.18" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -1054,36 +1119,31 @@ name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.6", + "getrandom", ] [[package]] name = "rayon" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -1093,18 +1153,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] [[package]] name = "regalloc" -version = "0.0.31" +version = "0.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" +checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02" dependencies = [ "log", "rustc-hash", @@ -1143,9 +1203,9 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", "hmac", @@ -1154,12 +1214,12 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.38" +version = "0.7.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "517a3034eb2b1499714e9d1e49b2367ad567e07639b69776d35e259d9c27cca6" +checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" dependencies = [ "bytecheck", - "hashbrown 0.12.1", + "hashbrown 0.12.3", "ptr_meta", "rend", "rkyv_derive", @@ -1168,9 +1228,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.38" +version = "0.7.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "505c209ee04111a006431abf39696e640838364d67a107c559ababaf6fd8c9dd" +checksum = "6eaedadc88b53e36dd32d940ed21ae4d850d5916f2581526921f553a72ac34c4" dependencies = [ "proc-macro2", "quote", @@ -1191,21 +1251,21 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustversion" -version = "1.0.6" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "schemars" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1847b767a3d62d95cbf3d8a9f0e421cf57a0d8aa4f411d4b16525afb0284d4ed" +checksum = "2a5fb6c61f29e723026dc8e923d94c694313212abbecbbe5f55a7748eec5b307" dependencies = [ "dyn-clone", "schemars_derive", @@ -1215,9 +1275,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4d7e1b012cb3d9129567661a63755ea4b8a7386d339dc945ae187e403c6743" +checksum = "f188d036977451159430f3b8dc82ec76364a42b7e289c2b18a9a18f4470058e9" dependencies = [ "proc-macro2", "quote", @@ -1239,10 +1299,11 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array", "pkcs8", @@ -1252,9 +1313,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.137" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0" dependencies = [ "serde_derive", ] @@ -1270,18 +1331,18 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.6" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" +checksum = "718dc5fff5b36f99093fc49b280cfc96ce6fc824317783bff5a1fed0c7a64819" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" dependencies = [ "proc-macro2", "quote", @@ -1301,9 +1362,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa", "ryu", @@ -1316,10 +1377,10 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if", "cpufeatures", - "digest", + "digest 0.9.0", "opaque-debug", ] @@ -1335,34 +1396,45 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if", "cpufeatures", - "digest", + "digest 0.9.0", "opaque-debug", ] +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest", - "rand_core 0.6.3", + "digest 0.10.6", + "rand_core 0.6.4", ] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "spki" -version = "0.5.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", "der", @@ -1382,9 +1454,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" @@ -1394,9 +1466,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.95" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -1405,9 +1477,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" +checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" [[package]] name = "tempfile" @@ -1424,28 +1496,34 @@ dependencies = [ ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "termcolor" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "unicode-width", + "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -1454,18 +1532,18 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] [[package]] name = "tracing" -version = "0.1.34" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "log", @@ -1476,9 +1554,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", @@ -1487,24 +1565,24 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.26" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -1514,38 +1592,20 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "unicode-width" -version = "0.1.9" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "uuid" -version = "1.1.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d5d669b51467dcf7b2f1a796ce0f955f05f01cafda6c19d6e95f730df29238" +checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" dependencies = [ "serde", "sha1_smol", ] -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" @@ -1554,21 +1614,15 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1576,13 +1630,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -1591,9 +1645,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1601,9 +1655,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", @@ -1614,15 +1668,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "wasmer" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f727a39e7161f7438ddb8eafe571b67c576a8c2fb459f666d9053b5bba4afdea" +checksum = "ea8d8361c9d006ea3d7797de7bd6b1492ffd0f91a22430cfda6c1658ad57bedf" dependencies = [ "cfg-if", "indexmap", @@ -1632,6 +1686,7 @@ dependencies = [ "target-lexicon", "thiserror", "wasm-bindgen", + "wasmer-artifact", "wasmer-compiler", "wasmer-compiler-cranelift", "wasmer-compiler-singlepass", @@ -1644,11 +1699,24 @@ dependencies = [ "winapi", ] +[[package]] +name = "wasmer-artifact" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aaf9428c29c1d8ad2ac0e45889ba8a568a835e33fd058964e5e500f2f7ce325" +dependencies = [ + "enumset", + "loupe", + "thiserror", + "wasmer-compiler", + "wasmer-types", +] + [[package]] name = "wasmer-compiler" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9951599222eb12bd13d4d91bcded0a880e4c22c2dfdabdf5dc7e5e803b7bf3" +checksum = "e67a6cd866aed456656db2cfea96c18baabbd33f676578482b85c51e1ee19d2c" dependencies = [ "enumset", "loupe", @@ -1659,20 +1727,19 @@ dependencies = [ "target-lexicon", "thiserror", "wasmer-types", - "wasmer-vm", "wasmparser", ] [[package]] name = "wasmer-compiler-cranelift" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c83273bce44e668f3a2b9ccb7f1193db918b1d6806f64acc5ff71f6ece5f20" +checksum = "48be2f9f6495f08649e4f8b946a2cbbe119faf5a654aa1457f9504a99d23dae0" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", - "gimli 0.25.0", + "gimli 0.26.2", "loupe", "more-asserts", "rayon", @@ -1681,18 +1748,18 @@ dependencies = [ "tracing", "wasmer-compiler", "wasmer-types", - "wasmer-vm", ] [[package]] name = "wasmer-compiler-singlepass" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5432e993840cdb8e6875ddc8c9eea64e7a129579b4706bd91b8eb474d9c4a860" +checksum = "29ca2a35204d8befa85062bc7aac259a8db8070b801b8a783770ba58231d729e" dependencies = [ "byteorder", "dynasm", "dynasmrt", + "gimli 0.26.2", "lazy_static", "loupe", "more-asserts", @@ -1700,14 +1767,13 @@ dependencies = [ "smallvec", "wasmer-compiler", "wasmer-types", - "wasmer-vm", ] [[package]] name = "wasmer-derive" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458dbd9718a837e6dbc52003aef84487d79eedef5fa28c7d28b6784be98ac08e" +checksum = "00e50405cc2a2f74ff574584710a5f2c1d5c93744acce2ca0866084739284b51" dependencies = [ "proc-macro-error", "proc-macro2", @@ -1717,9 +1783,9 @@ dependencies = [ [[package]] name = "wasmer-engine" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed603a6d037ebbb14014d7f739ae996a78455a4b86c41cfa4e81c590a1253b9" +checksum = "3f98f010978c244db431b392aeab0661df7ea0822343334f8f2a920763548e45" dependencies = [ "backtrace", "enumset", @@ -1732,6 +1798,7 @@ dependencies = [ "serde_bytes", "target-lexicon", "thiserror", + "wasmer-artifact", "wasmer-compiler", "wasmer-types", "wasmer-vm", @@ -1739,9 +1806,9 @@ dependencies = [ [[package]] name = "wasmer-engine-dylib" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccd7fdc60e252a795c849b3f78a81a134783051407e7e279c10b7019139ef8dc" +checksum = "ad0358af9c154724587731175553805648d9acb8f6657880d165e378672b7e53" dependencies = [ "cfg-if", "enum-iterator", @@ -1749,11 +1816,12 @@ dependencies = [ "leb128", "libloading", "loupe", - "object", + "object 0.28.4", "rkyv", "serde", "tempfile", "tracing", + "wasmer-artifact", "wasmer-compiler", "wasmer-engine", "wasmer-object", @@ -1764,12 +1832,11 @@ dependencies = [ [[package]] name = "wasmer-engine-universal" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcff0cd2c01a8de6009fd863b14ea883132a468a24f2d2ee59dc34453d3a31b5" +checksum = "440dc3d93c9ca47865a4f4edd037ea81bf983b5796b59b3d712d844b32dbef15" dependencies = [ "cfg-if", - "enum-iterator", "enumset", "leb128", "loupe", @@ -1777,16 +1844,33 @@ dependencies = [ "rkyv", "wasmer-compiler", "wasmer-engine", + "wasmer-engine-universal-artifact", "wasmer-types", "wasmer-vm", "winapi", ] +[[package]] +name = "wasmer-engine-universal-artifact" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f1db3f54152657eb6e86c44b66525ff7801dad8328fe677da48dd06af9ad41" +dependencies = [ + "enum-iterator", + "enumset", + "loupe", + "rkyv", + "thiserror", + "wasmer-artifact", + "wasmer-compiler", + "wasmer-types", +] + [[package]] name = "wasmer-middlewares" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "659775db15684f4674c3a8967409682c2eb44f63cc21121fa3dcd975c03ab887" +checksum = "d7812438ed2f37203a37007cdb5332b8475cb2b16e15d51299b2647894e9ed3a" dependencies = [ "loupe", "wasmer", @@ -1796,11 +1880,11 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ce18ac2877050e59580d27ee1a88f3192d7a31e77fbba0852abc7888d6e0b5" +checksum = "8d831335ff3a44ecf451303f6f891175c642488036b92ceceb24ac8623a8fa8b" dependencies = [ - "object", + "object 0.28.4", "thiserror", "wasmer-compiler", "wasmer-types", @@ -1808,12 +1892,15 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "659fa3dd6c76f62630deff4ac8c7657b07f0b1e4d7e0f8243a552b9d9b448e24" +checksum = "39df01ea05dc0a9bab67e054c7cb01521e53b35a7bb90bd02eca564ed0b2667f" dependencies = [ + "backtrace", + "enum-iterator", "indexmap", "loupe", + "more-asserts", "rkyv", "serde", "thiserror", @@ -1821,36 +1908,41 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afdc46158517c2769f9938bc222a7d41b3bb330824196279d8aa2d667cd40641" +checksum = "30d965fa61f4dc4cdb35a54daaf7ecec3563fbb94154a6c35433f879466247dd" dependencies = [ "backtrace", "cc", "cfg-if", + "corosensei", "enum-iterator", "indexmap", + "lazy_static", "libc", "loupe", - "memoffset", + "mach", + "memoffset 0.6.5", "more-asserts", "region", "rkyv", + "scopeguard", "serde", "thiserror", + "wasmer-artifact", "wasmer-types", "winapi", ] [[package]] name = "wasmparser" -version = "0.78.2" +version = "0.83.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65" +checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wasmvm" -version = "1.0.0-0.10.0" +version = "1.1.1-0.11.0" dependencies = [ "cbindgen", "cosmwasm-std", @@ -1865,13 +1957,13 @@ dependencies = [ [[package]] name = "which" -version = "4.2.5" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" +checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" dependencies = [ "either", - "lazy_static", "libc", + "once_cell", ] [[package]] @@ -1890,14 +1982,66 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" + +[[package]] +name = "windows_i686_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" + +[[package]] +name = "windows_i686_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" + [[package]] name = "zeroize" -version = "1.5.5" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94693807d016b2f2d2e14420eb3bfcca689311ff775dcf113d74ea624b7cdf07" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" diff --git a/libwasmvm/Cargo.toml b/libwasmvm/Cargo.toml index bcc26818..f264001b 100644 --- a/libwasmvm/Cargo.toml +++ b/libwasmvm/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "wasmvm" -version = "1.0.0-0.10.0" +version = "1.1.1-0.11.0" publish = false authors = ["LINE Plus Corporation"] -edition = "2018" +edition = "2021" description = "Go bindings for cosmwasm contracts" repository = "https://github.com/line/wasmvm" license = "Apache-2.0" @@ -13,16 +13,16 @@ exclude = [".circleci/*", ".gitignore"] [lib] crate-type = ["cdylib"] -# the example is to allow us to compile a static lib with the same codebase as we compile the +# the example is to allow us to compile a muslc static lib with the same codebase as we compile the # normal dynamic libs (best workaround I could find to override crate-type on the command line) [[example]] name = "muslc" path = "src/lib.rs" crate-type = ["staticlib"] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[badges] -maintenance = { status = "actively-developed" } +# # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +# [badges] +# maintenance = { status = "actively-developed" } [features] default = [] @@ -30,8 +30,8 @@ default = [] backtraces = [] [dependencies] -cosmwasm-std = { git = "https://github.com/line/cosmwasm", tag = "v1.0.0-0.6.0", features = ["iterator","staking","stargate"] } -cosmwasm-vm = { git = "https://github.com/line/cosmwasm", tag = "v1.0.0-0.6.0", features = ["iterator","staking","stargate"] } +cosmwasm-std = { git = "https://github.com/line/cosmwasm", rev = "6ea2dfb", features = ["iterator","staking","stargate"]} +cosmwasm-vm = { git = "https://github.com/line/cosmwasm", rev = "6ea2dfb", features = ["iterator","staking","stargate"]} errno = "0.2" serde_json = "1.0" thiserror = "1.0" @@ -42,7 +42,7 @@ serde = { version = "1.0.103", default-features = false, features = ["derive"] } tempfile = "3.1.0" [build-dependencies] -cbindgen = "0.18.0" +cbindgen = "0.24.3" [profile.release] opt-level = 3 diff --git a/libwasmvm/bindings.h b/libwasmvm/bindings.h index 1ac72286..1d8c973e 100644 --- a/libwasmvm/bindings.h +++ b/libwasmvm/bindings.h @@ -1,6 +1,6 @@ -/* (c) 2019 Confio UO. Licensed under Apache-2.0 */ +/* (c) 2019 Confio OÜ. Licensed under Apache-2.0 */ -/* Generated with cbindgen:0.18.0 */ +/* Generated with cbindgen:0.24.3 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -196,17 +196,17 @@ typedef struct UnmanagedVector { /** * The result type of the FFI function analyze_code. * - * Please note that the unmanaged vector in `required_features` + * Please note that the unmanaged vector in `required_capabilities` * has to be destroyed exactly once. When calling `analyze_code` * from Go this is done via `C.destroy_unmanaged_vector`. */ typedef struct AnalysisReport { bool has_ibc_entry_points; /** - * An UTF-8 encoded comma separated list of reqired features. + * An UTF-8 encoded comma separated list of reqired capabilities. * This is never None/nil. */ - struct UnmanagedVector required_features; + struct UnmanagedVector required_capabilities; } AnalysisReport; typedef struct Metrics { @@ -304,7 +304,7 @@ typedef struct GoQuerier { } GoQuerier; struct cache_t *init_cache(struct ByteSliceView data_dir, - struct ByteSliceView supported_features, + struct ByteSliceView available_capabilities, uint32_t cache_size, uint32_t instance_memory_limit, struct UnmanagedVector *error_msg); diff --git a/libwasmvm/cbindgen.toml b/libwasmvm/cbindgen.toml index 0e396520..4c3f41ca 100644 --- a/libwasmvm/cbindgen.toml +++ b/libwasmvm/cbindgen.toml @@ -11,7 +11,7 @@ language = "C" ############## Options for Wrapping the Contents of the Header ################# - header = "/* (c) 2019 Confio UO. Licensed under Apache-2.0 */" + header = "/* (c) 2019 Confio OÜ. Licensed under Apache-2.0 */" # trailer = "/* Text to put at the end of the generated file */" # include_guard = "my_bindings_h" autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" diff --git a/libwasmvm/src/args.rs b/libwasmvm/src/args.rs index 180cfa35..69ab5fe7 100644 --- a/libwasmvm/src/args.rs +++ b/libwasmvm/src/args.rs @@ -1,6 +1,6 @@ // store some common string for argument names pub const DATA_DIR_ARG: &str = "data_dir"; -pub const FEATURES_ARG: &str = "supported_features"; +pub const AVAILABLE_CAPABILITIES_ARG: &str = "available_capabilities"; pub const CACHE_ARG: &str = "cache"; pub const WASM_ARG: &str = "wasm"; pub const CHECKSUM_ARG: &str = "checksum"; diff --git a/libwasmvm/src/cache.rs b/libwasmvm/src/cache.rs index a2c6de91..93236114 100644 --- a/libwasmvm/src/cache.rs +++ b/libwasmvm/src/cache.rs @@ -3,10 +3,10 @@ use std::convert::TryInto; use std::panic::{catch_unwind, AssertUnwindSafe}; use std::str::from_utf8; -use cosmwasm_vm::{features_from_csv, Cache, CacheOptions, Checksum, Size}; +use cosmwasm_vm::{capabilities_from_csv, Cache, CacheOptions, Checksum, Size}; use crate::api::GoApi; -use crate::args::{CACHE_ARG, CHECKSUM_ARG, DATA_DIR_ARG, FEATURES_ARG, WASM_ARG}; +use crate::args::{AVAILABLE_CAPABILITIES_ARG, CACHE_ARG, CHECKSUM_ARG, DATA_DIR_ARG, WASM_ARG}; use crate::error::{handle_c_error_binary, handle_c_error_default, handle_c_error_ptr, Error}; use crate::memory::{ByteSliceView, UnmanagedVector}; use crate::querier::GoQuerier; @@ -27,7 +27,7 @@ pub fn to_cache(ptr: *mut cache_t) -> Option<&'static mut Cache, @@ -35,7 +35,7 @@ pub extern "C" fn init_cache( let r = catch_unwind(|| { do_init_cache( data_dir, - supported_features, + available_capabilities, cache_size, instance_memory_limit, ) @@ -46,7 +46,7 @@ pub extern "C" fn init_cache( fn do_init_cache( data_dir: ByteSliceView, - supported_features: ByteSliceView, + available_capabilities: ByteSliceView, cache_size: u32, // in MiB instance_memory_limit: u32, // in MiB ) -> Result<*mut Cache, Error> { @@ -55,11 +55,10 @@ fn do_init_cache( .ok_or_else(|| Error::unset_arg(DATA_DIR_ARG))?; let dir_str = String::from_utf8(dir.to_vec())?; // parse the supported features - let features_bin = supported_features + let capabilities_bin = available_capabilities .read() - .ok_or_else(|| Error::unset_arg(FEATURES_ARG))?; - let features_str = from_utf8(features_bin)?; - let features = features_from_csv(features_str); + .ok_or_else(|| Error::unset_arg(AVAILABLE_CAPABILITIES_ARG))?; + let capabilities = capabilities_from_csv(from_utf8(capabilities_bin)?); let memory_cache_size = Size::mebi( cache_size .try_into() @@ -72,7 +71,7 @@ fn do_init_cache( ); let options = CacheOptions { base_dir: dir_str.into(), - supported_features: features, + available_capabilities: capabilities, memory_cache_size, instance_memory_limit, }; @@ -186,29 +185,29 @@ fn do_unpin( /// The result type of the FFI function analyze_code. /// -/// Please note that the unmanaged vector in `required_features` +/// Please note that the unmanaged vector in `required_capabilities` /// has to be destroyed exactly once. When calling `analyze_code` /// from Go this is done via `C.destroy_unmanaged_vector`. #[repr(C)] #[derive(Copy, Clone, Default, Debug, PartialEq)] pub struct AnalysisReport { pub has_ibc_entry_points: bool, - /// An UTF-8 encoded comma separated list of reqired features. + /// An UTF-8 encoded comma separated list of reqired capabilities. /// This is never None/nil. - pub required_features: UnmanagedVector, + pub required_capabilities: UnmanagedVector, } impl From for AnalysisReport { fn from(report: cosmwasm_vm::AnalysisReport) -> Self { let cosmwasm_vm::AnalysisReport { has_ibc_entry_points, - required_features, + required_capabilities, } = report; - let required_features_utf8 = set_to_csv(required_features).into_bytes(); + let required_capabilities_utf8 = set_to_csv(required_capabilities).into_bytes(); AnalysisReport { has_ibc_entry_points, - required_features: UnmanagedVector::new(Some(required_features_utf8)), + required_capabilities: UnmanagedVector::new(Some(required_capabilities_utf8)), } } } @@ -329,12 +328,14 @@ pub extern "C" fn release_cache(cache: *mut cache_t) { #[cfg(test)] mod tests { + use crate::assert_approx_eq; + use super::*; use std::iter::FromIterator; use tempfile::TempDir; - static HACKATOM: &[u8] = include_bytes!("../../api/testdata/hackatom.wasm"); - static IBC_REFLECT: &[u8] = include_bytes!("../../api/testdata/ibc_reflect.wasm"); + static HACKATOM: &[u8] = include_bytes!("../../testdata/hackatom.wasm"); + static IBC_REFLECT: &[u8] = include_bytes!("../../testdata/ibc_reflect.wasm"); #[test] fn init_cache_and_release_cache_work() { @@ -591,7 +592,10 @@ mod tests { ); let _ = error_msg.consume(); assert!(!hackatom_report.has_ibc_entry_points); - assert_eq!(hackatom_report.required_features.consume().unwrap(), b""); + assert_eq!( + hackatom_report.required_capabilities.consume().unwrap(), + b"" + ); let mut error_msg = UnmanagedVector::default(); let ibc_reflect_report = analyze_code( @@ -601,10 +605,10 @@ mod tests { ); let _ = error_msg.consume(); assert!(ibc_reflect_report.has_ibc_entry_points); - let required_features = - String::from_utf8_lossy(&ibc_reflect_report.required_features.consume().unwrap()) + let required_capabilities = + String::from_utf8_lossy(&ibc_reflect_report.required_capabilities.consume().unwrap()) .to_string(); - assert_eq!(required_features, "iterator,stargate"); + assert_eq!(required_capabilities, "iterator,stargate"); release_cache(cache_ptr); } @@ -709,16 +713,11 @@ mod tests { assert_eq!(misses, 0); assert_eq!(elements_pinned_memory_cache, 1); assert_eq!(elements_memory_cache, 0); - let expected = 5665691; // +/- 20% - assert!( - size_pinned_memory_cache > expected * 80 / 100, - "size_pinned_memory_cache: {}", - size_pinned_memory_cache - ); - assert!( - size_pinned_memory_cache < expected * 120 / 100, - "size_pinned_memory_cache: {}", - size_pinned_memory_cache + assert_approx_eq!( + size_pinned_memory_cache, + 5602873, + "0.2", + "size_pinned_memory_cache: {size_pinned_memory_cache}" ); assert_eq!(size_memory_cache, 0); diff --git a/libwasmvm/src/lib.rs b/libwasmvm/src/lib.rs index a4608c9b..8cf1a0a1 100644 --- a/libwasmvm/src/lib.rs +++ b/libwasmvm/src/lib.rs @@ -12,6 +12,7 @@ mod iterator; mod memory; mod querier; mod storage; +mod test_utils; mod tests; mod version; diff --git a/libwasmvm/src/test_utils.rs b/libwasmvm/src/test_utils.rs new file mode 100644 index 00000000..d6e5f515 --- /dev/null +++ b/libwasmvm/src/test_utils.rs @@ -0,0 +1,102 @@ +#![cfg(test)] + +use cosmwasm_std::{Decimal, Uint128}; +use std::str::FromStr as _; + +/// Asserts that two expressions are approximately equal to each other. +/// +/// The `max_rel_diff` argument defines the maximum relative difference +/// of the `left` and `right` values. +/// +/// On panic, this macro will print the values of the arguments and +/// the actual relative difference. +/// +/// Like [`assert_eq!`], this macro has a second form, where a custom +/// panic message can be provided. +#[macro_export] +macro_rules! assert_approx_eq { + ($left:expr, $right:expr, $max_rel_diff:expr $(,)?) => {{ + $crate::test_utils::assert_approx_eq_impl($left, $right, $max_rel_diff, None); + }}; + ($left:expr, $right:expr, $max_rel_diff:expr, $($args:tt)+) => {{ + $crate::test_utils::assert_approx_eq_impl($left, $right, $max_rel_diff, Some(format!($($args)*))); + }}; +} + +#[track_caller] +pub fn assert_approx_eq_impl>( + left: U, + right: U, + max_rel_diff: &str, + panic_msg: Option, +) { + let left = left.into(); + let right = right.into(); + let max_rel_diff = Decimal::from_str(max_rel_diff).unwrap(); + + let largest = std::cmp::max(left, right); + let rel_diff = Decimal::from_ratio(left.abs_diff(right), largest); + + if rel_diff > max_rel_diff { + match panic_msg { + Some(panic_msg) => panic!( + "assertion failed: `(left ≈ right)`\nleft: {}\nright: {}\nrelative difference: {}\nmax allowed relative difference: {}\n: {}", + left, right, rel_diff, max_rel_diff, panic_msg + ), + None => panic!( + "assertion failed: `(left ≈ right)`\nleft: {}\nright: {}\nrelative difference: {}\nmax allowed relative difference: {}\n", + left, right, rel_diff, max_rel_diff + ), + } + } +} + +mod tests { + #[test] + fn assert_approx() { + assert_approx_eq!(9_u32, 10_u32, "0.12"); + assert_approx_eq!(9_u64, 10_u64, "0.12"); + assert_approx_eq!( + 9_000_000_000_000_000_000_000_000_000_000_000_000_u128, + 10_000_000_000_000_000_000_000_000_000_000_000_000_u128, + "0.10" + ); + } + + #[test] + fn assert_approx_with_vars() { + let a = 66_u32; + let b = 67_u32; + assert_approx_eq!(a, b, "0.02"); + + let a = 66_u64; + let b = 67_u64; + assert_approx_eq!(a, b, "0.02"); + + let a = 66_u128; + let b = 67_u128; + assert_approx_eq!(a, b, "0.02"); + } + + #[test] + #[should_panic( + expected = "assertion failed: `(left ≈ right)`\nleft: 8\nright: 10\nrelative difference: 0.2\nmax allowed relative difference: 0.12\n" + )] + fn assert_approx_fail() { + assert_approx_eq!(8_u32, 10_u32, "0.12"); + } + + #[test] + #[should_panic( + expected = "assertion failed: `(left ≈ right)`\nleft: 17\nright: 20\nrelative difference: 0.15\nmax allowed relative difference: 0.12\n: some extra info about the error" + )] + fn assert_approx_with_custom_panic_msg() { + assert_approx_eq!( + 17_u32, + 20_u32, + "0.12", + "some extra {} about the error", + "info" + ); + } +} diff --git a/libwasmvm/src/tests.rs b/libwasmvm/src/tests.rs index 94e8519d..81010298 100644 --- a/libwasmvm/src/tests.rs +++ b/libwasmvm/src/tests.rs @@ -6,11 +6,11 @@ use tempfile::TempDir; use cosmwasm_std::coins; use cosmwasm_vm::testing::{mock_backend, mock_env, mock_info, mock_instance_with_gas_limit}; use cosmwasm_vm::{ - call_execute_raw, call_instantiate_raw, features_from_csv, to_vec, Cache, CacheOptions, + call_execute_raw, call_instantiate_raw, capabilities_from_csv, to_vec, Cache, CacheOptions, InstanceOptions, Size, }; -static CONTRACT: &[u8] = include_bytes!("../../api/testdata/hackatom.wasm"); +static CONTRACT: &[u8] = include_bytes!("../../testdata/hackatom.wasm"); const PRINT_DEBUG: bool = false; const MEMORY_CACHE_SIZE: Size = Size::mebi(200); const MEMORY_LIMIT: Size = Size::mebi(32); @@ -40,7 +40,7 @@ fn handle_cpu_loop_with_cache() { let backend = mock_backend(&[]); let options = CacheOptions { base_dir: TempDir::new().unwrap().path().to_path_buf(), - supported_features: features_from_csv("staking"), + available_capabilities: capabilities_from_csv("staking"), memory_cache_size: MEMORY_CACHE_SIZE, instance_memory_limit: MEMORY_LIMIT, }; diff --git a/api/testdata/README.md b/testdata/README.md similarity index 100% rename from api/testdata/README.md rename to testdata/README.md diff --git a/testdata/cyberpunk.wasm b/testdata/cyberpunk.wasm new file mode 100644 index 00000000..4c1993df Binary files /dev/null and b/testdata/cyberpunk.wasm differ diff --git a/api/testdata/download_releases.sh b/testdata/download_releases.sh similarity index 84% rename from api/testdata/download_releases.sh rename to testdata/download_releases.sh index d9a00e2a..ac05bfbe 100755 --- a/api/testdata/download_releases.sh +++ b/testdata/download_releases.sh @@ -9,7 +9,7 @@ fi tag="$1" -for contract in hackatom queue reflect ibc_reflect ; do +for contract in cyberpunk hackatom queue reflect ibc_reflect; do url="https://github.com/line/cosmwasm/releases/download/$tag/$contract.wasm" echo "Downloading $url ..." wget -O "$contract.wasm" "$url" diff --git a/api/testdata/hackatom.wasm b/testdata/hackatom.wasm similarity index 100% rename from api/testdata/hackatom.wasm rename to testdata/hackatom.wasm diff --git a/api/testdata/ibc_reflect.wasm b/testdata/ibc_reflect.wasm similarity index 100% rename from api/testdata/ibc_reflect.wasm rename to testdata/ibc_reflect.wasm diff --git a/api/testdata/queue.wasm b/testdata/queue.wasm similarity index 100% rename from api/testdata/queue.wasm rename to testdata/queue.wasm diff --git a/api/testdata/reflect.wasm b/testdata/reflect.wasm similarity index 100% rename from api/testdata/reflect.wasm rename to testdata/reflect.wasm diff --git a/types/env.go b/types/env.go index 74020a22..9dc882b0 100644 --- a/types/env.go +++ b/types/env.go @@ -9,8 +9,8 @@ package types // Env are json encoded to a byte slice before passing to the wasm contract. type Env struct { Block BlockInfo `json:"block"` + Transaction *TransactionInfo `json:"transaction"` Contract ContractInfo `json:"contract"` - Transaction *TransactionInfo `json:"transaction_info,omitempty"` } type BlockInfo struct { diff --git a/types/queries.go b/types/queries.go index 64bc0dbd..e9d1aa09 100644 --- a/types/queries.go +++ b/types/queries.go @@ -90,10 +90,20 @@ type QueryRequest struct { } type BankQuery struct { + Supply *SupplyQuery `json:"supply,omitempty"` Balance *BalanceQuery `json:"balance,omitempty"` AllBalances *AllBalancesQuery `json:"all_balances,omitempty"` } +type SupplyQuery struct { + Denom string `json:"denom"` +} + +// SupplyResponse is the expected response to SupplyQuery +type SupplyResponse struct { + Amount Coin `json:"amount"` +} + type BalanceQuery struct { Address string `json:"address"` Denom string `json:"denom"` diff --git a/types/types.go b/types/types.go index 17d3b0cf..f67b566d 100644 --- a/types/types.go +++ b/types/types.go @@ -62,7 +62,9 @@ func (o OutOfGasError) Error() string { // This type is returned by VM.AnalyzeCode(). type AnalysisReport struct { HasIBCEntryPoints bool - RequiredFeatures string + // Deprecated, use RequiredCapabilities. For now both fields contain the same value. + RequiredFeatures string + RequiredCapabilities string } type Metrics struct {