Skip to content

Commit 1809ec5

Browse files
authored
Merge pull request #380 from CosmWasm/cosmwasm_1_2
Upgrade to CosmWasm 1.2
2 parents 8b50ef7 + 23b9b74 commit 1809ec5

22 files changed

+662
-76
lines changed

.circleci/config.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
version: 2.1
22

3+
orbs:
4+
win: circleci/[email protected]
5+
36
jobs:
47
# All checks on the codebase that can run in parallel to build_shared_library
58
libwasmvm_sanity:
@@ -65,6 +68,44 @@ jobs:
6568
- libwasmvm/target/release/deps
6669
key: cargocache-v3-libwasmvm_sanity-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}
6770

71+
# This performs all the Rust debug builds on Windows. Similar to libwasmvm_sanity
72+
# but avoids duplicating things that are not platform dependent.
73+
libwasmvm_sanity_windows:
74+
executor:
75+
name: win/default
76+
shell: bash.exe
77+
steps:
78+
- checkout
79+
- run:
80+
name: Reset git config set by CircleCI to make Cargo work
81+
command: git config --global --unset url.ssh://[email protected]
82+
- run:
83+
name: Install Rust
84+
command: |
85+
set -o errexit
86+
curl -sS --output rustup-init.exe https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
87+
./rustup-init.exe --no-modify-path --profile minimal --default-toolchain 1.60.0 -y
88+
echo 'export PATH="$PATH;$USERPROFILE/.cargo/bin"' >> "$BASH_ENV"
89+
- run:
90+
name: Show Rust version information
91+
command: rustc --version; cargo --version; rustup --version
92+
- restore_cache:
93+
keys:
94+
- cachev4-libwasmvm_sanity_windows-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}
95+
- cachev4-libwasmvm_sanity_windows-rust:1.60.0-
96+
- run:
97+
name: Run unit tests
98+
working_directory: libwasmvm
99+
command: cargo test
100+
- save_cache:
101+
paths:
102+
# ".." is the easiest way to get $HOME here (pwd is $HOME\project)
103+
- ../.cargo/registry
104+
- libwasmvm/target/debug/.fingerprint
105+
- libwasmvm/target/debug/build
106+
- libwasmvm/target/debug/deps
107+
key: cachev4-libwasmvm_sanity_windows-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}
108+
68109
libwasmvm_audit:
69110
docker:
70111
# The audit tool might use a more modern Rust version than the build jobs. See
@@ -327,6 +368,7 @@ workflows:
327368
build_and_test:
328369
jobs:
329370
- libwasmvm_sanity
371+
- libwasmvm_sanity_windows
330372
- libwasmvm_audit
331373
- format-go
332374
- wasmvm_no_cgo

internal/api/bindings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ struct UnmanagedVector save_wasm(struct cache_t *cache,
313313
struct ByteSliceView wasm,
314314
struct UnmanagedVector *error_msg);
315315

316+
void remove_wasm(struct cache_t *cache,
317+
struct ByteSliceView checksum,
318+
struct UnmanagedVector *error_msg);
319+
316320
struct UnmanagedVector load_wasm(struct cache_t *cache,
317321
struct ByteSliceView checksum,
318322
struct UnmanagedVector *error_msg);

internal/api/lib.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ func StoreCode(cache Cache, wasm []byte) ([]byte, error) {
6767
return copyAndDestroyUnmanagedVector(checksum), nil
6868
}
6969

70+
func RemoveCode(cache Cache, checksum []byte) error {
71+
cs := makeView(checksum)
72+
defer runtime.KeepAlive(checksum)
73+
errmsg := newUnmanagedVector(nil)
74+
_, err := C.remove_wasm(cache.ptr, cs, &errmsg)
75+
if err != nil {
76+
return errorWithMessage(err, errmsg)
77+
}
78+
return nil
79+
}
80+
7081
func GetCode(cache Cache, checksum []byte) ([]byte, error) {
7182
cs := makeView(checksum)
7283
defer runtime.KeepAlive(checksum)

0 commit comments

Comments
 (0)