Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secret-contract-optimizer: support multiple contracts #1471

Merged
merged 3 commits into from
Jul 4, 2023

Conversation

luca992
Copy link
Contributor

@luca992 luca992 commented Jun 29, 2023

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 called optimized-wasm (naming up for debate). It then loops through them and runs wasm-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

@assafmo
Copy link
Member

assafmo commented Jun 29, 2023

Hi @luca992, thanks for this! Can you provide an example of how to run this with multiple contracts?

@luca992
Copy link
Contributor Author

luca992 commented Jun 29, 2023

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

@assafmo assafmo merged commit 6d61b3c into scrtlabs:master Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants