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

Upgrade to CosmWasm 1.2 #380

Merged
merged 15 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 42 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: 2.1

orbs:
win: circleci/[email protected]

jobs:
# All checks on the codebase that can run in parallel to build_shared_library
libwasmvm_sanity:
Expand Down Expand Up @@ -65,6 +68,44 @@ jobs:
- libwasmvm/target/release/deps
key: cargocache-v3-libwasmvm_sanity-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}

# This performs all the Rust debug builds on Windows. Similar to libwasmvm_sanity
# but avoids duplicating things that are not platform dependent.
libwasmvm_sanity_windows:
executor:
name: win/default
shell: bash.exe
steps:
- checkout
- run:
name: Reset git config set by CircleCI to make Cargo work
command: git config --global --unset url.ssh://[email protected]
- run:
name: Install Rust
command: |
set -o errexit
curl -sS --output rustup-init.exe https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
./rustup-init.exe --no-modify-path --profile minimal --default-toolchain 1.60.0 -y
echo 'export PATH="$PATH;$USERPROFILE/.cargo/bin"' >> "$BASH_ENV"
- run:
name: Show Rust version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cachev4-libwasmvm_sanity_windows-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}
- cachev4-libwasmvm_sanity_windows-rust:1.60.0-
- run:
name: Run unit tests
working_directory: libwasmvm
command: cargo test
- save_cache:
paths:
# ".." is the easiest way to get $HOME here (pwd is $HOME\project)
- ../.cargo/registry
- libwasmvm/target/debug/.fingerprint
- libwasmvm/target/debug/build
- libwasmvm/target/debug/deps
key: cachev4-libwasmvm_sanity_windows-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}

libwasmvm_audit:
docker:
# The audit tool might use a more modern Rust version than the build jobs. See
Expand Down Expand Up @@ -327,6 +368,7 @@ workflows:
build_and_test:
jobs:
- libwasmvm_sanity
- libwasmvm_sanity_windows
- libwasmvm_audit
- format-go
- wasmvm_no_cgo
Expand Down
4 changes: 4 additions & 0 deletions internal/api/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ struct UnmanagedVector save_wasm(struct cache_t *cache,
struct ByteSliceView wasm,
struct UnmanagedVector *error_msg);

void remove_wasm(struct cache_t *cache,
struct ByteSliceView checksum,
struct UnmanagedVector *error_msg);

struct UnmanagedVector load_wasm(struct cache_t *cache,
struct ByteSliceView checksum,
struct UnmanagedVector *error_msg);
Expand Down
11 changes: 11 additions & 0 deletions internal/api/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ func StoreCode(cache Cache, wasm []byte) ([]byte, error) {
return copyAndDestroyUnmanagedVector(checksum), nil
}

func RemoveCode(cache Cache, checksum []byte) error {
cs := makeView(checksum)
defer runtime.KeepAlive(checksum)
errmsg := newUnmanagedVector(nil)
_, err := C.remove_wasm(cache.ptr, cs, &errmsg)
if err != nil {
return errorWithMessage(err, errmsg)
}
return nil
}

func GetCode(cache Cache, checksum []byte) ([]byte, error) {
cs := makeView(checksum)
defer runtime.KeepAlive(checksum)
Expand Down
Loading