-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace ic-cdk-optimizer with ic-wasm-shrink (#2868)
# Motivation `ic-cdk-optimizer` has been deprecated for a long time. However, as the replacement did not support our use cases we could not migrate to the proposed replacement tools. Now two things encourage the migration: * There is now a drop-in replacement in the form of `ic-wasm shrink` * We cannot make some changes to the Rust code, because `ic-cdk-optimizer` does not support the corresponding opcodes. # Changes * Replace `ic-cdk-optimizer` with `ic-wasm shrink` # Tests * CI should check correctness. # Todos - [x] Add entry to changelog (if necessary). - [x] The wasm size needs to be compared before and after this change. --------- Co-authored-by: Max Murphy-Skvorzov <[email protected]>
- Loading branch information
Showing
6 changed files
with
13 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ RUN apt -yq update && \ | |
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* | ||
|
||
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/181b5293e73cfe16f7a79c5b3a4339bd522d31f3/install-from-binstall-release.sh | bash && cargo binstall -V | ||
RUN cargo binstall --no-confirm --version 0.3.2 ic-cdk-optimizer | ||
# Note: The version should match dfx.json, however it is expected that the old e2e tests, including this file, will be deleted soon so there is no point in adding the code to get the version. | ||
RUN cargo binstall --no-confirm "[email protected]" | ||
|
||
ARG IC_COMMIT | ||
|
||
|
@@ -35,20 +36,20 @@ WORKDIR /ic/rs | |
RUN binary="governance-canister" && \ | ||
features="test" && \ | ||
cargo build --target wasm32-unknown-unknown --profile canister-release --bin "$binary" --features "$features" && \ | ||
ic-cdk-optimizer -o "$CARGO_TARGET_DIR/${binary}_${features}.wasm" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/canister-release/${binary}.wasm" | ||
ic-wasm -o "$CARGO_TARGET_DIR/${binary}_${features}.wasm" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/canister-release/${binary}.wasm" shrink | ||
|
||
## Note: This is available as a download however we patch the source code to make testing easier. | ||
RUN binary=cycles-minting-canister && \ | ||
cargo build --target wasm32-unknown-unknown --profile canister-release --bin "$binary" && \ | ||
ic-cdk-optimizer -o "$CARGO_TARGET_DIR/${binary}.wasm" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/canister-release/${binary}.wasm" | ||
ic-wasm -o "$CARGO_TARGET_DIR/${binary}.wasm" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/canister-release/${binary}.wasm" shrink | ||
|
||
RUN binary=sns-swap-canister && \ | ||
cargo build --target wasm32-unknown-unknown --profile canister-release --bin "$binary" && \ | ||
ic-cdk-optimizer -o "$CARGO_TARGET_DIR/${binary}.wasm" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/canister-release/${binary}.wasm" | ||
ic-wasm -o "$CARGO_TARGET_DIR/${binary}.wasm" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/canister-release/${binary}.wasm" shrink | ||
|
||
RUN binary=sns-wasm-canister && \ | ||
cargo build --target wasm32-unknown-unknown --profile canister-release --bin "$binary" && \ | ||
ic-cdk-optimizer -o "$CARGO_TARGET_DIR/${binary}.wasm" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/canister-release/${binary}.wasm" | ||
ic-wasm -o "$CARGO_TARGET_DIR/${binary}.wasm" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/canister-release/${binary}.wasm" shrink | ||
|
||
FROM scratch AS scratch | ||
COPY --from=builder /ic/rs/nns/governance/canister/governance.did /governance.did | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters