CosmWasm / optimizer

Dockerfile and script to deterministically produce the smallest possible Wasm for your Rust contract
Apache License 2.0
118 stars 57 forks source link

Address caching issue with intermediate hashes #122

Closed mikedotexe closed 1 year ago

mikedotexe commented 1 year ago

I am using the rust optimizer version 12.13 I have a project that I accidentally named crate-task-handle-tick instead of create-…

I have removed Cargo.lock, the target directory, the artifacts directory, cargo update, cargo clean, deleted the rust-optimizer images from Docker, and still it optimizes outputting two binaries with crate_… and create_….

Here's the output toward the end of the optimization:

warning: the following packages contain code that will be rejected by a future version of Rust: nom v4.1.1
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
Creating intermediate hash for crate_task_handle_tick.wasm ...
189c23392a4944ea1bd30eaa7758b10839616d6cc08ff51151d9e3846276c6c5  ./target/wasm32-unknown-unknown/release/crate_task_handle_tick.wasm
Optimizing crate_task_handle_tick.wasm ...
Creating intermediate hash for create_task_handle_tick.wasm ...
2ed5aa0a69446e4c87bed21eb4798b529d3b7dbcf09d43ad79848d108a27c52e  ./target/wasm32-unknown-unknown/release/create_task_handle_tick.wasm
Optimizing create_task_handle_tick.wasm ...
Creating hashes ...
b7d2714c5c8df6b1c8974551b2255c775c4bd676e391d986d5ac1f62e562878b  crate_task_handle_tick.wasm
faade072a92dd4483f7dfcd5e053244334277dd341c5a96a568ea9a782c8c07c  create_task_handle_tick.wasm

I cannot find any reference to crate- or crate_ anywhere that would make sense, making me wonder if it's somehow caching information I'd like to purge, and I'm not sure how to proceed. Perhaps I can get help and then add this to the README in case others face it.

webmaster128 commented 1 year ago

There is a docker volume that serves as a cache between builds when you call it: --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target.

If you find and delete that volume, the artifact should be gone in the next build.

mikedotexe commented 1 year ago

Thank you! Much appreciated. Think I'll close this, and we can have this indexed on GitHub so others can discover it