Skip to content

Commit eadac6e

Browse files
committed
HW CI: Try to fix wasm2wat & wat2wasm usage: Vol. 3
1 parent 6024d24 commit eadac6e

File tree

1 file changed

+9
-4
lines changed
  • cosmwasm/contracts/v010/compute-tests/test-compute-contract

1 file changed

+9
-4
lines changed

cosmwasm/contracts/v010/compute-tests/test-compute-contract/Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,22 @@ contract_with_floats.wasm: $(Rust_Crate_Source)
1616
rm -f ./contract_with_floats.wasm
1717
mv -f ./target/wasm32-unknown-unknown/release/test_contract.wasm ./contract_with_floats.wasm
1818

19+
# Older versions of wabt had the --enable-sign-extension flag, while on newer
20+
# versions it's turned on by default and the flag is replaced with --disable-sign-extension
21+
WASM2WAT_OPTS := $(shell wasm2wat --help | grep -Po '\-\-enable-sign-extension')
22+
WAT2WAT_OPTS := $(shell wat2wasm --help | grep -Po '\-\-enable-sign-extension')
23+
1924
# Create a wasm with more than 192 memory pages (fails in init, handle & query, this is our limit)
2025
# https://github.com/scrtlabs/SecretNetwork/blob/9eef8591b2c04c586ceee12f424b92062598123e/cosmwasm/packages/wasmi-runtime/src/wasm/memory.rs#L39
2126
too-high-initial-memory.wasm: contract.wasm
22-
wasm2wat --enable-all ./contract.wasm | perl -pe 's/\(memory \(;0;\) \d+\)/(memory (;0;) 193)/' > /tmp/too-high-initial-memory.wat
23-
wat2wasm --enable-all /tmp/too-high-initial-memory.wat -o ./too-high-initial-memory.wasm
27+
wasm2wat $(WASM2WAT_OPTS) ./contract.wasm | perl -pe 's/\(memory \(;0;\) \d+\)/(memory (;0;) 193)/' > /tmp/too-high-initial-memory.wat
28+
wat2wasm $(WAT2WAT_OPTS) /tmp/too-high-initial-memory.wat -o ./too-high-initial-memory.wasm
2429

2530
# Create a wasm with more than 512 memory pages (fails in store, this is cosmwasm's limit)
2631
# https://github.com/scrtlabs/SecretNetwork/blob/9eef8591b2c04c586ceee12f424b92062598123e/cosmwasm/packages/sgx-vm/src/compatability.rs#L36
2732
static-too-high-initial-memory.wasm: contract.wasm
28-
wasm2wat --enable-all ./contract.wasm | perl -pe 's/\(memory \(;0;\) \d+\)/(memory (;0;) 513)/' > /tmp/static-too-high-initial-memory.wat
29-
wat2wasm --enable-all /tmp/static-too-high-initial-memory.wat -o ./static-too-high-initial-memory.wasm
33+
wasm2wat $(WASM2WAT_OPTS) ./contract.wasm | perl -pe 's/\(memory \(;0;\) \d+\)/(memory (;0;) 513)/' > /tmp/static-too-high-initial-memory.wat
34+
wat2wasm $(WAT2WAT_OPTS) /tmp/static-too-high-initial-memory.wat -o ./static-too-high-initial-memory.wasm
3035

3136
setup:
3237
apt-get install wabt

0 commit comments

Comments
 (0)