Skip to content

Commit 2db8a95

Browse files
committed
Support Wasm compiled with Rust v1.70+
Starting from v1.70, Rust uses the Wasm sign extenstion opcodes when comipling to Wasm. Our Wasm parser for static analysis had to be updated in order to correctly parse these opcodes. Refs: - https://github.com/WebAssembly/sign-extension-ops/blob/master/proposals/sign-extension-ops/Overview.md - CosmWasm/cosmwasm#1727 - CosmWasm/cosmwasm#1743
1 parent de39a8c commit 2db8a95

File tree

20 files changed

+48
-48
lines changed

20 files changed

+48
-48
lines changed

β€Žcosmwasm/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.69
1+
1.71
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.69
1+
1.71
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.69
1+
1.71
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.69
1+
1.71

β€Žcosmwasm/enclaves/Cargo.lock

+11-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žcosmwasm/enclaves/execute/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ serde_json = { git = "https://github.com/mesalock-linux/serde-json-sgx" }
6969
ctor = "0.1.13"
7070
derive_more = "0.99"
7171
pwasm-utils = { version = "0.12.0", default-features = false }
72-
parity-wasm = { version = "0.41.0", default-features = false }
72+
parity-wasm = { version = "0.45.0", default-features = false, features = [
73+
"sign_ext"
74+
] }
7375
base64 = { rev = "dc7389e10817b078f289386b3b6a852ab6c4c021", git = "https://github.com/mesalock-linux/rust-base64-sgx" }
7476
# for attestation
7577
chrono = { git = "https://github.com/mesalock-linux/chrono-sgx" }

β€Žcosmwasm/enclaves/shared/contract-engine/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ derive_more = "0.99"
4949
sha2 = "0.8.1"
5050
bech32 = "0.7.2"
5151
pwasm-utils = { version = "0.12.0", default-features = false, optional = true }
52-
parity-wasm = { version = "0.41.0", default-features = false, optional = true }
52+
parity-wasm = { version = "0.45.0", default-features = false, optional = true, features = [
53+
"sign_ext"
54+
] }
5355
wasm3 = { git = "https://github.com/scrtlabs/wasm3-rs", rev = "ad1c868" }
5456
walrus = { version = "0.19.0", git = "https://github.com/scrtlabs/walrus", rev = "c5777d4" }
5557
lru = { version = "0.7", default-features = false }

β€Žcosmwasm/enclaves/test/Cargo.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žcosmwasm/packages/sgx-vm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ snafu = { version = "0.6.3" }
5353
sha2 = "0.10.7"
5454
hex = "0.4"
5555
memmap = "0.7"
56-
parity-wasm = "0.41"
56+
parity-wasm = { version = "0.45", features = ["sign_ext"] }
5757
# requirements specific to Secret Network
5858
lazy_static = "1.4"
5959
enclave-ffi-types = { path = "../../enclaves/ffi-types", features = [

β€Ždeployment/dockerfiles/base-images/secret-contract-optimizer.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.69.0-slim-bullseye
1+
FROM rust:1.71.0-slim-bullseye
22

33
RUN rustup target add wasm32-unknown-unknown
44
RUN apt update && apt install -y binaryen clang && rm -rf /var/lib/apt/lists/*

β€Žgo-cosmwasm/Cargo.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žscripts/install-wasm-tools.sh

+11-21
Original file line numberDiff line numberDiff line change
@@ -81,34 +81,24 @@ cargo install pwasm-utils-cli --bin wasm-prune --force
8181
if [[ "$OSTYPE" == "linux-gnu" ]]; then
8282
set -e
8383

84-
BUILD_NUM=`curl -s https://storage.googleapis.com/wasm-llvm/builds/linux/lkgr.json | jq -r '.build'`
85-
if [ -z ${BUILD_NUM+x} ]; then
86-
echo "Could not fetch the latest build number.";
87-
exit 1;
88-
fi
89-
9084
tmp=`mktemp -d`
9185
pushd $tmp > /dev/null
92-
echo "Downloading wasm-binaries.tbz2";
93-
curl -L -o wasm-binaries.tbz2 https://storage.googleapis.com/wasm-llvm/builds/linux/$BUILD_NUM/wasm-binaries.tbz2
86+
87+
echo "Downloading wabt-1.0.33-ubuntu.tar.gz";
88+
wget https://github.com/WebAssembly/wabt/releases/download/1.0.33/wabt-1.0.33-ubuntu.tar.gz
9489

95-
declare -a binaries=("wasm2wat" "wat2wasm") # Default binaries
96-
if [ "$#" -ne 0 ]; then
97-
echo "Installing selected binaries.";
98-
binaries=("$@");
99-
else
100-
echo "Installing default binaries.";
101-
fi
90+
tar --strip-components=2 -xf wabt-1.0.33-ubuntu.tar.gz wabt-1.0.33/bin/wasm2wat wabt-1.0.33/bin/wat2wasm
91+
92+
echo "Installing wasm2wat & wat2wasm into ~/.cargo/bin"
93+
cp -f wasm2wat ~/.cargo/bin/
94+
cp -f wat2wasm ~/.cargo/bin/
10295

103-
for bin in "${binaries[@]}"
104-
do
105-
echo "Installing $bin into ~/.cargo/bin"
106-
tar -xvjf wasm-binaries.tbz2 wasm-install/bin/$bin > /dev/null
107-
cp -f wasm-install/bin/$bin ~/.cargo/bin/
108-
done
10996
popd > /dev/null
11097
fi
11198

11299
echo ""
113100
echo "Run source ~/.cargo/env now to update environment."
114101
echo ""
102+
103+
source ~/.cargo/env
104+
wasm2wat --version
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
Β (0)