From 2b6e2a8f8b57f4bc966ff8035ee92f3cc5b9c800 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Sat, 21 Sep 2024 11:03:08 +0200 Subject: [PATCH] build: ic-wasm --keep-name-section (#721) * build: ic-wasm --keep-name-section Signed-off-by: David Dal Busco * build: --keep-name-section in docker as well Signed-off-by: David Dal Busco --------- Signed-off-by: David Dal Busco --- docker/build | 9 +++++---- scripts/cargo.sh | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docker/build b/docker/build index 3829d4c9..451e21e9 100755 --- a/docker/build +++ b/docker/build @@ -141,21 +141,22 @@ function build_canister() { ic-wasm \ "$CARGO_TARGET_DIR/$TARGET/release/$canister.wasm" \ -o "./$canister.wasm" \ - shrink + shrink \ + --keep-name-section # adds the content of $canister.did to the `icp:public candid:service` custom section of the public metadata in the wasm - ic-wasm "$canister.wasm" -o "$canister.wasm" metadata candid:service -f "$SRC_DIR/$canister.did" -v public + ic-wasm "$canister.wasm" -o "$canister.wasm" metadata candid:service -f "$SRC_DIR/$canister.did" -v public --keep-name-section if [ "$canister" == "satellite" ] then # add the type of build "stock" to the satellite. This way, we can identify whether it's the standard canister ("stock") or a custom build ("extended") of the developer. - ic-wasm "$canister.wasm" -o "$canister.wasm" metadata juno:build -d "stock" -v public + ic-wasm "$canister.wasm" -o "$canister.wasm" metadata juno:build -d "stock" -v public --keep-name-section fi if [ "$canister" == "satellite" ] || [ "$canister" == "console" ]; then # indicate support for certificate version 1 and 2 in the canister metadata - ic-wasm "$canister.wasm" -o "$canister.wasm" metadata supported_certificate_versions -d "1,2" -v public + ic-wasm "$canister.wasm" -o "$canister.wasm" metadata supported_certificate_versions -d "1,2" -v public --keep-name-section fi gzip --no-name --force "./$canister.wasm" diff --git a/scripts/cargo.sh b/scripts/cargo.sh index a1dad3a2..ab1cf82b 100755 --- a/scripts/cargo.sh +++ b/scripts/cargo.sh @@ -42,21 +42,22 @@ candid-extractor "${RELEASE_DIR}/${WASM_MODULE}" > "${DID_DIR}/${WASM_MODULE}.di ic-wasm \ "${RELEASE_DIR}/${WASM_MODULE}" \ -o "${WASM_DIR}/${WASM_MODULE}" \ - shrink + shrink \ + --keep-name-section # adds the content of did to the `icp:public candid:service` custom section of the public metadata in the wasm -ic-wasm "${WASM_DIR}/${WASM_MODULE}" -o "${WASM_DIR}/${WASM_MODULE}" metadata candid:service -f "${DID_DIR}/${WASM_MODULE}.did" -v public +ic-wasm "${WASM_DIR}/${WASM_MODULE}" -o "${WASM_DIR}/${WASM_MODULE}" metadata candid:service -f "${DID_DIR}/${WASM_MODULE}.did" -v public --keep-name-section if [ "${WASM_MODULE}" == "satellite" ] then # add the type of build "stock" to the satellite. This way, we can identify whether it's the standard canister ("stock") or a custom build ("extended") of the developer. - ic-wasm "${WASM_DIR}/${WASM_MODULE}" -o "${WASM_DIR}/${WASM_MODULE}" metadata juno:build -d "stock" -v public + ic-wasm "${WASM_DIR}/${WASM_MODULE}" -o "${WASM_DIR}/${WASM_MODULE}" metadata juno:build -d "stock" -v public --keep-name-section fi if [ "${MODULE}" == "satellite" ] || [ "${MODULE}" == "console" ]; then # indicate support for certificate version 1 and 2 in the canister metadata - ic-wasm "${WASM_DIR}/${WASM_MODULE}" -o "${WASM_DIR}/${WASM_MODULE}" metadata supported_certificate_versions -d "1,2" -v public + ic-wasm "${WASM_DIR}/${WASM_MODULE}" -o "${WASM_DIR}/${WASM_MODULE}" metadata supported_certificate_versions -d "1,2" -v public --keep-name-section fi gzip -c --no-name --force "${WASM_DIR}/${WASM_MODULE}" > "${DEPLOY_DIR}/${WASM_MODULE}.tmp.gz"