Skip to content

Commit

Permalink
Merge pull request #380 from CosmWasm/cosmwasm_1_2
Browse files Browse the repository at this point in the history
Upgrade to CosmWasm 1.2
  • Loading branch information
webmaster128 authored Jan 16, 2023
2 parents 8b50ef7 + 23b9b74 commit 1809ec5
Show file tree
Hide file tree
Showing 22 changed files with 662 additions and 76 deletions.
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

0 comments on commit 1809ec5

Please sign in to comment.