@@ -16,17 +16,22 @@ contract_with_floats.wasm: $(Rust_Crate_Source)
16
16
rm -f ./contract_with_floats.wasm
17
17
mv -f ./target/wasm32-unknown-unknown/release/test_contract.wasm ./contract_with_floats.wasm
18
18
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
+
19
24
# Create a wasm with more than 192 memory pages (fails in init, handle & query, this is our limit)
20
25
# https://github.com/scrtlabs/SecretNetwork/blob/9eef8591b2c04c586ceee12f424b92062598123e/cosmwasm/packages/wasmi-runtime/src/wasm/memory.rs#L39
21
26
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
24
29
25
30
# Create a wasm with more than 512 memory pages (fails in store, this is cosmwasm's limit)
26
31
# https://github.com/scrtlabs/SecretNetwork/blob/9eef8591b2c04c586ceee12f424b92062598123e/cosmwasm/packages/sgx-vm/src/compatability.rs#L36
27
32
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
30
35
31
36
setup :
32
37
apt-get install wabt
0 commit comments