diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 449eb77..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,237 +0,0 @@ -version: 2.1 - -jobs: - # All checks on the codebase that can run in parallel to build_shared_library - sanity: - docker: - - image: circleci/rust:1.50.0-buster - steps: - - checkout - - run: - name: Install shellcheck - command: sudo apt install shellcheck - - run: - name: Show version information - command: rustc --version; cargo --version; rustup --version - - run: - name: Add Rust components - command: rustup component add clippy rustfmt - - restore_cache: - keys: - - cargocache-v2-sanity-rust:1.50.0-{{ checksum "Cargo.lock" }} - - run: - name: Check formatting - command: cargo fmt -- --check - - run: - name: Run linter - command: cargo clippy -- -D warnings - - run: - name: Run unit tests - command: cargo test - - run: - name: Build docs - command: cargo doc --no-deps - - run: - name: Test docs - command: | - sed -i '/^crate-type = \["cdylib"\]/d' Cargo.toml - cargo test --doc - - run: - name: Run shellcheck - command: find . -name "*.sh" -exec shellcheck {} + - - save_cache: - paths: - - /usr/local/cargo/registry - - target/debug/.fingerprint - - target/debug/build - - target/debug/deps - - target/release/.fingerprint - - target/release/build - - target/release/deps - key: cargocache-v2-sanity-rust:1.50.0-{{ checksum "Cargo.lock" }} - - build_shared_library: - docker: - - image: circleci/rust:1.50.0-buster - steps: - - checkout - - run: - name: Show version information - command: rustc --version; cargo --version; rustup --version - - restore_cache: - keys: - - cargocache-v2-build_shared_library-rust:1.50.0-{{ checksum "Cargo.lock" }} - - run: - name: Create release build of libwasmvm - command: make build-rust - - persist_to_workspace: - root: ./api - paths: - - libwasmvm.so - - save_cache: - paths: - - /usr/local/cargo/registry - - target/debug/.fingerprint - - target/debug/build - - target/debug/deps - - target/release/.fingerprint - - target/release/build - - target/release/deps - key: cargocache-v2-build_shared_library-rust:1.50.0-{{ checksum "Cargo.lock" }} - - test: - working_directory: /go/src/github.com/CosmWasm/wasmvm - docker: - - image: circleci/golang:1.15 - environment: - GORACE: "halt_on_error=1" - BUILD_VERSION: $(echo ${CIRCLE_SHA1} | cut -c 1-10) - steps: - - checkout - - attach_workspace: - at: /tmp/builds - - run: cp /tmp/builds/libwasmvm.so ./api - - run: - name: Go integration tests - command: make test - - run: - name: Go tests with cgo and race condition safety checks - command: make test-safety - - run: make build-go - - test_alpine_build: - machine: - image: ubuntu-1604:202010-01 - steps: - - checkout - - run: make test-alpine - - run: - name: Debug build results - command: ls -l ./api - - deploy_to_git: - machine: - image: ubuntu-1604:202010-01 - steps: - - add_ssh_keys: - fingerprints: - # Custom read/write deployment key with private key stored on CircleCI - # (see https://app.circleci.com/settings/project/github/CosmWasm/wasmvm/ssh and https://github.com/CosmWasm/wasmvm/settings/keys) - - "31:de:e5:84:1b:12:81:94:aa:06:50:c0:cb:bd:79:f0" - - checkout - - run: - name: Build shared library for Linux - command: make release-build-linux - - run: - name: Build shared library for macOS - command: make release-build-macos - - run: - name: Debug build results - command: ls -l ./api - - run: - name: Configure git user - # This is not a GitHub user and no permissions can be configured other than "push access", which - # we can configure for Deploy keys at https://github.com/CosmWasm/wasmvm/settings/keys - command: | - git config user.email "wasmvm@circleci.confio.example.com" - git config user.name "Deployer" - - run: - name: Check-in and push new libraries - command: | - git status - git add ./api - git commit --allow-empty -m '[skip ci] Built release libraries' - git push origin $CIRCLE_BRANCH - - build_static_lib: - machine: - image: ubuntu-1604:202010-01 - steps: - - checkout - - run: - name: Build static library for Alpine - command: make release-build-alpine - - run: - name: Debug build results - command: ls -l ./api - - run: - name: Collect artifacts - command: | - mkdir artifacts - cp ./api/libwasmvm_muslc.a artifacts - - run: - name: Create checksums - working_directory: artifacts - command: sha256sum * > checksums.txt && cat checksums.txt - - store_artifacts: - path: artifacts - # Deploy to GitHub releases on tag builds - - when: - condition: << pipeline.git.tag >> - steps: - - run: - name: Install ghr - command: | - go get github.com/tcnksm/ghr - ghr --version - - run: - name: Publish artifacts on GitHub - command: | - TAG="$CIRCLE_TAG" - TITLE="$TAG" - BODY="Build artifacts generated at this tag." - ghr -t "$GITHUB_TOKEN" \ - -u "$CIRCLE_PROJECT_USERNAME" -r "$CIRCLE_PROJECT_REPONAME" \ - -c "$CIRCLE_SHA1" \ - -n "$TITLE" -b "$BODY" \ - -delete \ - "$TAG" ./artifacts/ - -workflows: - version: 2 - build_and_test: - jobs: - - sanity - - build_shared_library: - filters: # required since other jobs with tag filters require this one - tags: - only: /.*/ - - test: - requires: - - build_shared_library - - build_static_lib: - requires: - - build_shared_library - filters: - # tags and branches are OR combined - tags: - only: /^v[0-9]+\.[0-9]+\.[0-9]+.*/ - branches: - only: - # long living branches - - main - - 0.14-dev - # This is long running, so only double-check on merge commits - # ensures that all code works on alpine linux - - test_alpine_build: - filters: - tags: - ignore: - - /.*/ - branches: - only: - # long living branches - - main - - 0.14-dev - # Run only on main, not on tags (auto-build on merge PR) - - deploy_to_git: - requires: - - sanity - - test - filters: - tags: - ignore: - - /.*/ - branches: - only: - - main diff --git a/README.md b/README.md index 3414d8f..40f883f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # wasmvm +[![Tests](https://github.com/line/wasmvm/actions/workflows/tests.yml/badge.svg)](https://github.com/line/wasmvm/actions/workflows/tests.yml) + This repository is forked from [CosmWasm/wasmvm](https://github.com/CosmWasm/wasmvm) + This is a wrapper around the [CosmWasm VM](https://github.com/line/cosmwasm/tree/master/packages/vm). + It allows you to compile, initialize and execute CosmWasm smart contracts from Go applications, in particular from [x/wasm](https://github.com/line/lbm-sdk/tree/v2/develop/x/wasm). diff --git a/api/lib_test.go b/api/lib_test.go index 9cbcbc3..fed0227 100644 --- a/api/lib_test.go +++ b/api/lib_test.go @@ -770,7 +770,7 @@ func TestCustomReflectQuerier(t *testing.T) { type QueryMsg struct { Capitalized *CapitalizedQuery `json:"capitalized,omitempty"` // There are more queries but we don't use them yet - // https://github.com/CosmWasm/cosmwasm/blob/v0.11.0-alpha3/contracts/reflect/src/msg.rs#L18-L28 + // https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/contracts/reflect/src/msg.rs#L38-L57 } type CapitalizedResponse struct { diff --git a/api/testdata/README.md b/api/testdata/README.md index 33ab6dc..fa342e0 100644 --- a/api/testdata/README.md +++ b/api/testdata/README.md @@ -1,3 +1,3 @@ Current contracts manually generated from commit `v0.14.0-beta1` -of https://github.com/CosmWasm/cosmwasm. Using -[these instructions](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/contracts/README.md#optimized-builds). +of https://github.com/line/cosmwasm. Using +[these instructions](https://github.com/line/cosmwasm/tree/v0.14.0-0.3.0/contracts/README.md#optimized-builds). diff --git a/api/testdata/download_releases.sh b/api/testdata/download_releases.sh index edab737..224cc7a 100755 --- a/api/testdata/download_releases.sh +++ b/api/testdata/download_releases.sh @@ -10,7 +10,7 @@ fi tag="$1" for contract in hackatom queue reflect ibc_reflect ; do - url="https://github.com/CosmWasm/cosmwasm/releases/download/$tag/$contract.wasm" + url="https://github.com/line/cosmwasm/releases/download/$tag/$contract.wasm" echo "Downloading $url ..." wget -O "$contract.wasm" "$url" done diff --git a/builders/README.md b/builders/README.md index ad1abfb..b633ccf 100644 --- a/builders/README.md +++ b/builders/README.md @@ -12,44 +12,4 @@ contains build scripts and a Docker image to create all dynamic libraries from o host. In general this is set up for a Linux host, but any machine that can run Docker can do the cross-compilation. -## Changelog - -**Version 0005:** - -- Update Rust to 1.50.0. - -**Version 0004:** - -- Update Rust to 1.49.0. -- Alpine: Update Go to 1.15 - -**Version 0003:** - -- Avoid pre-fetching of dependences to decouple builders from source code. -- Bump `OSX_VERSION_MIN` to 10.10. -- Use `rust:1.47.0-buster` as base image for cross compilation to macOS - -**Version 0002:** - -- Update hardcoded library name from `libgo_cosmwasm` to `libwasmvm`. - -**Version 0001:** - -- First release of builders that is versioned separately of CosmWasm. -- Update Rust to nightly-2020-10-24. - -## Usage - -Create a local docker image, capable of cross-compling linux and macos dynamic libs: - -```sh -(cd builders && make docker-images) -``` - -Then in the repo root, `make release-build` will use the above docker image and -copy the generated `{so,dylib}` files into `api` directory to be linked. - -## Future Work - -* Add support for cross-compiling to Windows as well. -* Publish docker images when they are stable +For more information visit [here](https://github.com/CosmWasm/wasmvm/tree/main/builders#readme). diff --git a/ibc_test.go b/ibc_test.go index 6a63be6..07a2ddd 100644 --- a/ibc_test.go +++ b/ibc_test.go @@ -30,19 +30,19 @@ func TestIBC(t *testing.T) { } // IBCInstantiateMsg is the Go version of -// https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/contracts/ibc-reflect/src/msg.rs#L9-L11 +// https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/contracts/ibc-reflect/src/msg.rs#L9-L11 type IBCInstantiateMsg struct { ReflectCodeID uint64 `json:"reflect_code_id"` } // IBCExecuteMsg is the Go version of -// https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/contracts/ibc-reflect/src/msg.rs#L15 +// https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/contracts/ibc-reflect/src/msg.rs#L15 type IBCExecuteMsg struct { InitCallback InitCallback `json:"init_callback"` } // InitCallback is the Go version of -// https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/contracts/ibc-reflect/src/msg.rs#L17-L22 +// https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/contracts/ibc-reflect/src/msg.rs#L17-L22 type InitCallback struct { ID string `json:"id"` ContractAddr string `json:"contract_addr"` diff --git a/types/ibc.go b/types/ibc.go index f7104b4..90c9447 100644 --- a/types/ibc.go +++ b/types/ibc.go @@ -81,7 +81,7 @@ type IBCBasicResult struct { } // IBCBasicResponse defines the return value on a successful processing. -// This is the counterpart of [IbcBasicResponse](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L194-L216). +// This is the counterpart of [IbcBasicResponse](https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/packages/std/src/ibc.rs#L194-L216). type IBCBasicResponse struct { // Submessages are like Messages, but they guarantee a reply to the calling contract // after their execution, and return both success and error rather than auto-failing on error @@ -109,7 +109,7 @@ type IBCReceiveResult struct { // Where the Acknowledgement bytes contain an encoded error message to be returned to // the calling chain. (Returning IBCReceiveResult::Err will abort processing of this packet // and not inform the calling chain). -// This is the counterpart of (IbcReceiveResponse)(https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L231-L254). +// This is the counterpart of (IbcReceiveResponse)(https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/packages/std/src/ibc.rs#L231-L254). type IBCReceiveResponse struct { // binary encoded data to be returned to calling chain as the acknowledgement Acknowledgement []byte `json:"acknowledgement"` diff --git a/types/msg.go b/types/msg.go index 1098bcb..136afbd 100644 --- a/types/msg.go +++ b/types/msg.go @@ -14,7 +14,7 @@ type ContractResult struct { } // Response defines the return value on a successful instantiate/execute/migrate. -// This is the counterpart of [Response](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/results/response.rs#L73-L88) +// This is the counterpart of [Response](https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/packages/std/src/results/response.rs#L73-L88) type Response struct { // Submessages are like Messages, but they guarantee a reply to the calling contract // after their execution, and return both success and error rather than auto-failing on error diff --git a/types/queries.go b/types/queries.go index ea95eca..1b867c8 100644 --- a/types/queries.go +++ b/types/queries.go @@ -114,7 +114,7 @@ type AllBalancesResponse struct { } // IBCQuery defines a query request from the contract into the chain. -// This is the counterpart of [IbcQuery](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L61-L83). +// This is the counterpart of [IbcQuery](https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/packages/std/src/ibc.rs#L61-L83). type IBCQuery struct { PortID *PortIDQuery `json:"port_id,omitempty"` ListChannels *ListChannelsQuery `json:"list_channels,omitempty"` @@ -130,7 +130,7 @@ type PortIDResponse struct { // ListChannelsQuery is an IBCQuery that lists all channels that are bound to a given port. // If `PortID` is unset, this list all channels bound to the contract's port. // Returns a `ListChannelsResponse`. -// This is the counterpart of [IbcQuery::ListChannels](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L70-L73). +// This is the counterpart of [IbcQuery::ListChannels](https://github.com/line/cosmwasm/blob/v0.14.0-0.3.0/packages/std/src/ibc.rs#L70-L73). type ListChannelsQuery struct { // optional argument PortID string `json:"port_id,omitempty"`