Calling ic-wasm twice

I was wondering, what would happen if I inadvertently called ic-wasm with shrink or metadata (for the same metadata) twice. Would that result in a corrupted Wasm, or is the second call ignored?

For example, if I would run the following twice on the same input/output:

ic-wasm \
          "$my_dir/$canister.wasm" \
          -o "$my_dir/$canister.wasm" \
          shrink \
          --keep-name-section

ic-wasm "$my_dir/$canister.wasm" -o "$my_dir/$canister.wasm" metadata candid:service -f "$SRC_DIR/$canister.did" -v public --keep-name-section

ic-wasm "$my_dir/$canister.wasm" -o "$my_dir/$canister.wasm" metadata juno:build -d "$build_type" -v public --keep-name-section
  1. ic-wasm always produces valid Wasm modules, so corruption shouldn’t happen.
  2. The second call with shrink or metadata would essentially do nothing—the first call already processed the Wasm, so there’s no further change.
1 Like

Nice! :+1: Thanks for confirming!