Эх сурвалжийг харах

solana: compile wasm and contracts with --locked (#874)

Leopold Schabel 3 жил өмнө
parent
commit
44c1f9e6a9

+ 2 - 2
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

+ 6 - 6
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 && \

+ 12 - 10
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