Skip to content

Commit

Permalink
Support Wasm compiled with Rust v1.70+
Browse files Browse the repository at this point in the history
Starting from v1.70, Rust uses the Wasm sign extension opcodes when compiling to Wasm. Our Wasm parser for static analysis had to be updated in order to correctly parse these opcodes.

Refs:
- CosmWasm/cosmwasm#1727
- CosmWasm/cosmwasm#1743
- https://github.com/WebAssembly/sign-extension-ops/blob/master/proposals/sign-extension-ops/Overview.md
  • Loading branch information
assafmo committed Aug 6, 2023
1 parent de39a8c commit 5b54a0c
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 27 deletions.
4 changes: 2 additions & 2 deletions cosmwasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.69
1.71
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.69
1.71
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.69
1.71
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.69
1.71
16 changes: 11 additions & 5 deletions cosmwasm/enclaves/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion cosmwasm/enclaves/execute/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ serde_json = { git = "https://github.com/mesalock-linux/serde-json-sgx" }
ctor = "0.1.13"
derive_more = "0.99"
pwasm-utils = { version = "0.12.0", default-features = false }
parity-wasm = { version = "0.41.0", default-features = false }
parity-wasm = { version = "0.45.0", default-features = false, features = [
"sign_ext"
] }
base64 = { rev = "dc7389e10817b078f289386b3b6a852ab6c4c021", git = "https://github.com/mesalock-linux/rust-base64-sgx" }
# for attestation
chrono = { git = "https://github.com/mesalock-linux/chrono-sgx" }
Expand Down
4 changes: 3 additions & 1 deletion cosmwasm/enclaves/shared/contract-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ derive_more = "0.99"
sha2 = "0.8.1"
bech32 = "0.7.2"
pwasm-utils = { version = "0.12.0", default-features = false, optional = true }
parity-wasm = { version = "0.41.0", default-features = false, optional = true }
parity-wasm = { version = "0.45.0", default-features = false, optional = true, features = [
"sign_ext"
] }
wasm3 = { git = "https://github.com/scrtlabs/wasm3-rs", rev = "ad1c868" }
walrus = { version = "0.19.0", git = "https://github.com/scrtlabs/walrus", rev = "c5777d4" }
lru = { version = "0.7", default-features = false }
Expand Down
12 changes: 6 additions & 6 deletions cosmwasm/enclaves/test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cosmwasm/packages/sgx-vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ snafu = { version = "0.6.3" }
sha2 = "0.10.7"
hex = "0.4"
memmap = "0.7"
parity-wasm = "0.41"
parity-wasm = { version = "0.45", features = ["sign_ext"] }
# requirements specific to Secret Network
lazy_static = "1.4"
enclave-ffi-types = { path = "../../enclaves/ffi-types", features = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.69.0-slim-bullseye
FROM rust:1.71.0-slim-bullseye

RUN rustup target add wasm32-unknown-unknown
RUN apt update && apt install -y binaryen clang && rm -rf /var/lib/apt/lists/*
Expand Down
12 changes: 6 additions & 6 deletions go-cosmwasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified x/compute/internal/keeper/testdata/contract.wasm
Binary file not shown.
Binary file modified x/compute/internal/keeper/testdata/contract_with_floats.wasm
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified x/compute/internal/keeper/testdata/v1-contract-v2.wasm
Binary file not shown.
Binary file modified x/compute/internal/keeper/testdata/v1-contract.wasm
Binary file not shown.
Binary file modified x/compute/internal/keeper/testdata/v1_random_test.wasm
Binary file not shown.

0 comments on commit 5b54a0c

Please sign in to comment.