From 44c1f9e6a9876aabedb8e826d46d1fc950245675 Mon Sep 17 00:00:00 2001 From: Leopold Schabel Date: Fri, 18 Feb 2022 12:48:10 +0100 Subject: [PATCH] solana: compile wasm and contracts with --locked (#874) --- Dockerfile.client | 4 ++-- solana/Dockerfile | 12 ++++++------ solana/Dockerfile.wasm | 22 ++++++++++++---------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Dockerfile.client b/Dockerfile.client index e903ec66d..b9c5d4df9 100644 --- a/Dockerfile.client +++ b/Dockerfile.client @@ -43,7 +43,7 @@ RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=bridge/target \ --mount=type=cache,target=modules/token_bridge/target \ set -xe && \ - cargo build --manifest-path ./bridge/Cargo.toml --package client --release && \ - cargo build --manifest-path ./modules/token_bridge/Cargo.toml --package client --release && \ + cargo build --manifest-path ./bridge/Cargo.toml --package client --release --locked && \ + cargo build --manifest-path ./modules/token_bridge/Cargo.toml --package client --release --locked && \ cp bridge/target/release/client /usr/local/bin && \ cp modules/token_bridge/target/release/client /usr/local/bin/token-bridge-client diff --git a/solana/Dockerfile b/solana/Dockerfile index f7b5c1ebd..b1ae16704 100644 --- a/solana/Dockerfile +++ b/solana/Dockerfile @@ -49,12 +49,12 @@ RUN --mount=type=cache,target=bridge/target \ --mount=type=cache,target=modules/nft_bridge/target \ --mount=type=cache,target=pyth2wormhole/target \ --mount=type=cache,target=migration/target \ - cargo build-bpf --manifest-path "bridge/program/Cargo.toml" && \ - cargo build-bpf --manifest-path "bridge/cpi_poster/Cargo.toml" && \ - cargo build-bpf --manifest-path "modules/token_bridge/program/Cargo.toml" && \ - cargo build-bpf --manifest-path "pyth2wormhole/program/Cargo.toml" && \ - cargo build-bpf --manifest-path "modules/nft_bridge/program/Cargo.toml" && \ - cargo build-bpf --manifest-path "migration/Cargo.toml" && \ + cargo build-bpf --manifest-path "bridge/program/Cargo.toml" -- --locked && \ + cargo build-bpf --manifest-path "bridge/cpi_poster/Cargo.toml" -- --locked && \ + cargo build-bpf --manifest-path "modules/token_bridge/program/Cargo.toml" -- --locked && \ + cargo build-bpf --manifest-path "pyth2wormhole/program/Cargo.toml" -- --locked && \ + cargo build-bpf --manifest-path "modules/nft_bridge/program/Cargo.toml" -- --locked && \ + cargo build-bpf --manifest-path "migration/Cargo.toml" -- --locked && \ cp bridge/target/deploy/bridge.so /opt/solana/deps/bridge.so && \ cp bridge/target/deploy/cpi_poster.so /opt/solana/deps/cpi_poster.so && \ cp migration/target/deploy/wormhole_migration.so /opt/solana/deps/wormhole_migration.so && \ diff --git a/solana/Dockerfile.wasm b/solana/Dockerfile.wasm index 85e27707e..88029c225 100644 --- a/solana/Dockerfile.wasm +++ b/solana/Dockerfile.wasm @@ -25,56 +25,58 @@ COPY pyth2wormhole pyth2wormhole # so we remove the non-existent function reference as a workaround. ARG SED_REMOVE_INVALID_REFERENCE="/^\s*wasm.__wbg_systeminstruction_free(ptr);$/d" +# TODO: it appears that wasm-pack ignores our lockfiles even with --locked + # Compile Wormhole RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=bridge/target \ - cd bridge/program && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm && \ + cd bridge/program && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm --locked && \ cd bundler && sed -i $SED_REMOVE_INVALID_REFERENCE bridge_bg.js RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=bridge/target \ - cd bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm + cd bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm --locked # Compile Token Bridge RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=modules/token_bridge/target \ - cd modules/token_bridge/program && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm && \ + cd modules/token_bridge/program && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm --locked && \ cd bundler && sed -i $SED_REMOVE_INVALID_REFERENCE token_bridge_bg.js RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=modules/token_bridge/target \ - cd modules/token_bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm + cd modules/token_bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm --locked # Compile Migration RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=migration/target \ - cd migration && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm && \ + cd migration && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm --locked && \ cd bundler && sed -i $SED_REMOVE_INVALID_REFERENCE wormhole_migration_bg.js RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=migration/target \ - cd migration && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm + cd migration && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm --locked # Compile NFT Bridge RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=modules/nft_bridge/target \ - cd modules/nft_bridge/program && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm && \ + cd modules/nft_bridge/program && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm --locked && \ cd bundler && sed -i $SED_REMOVE_INVALID_REFERENCE nft_bridge_bg.js RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=modules/nft_bridge/target \ - cd modules/nft_bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm + cd modules/nft_bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm --locked # Compile pyth2wormhole RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=pyth2wormhole/target \ cd pyth2wormhole/program \ - && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm + && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm --locked RUN --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=pyth2wormhole/target \ cd pyth2wormhole/program \ - && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm + && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm --locked FROM scratch AS export