Skip to content

Commit f91ad17

Browse files
Merge pull request #2 from poplexity/patch-1
Remove sign-extending instructions via wasm-opt
2 parents 518e010 + b3d454e commit f91ad17

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pysrc/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def build_contract(package_name, build_mode, target_dir, stack_size):
6666
sys.exit(-1)
6767

6868
if shutil.which('wasm-opt'):
69-
cmd = f'wasm-opt {target_dir}/wasm32-wasi/release/{package_name}.wasm -O3 --strip-debug -o {target_dir}/{package_name}.wasm'
69+
cmd = f'wasm-opt {target_dir}/wasm32-wasi/release/{package_name}.wasm --signext-lowering -O3 --strip-debug -o {target_dir}/{package_name}.wasm'
7070
cmd = shlex.split(cmd)
7171
ret_code = subprocess.call(cmd, stdout=sys.stdout, stderr=sys.stderr)
7272
if not ret_code == 0:
@@ -76,6 +76,7 @@ def build_contract(package_name, build_mode, target_dir, stack_size):
7676
print_warning('''
7777
wasm-opt not found! Make sure the binary is in your PATH environment.
7878
We use this tool to optimize the size of your contract's Wasm binary.
79+
It is also used to remove some instructions which are not supported in WASM 1.0
7980
wasm-opt is part of the binaryen package. You can find detailed
8081
installation instructions on https://github.com/WebAssembly/binaryen#tools.
8182
There are ready-to-install packages for many platforms:

0 commit comments

Comments
 (0)