Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: bump up cosmwasm/wasmvm v1.1.1 #84

Merged
merged 73 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
00fa4d9
support link against custom wasmvm library
yihuang Jun 1, 2022
c09fc14
Apply suggestions from code review
yihuang Jun 8, 2022
607cbdc
rename
yihuang Jun 8, 2022
3327ebf
Merge pull request #335 from yihuang/custom_wasmvm
webmaster128 Jun 8, 2022
1afba37
[skip ci] Built release libraries
Jun 8, 2022
ec3274d
add bank supply query
larry0x Jul 12, 2022
b2d3a38
Move api to internal
webmaster128 Aug 31, 2022
4b364ce
Move testdata to root
webmaster128 Aug 31, 2022
47a2376
Merge pull request #342 from CosmWasm/internalize-api
webmaster128 Aug 31, 2022
b212154
[skip ci] Built release libraries
Aug 31, 2022
4108109
Upgrade cargo-audit
webmaster128 Aug 31, 2022
12584c4
Merge pull request #343 from CosmWasm/upgrade-cargo-audit
webmaster128 Aug 31, 2022
e4b1c2d
Check bindings.h is up-to-date
webmaster128 Aug 31, 2022
bf1b75e
Fix company name
webmaster128 Aug 31, 2022
592f360
Update bindings.h
webmaster128 Aug 31, 2022
5388122
[skip ci] Built release libraries
Aug 31, 2022
5ab0263
Move comment to Makefile level
webmaster128 Aug 31, 2022
90d7215
Update internal/api/bindings.h
webmaster128 Aug 31, 2022
0ccdd05
Merge pull request #344 from CosmWasm/check-bindings.h
webmaster128 Aug 31, 2022
d014052
[skip ci] Built release libraries
Aug 31, 2022
61ba2f5
Add cyberpunk contract
webmaster128 Aug 31, 2022
aeaa39d
Test and fix Transaction serialization
webmaster128 Aug 31, 2022
ee6082b
Format code and cleanup
webmaster128 Aug 31, 2022
13d5a85
Add Transaction to MockEnv
webmaster128 Aug 31, 2022
86ea1d9
Update gas values
webmaster128 Aug 31, 2022
025da40
Merge pull request #345 from CosmWasm/test-env
webmaster128 Aug 31, 2022
ab30eb3
[skip ci] Built release libraries
Aug 31, 2022
b25e2dc
Upgrade cbindgen to 0.24.3
webmaster128 Sep 1, 2022
1cca815
Merge pull request #348 from CosmWasm/cbindgen-0.24.3
webmaster128 Sep 1, 2022
e5aa308
[skip ci] Built release libraries
Sep 1, 2022
ec4bd04
Merge pull request #337 from larry0x/larry/bank-total-supply-query
webmaster128 Sep 1, 2022
cabaacd
[skip ci] Built release libraries
Sep 1, 2022
7c5f991
Upgrade autocfg and zeroize
webmaster128 Sep 1, 2022
c43056a
Upgrade libc
webmaster128 Sep 1, 2022
3d00294
Upgrade cosmwasm to 1.1
webmaster128 Sep 1, 2022
3d725d9
Adjust memory size in tests
webmaster128 Sep 1, 2022
d9b07e2
Rename field to required_capabilities in AnalysisReport
webmaster128 Sep 1, 2022
2a3e9ad
Rename init_cache argument to available_capabilities
webmaster128 Sep 1, 2022
2a570db
Upgrade to 1.1.0
webmaster128 Sep 5, 2022
5193273
Merge pull request #347 from CosmWasm/upgrade-to-1.1
webmaster128 Sep 6, 2022
c0430b8
Upgrade Rust to 1.63.0
webmaster128 Sep 6, 2022
779605c
Add support for windows builds
webmaster128 Sep 6, 2022
1d3719f
Bump builders version
webmaster128 Sep 6, 2022
d4cfbcb
Bring back missing aarch64-apple-darwin target
webmaster128 Sep 6, 2022
df33037
Add release-build-windows
webmaster128 Sep 6, 2022
a5cf1a0
Move alpine tests out of build
webmaster128 Sep 6, 2022
73d66a7
Merge pull request #350 from CosmWasm/builders-13
webmaster128 Sep 6, 2022
9318547
[skip ci] Built release libraries
Sep 6, 2022
9d86527
Make GetMetrics result tests less strict
webmaster128 Sep 6, 2022
cedabc6
Refactor get_metrics test to be less strict
webmaster128 Sep 6, 2022
2857d72
Use edition 2021
webmaster128 Sep 6, 2022
90f8741
Merge pull request #351 from CosmWasm/make-memory-size-tests-less-strict
webmaster128 Sep 6, 2022
268afcc
[skip ci] Built release libraries
Sep 6, 2022
3c8c6f6
Bump libwasmvm version to 1.1.0
webmaster128 Sep 6, 2022
d182175
[skip ci] Built release libraries
Sep 6, 2022
1c01f7a
wasmvm: assert_approx_eq macro
uint Sep 6, 2022
c00dc5c
Refactor assert_approx_eq!
uint Sep 6, 2022
a2d0485
assert_approx_eq! - panic msgs closer to std
uint Sep 6, 2022
80eb9eb
cargo fmt
uint Sep 6, 2022
926d2ca
assert_approx_eq: require args to be of one type
uint Sep 7, 2022
22c1cd4
assert_approx_eq: test more types
uint Sep 7, 2022
c883151
assert_approx_eq: make sure arg order doesn't matter
uint Sep 7, 2022
c276a8e
test refactor
uint Sep 7, 2022
765b15e
assert_approx_eq! - use abs_diff
uint Sep 7, 2022
2308c68
Merge pull request #352 from CosmWasm/assert-approx-eq
webmaster128 Sep 7, 2022
10fdb6e
[skip ci] Built release libraries
Sep 7, 2022
e6e0309
Upgrade cosmwasm to 1.1.2
webmaster128 Sep 19, 2022
83e7ef2
Bump wasmvm version to 1.1.1
webmaster128 Sep 19, 2022
ce9b8d3
Merge pull request #354 from CosmWasm/wasmvm-1.1.1
webmaster128 Sep 19, 2022
3d79105
[skip ci] Built release libraries
Sep 19, 2022
1bfd53f
Merge branch 'cosmwasm/wasmvm_v1.1.1' into 'line/apply_v1.1.1'
zemyblue Dec 21, 2022
dc6a9af
fix: ci error
zemyblue Dec 21, 2022
a23c058
chore: update latest `line/cosmwasm` commit (merged https://github.co…
zemyblue Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 18 additions & 25 deletions .github/workflows/builds_and_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
55 changes: 34 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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!

Expand All @@ -68,42 +68,55 @@ 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)
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.
Expand All @@ -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
Binary file removed api/libwasmvm.aarch64.so
Binary file not shown.
Binary file removed api/libwasmvm.dylib
Binary file not shown.
Binary file removed api/libwasmvm.x86_64.so
Binary file not shown.
7 changes: 0 additions & 7 deletions api/link_glibclinux_x86_64.go

This file was deleted.

35 changes: 17 additions & 18 deletions builders/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion builders/Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 6 additions & 4 deletions builders/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 3 additions & 0 deletions builders/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions builders/guest/build_windows.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions builders/guest/cargo-config
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 4 additions & 2 deletions ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion api/api_test.go → internal/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading