Closed luca992 closed 1 year ago
Hi @luca992, thanks for this! Can you provide an example of how to run this with multiple contracts?
Hi @luca992, thanks for this! Can you provide an example of how to run this with multiple contracts?
Yeah, I pushed it to dockerhub and for example https://github.com/eqoty-labs/snip721-migratable in the Makefile
It's the same command as normal. It also works for single contract repos.
.PHONY: compile-optimized-reproducible
compile-optimized-reproducible:
docker run --rm -v "$$(pwd)":/contract \
--mount type=volume,source="$$(basename "$$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
mr7uca/secret-contract-optimizer:0.0.1
PS. I didn't really realize that rust-optimize should also work and it's actively maintained. However, I found it doesn't work with any contract that uses secret-toolkit-crypto
due to this issue with secp256k1-sys
... and looks like they won't fix it
Currently the
secret-contract-optimizer
only supports a single contract, not multiple contracts in a workspace. This updates the script in the Dockerfile to copy all built wasm files to a folder in the root of the project calledoptimized-wasm
(naming up for debate). It then loops through them and runswasm-opt
each copied wasm. Then finally gzips them all and deletes them.Also, I updated rust to 1.69.0... rust 1.70.0 is not working