Skip to content

Commit a2a0f6e

Browse files
Stanisław DrozdReisen
andauthored
Start depending on the upstream out-of-tree Wormhole (#258)
* Add out-of-tree dependency on wormhole v2.8.9 This lets us outsource all wormhole/solitaire code to the upstream certusone repo * Docker.client: Use cargo-install to install binaries from github * p2w: fix solana-program wasm-bindgen * pyth2wormhole: Fix code-level errors against newer solitaire * p2w: Use upstream wormhole rust code, bump guardian to 2.8.9 * guardian: ensure solana is on, spy: bump image to 2.8.9 Co-authored-by: Reisen <[email protected]>
1 parent b485ef4 commit a2a0f6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+674
-13873
lines changed

Dockerfile.client

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
#syntax=docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2230a333fdbcc
2-
FROM docker.io/library/rust:1.49@sha256:a50165ea96983c21832578afb1c8c028674c965bc1ed43b607871b1f362e06a5
2+
FROM ghcr.io/certusone/solana:1.10.31@sha256:d31e8db926a1d3fbaa9d9211d9979023692614b7b64912651aba0383e8c01bad AS solana
33

4-
RUN apt-get update && apt-get install -yq libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang ncat
4+
ARG WORMHOLE_TAG=v2.8.9
5+
6+
# libudev is needed by spl-token-cli, and ncat is needed by the devnet setup
7+
# script to be able to signal a health status for tilt
8+
RUN apt-get update && apt-get install -yq libudev-dev ncat
59
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
6-
RUN curl -sSfL https://release.solana.com/v1.10.13/install | sh
710

8-
RUN rustup default nightly-2022-02-01
9-
RUN rustup component add rustfmt
11+
COPY solana /usr/src/solana
12+
WORKDIR /usr/src/solana
1013

1114
RUN --mount=type=cache,target=/root/.cache \
12-
cargo install --version =2.0.12 spl-token-cli
13-
14-
ENV SOLANA_BIN_PATH="/root/.local/share/solana/install/active_release/bin"
15-
ENV PATH="$SOLANA_BIN_PATH:$PATH"
15+
cargo install --version =2.0.12 --locked spl-token-cli
1616

17-
ADD solana /usr/src/solana
18-
19-
WORKDIR /usr/src/solana
2017

2118
RUN solana config set --keypair "/usr/src/solana/keys/solana-devnet.json"
2219
RUN solana config set --url "http://solana-devnet:8899"
@@ -25,7 +22,7 @@ ENV EMITTER_ADDRESS="11111111111111111111111111111115"
2522
ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"
2623

2724
RUN --mount=type=cache,target=/root/.cache \
28-
--mount=type=cache,target=bridge/target \
25+
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
2926
set -xe && \
30-
cargo build --manifest-path ./bridge/Cargo.toml --package client --release --locked && \
31-
cp bridge/target/release/client /usr/local/bin
27+
cargo install bridge_client --git https://github.com/certusone/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local && \
28+
cargo install token_bridge_client --git https://github.com/certusone/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local

Dockerfile.solana

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,46 @@ RUN apt-get update && \
1313
zlib1g-dev \
1414
&& \
1515
rm -rf /var/lib/apt/lists/* && \
16-
rustup component add rustfmt && \
17-
rustup default nightly-2022-01-31
16+
rustup component add rustfmt
1817

19-
RUN sh -c "$(curl -sSfL https://release.solana.com/v1.10.13/install)"
18+
RUN sh -c "$(curl -sSfL https://release.solana.com/v1.10.31/install)"
2019

2120
ENV PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
2221

22+
23+
ADD solana/rust-toolchain /rust-toolchain
2324
# Solana does a questionable download at the beginning of a *first* build-bpf call. Trigger and layer-cache it explicitly.
2425
RUN cargo init --lib /tmp/decoy-crate && \
2526
cd /tmp/decoy-crate && cargo build-bpf && \
2627
rm -rf /tmp/decoy-crate
2728

28-
# Add bridge contract sources
2929
WORKDIR /usr/src/bridge
3030

31+
ARG WORMHOLE_REV=2.8.9
32+
ADD https://github.com/certusone/wormhole/archive/refs/tags/v${WORMHOLE_REV}.tar.gz .
33+
RUN tar -xvf v${WORMHOLE_REV}.tar.gz
34+
RUN mv wormhole-${WORMHOLE_REV} wormhole
35+
# RUN mkdir -p /usr/src/bridge/wormhole/solana/target
36+
37+
3138
ADD solana solana
3239
ADD third_party/pyth/p2w-sdk/rust third_party/pyth/p2w-sdk/rust
3340
RUN mkdir -p /opt/solana/deps
3441

3542
ENV EMITTER_ADDRESS="11111111111111111111111111111115"
3643
ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"
3744

45+
WORKDIR /usr/src/bridge/solana
46+
3847
# Build Wormhole Solana programs
39-
RUN --mount=type=cache,target=solana/bridge/target \
40-
--mount=type=cache,target=solana/modules/token_bridge/target \
41-
--mount=type=cache,target=solana/modules/nft_bridge/target \
42-
--mount=type=cache,target=solana/pyth2wormhole/target \
43-
--mount=type=cache,target=solana/migration/target \
44-
cargo build-bpf --manifest-path "solana/bridge/program/Cargo.toml" -- --locked && \
45-
cargo build-bpf --manifest-path "solana/bridge/cpi_poster/Cargo.toml" -- --locked && \
46-
cargo build-bpf --manifest-path "solana/pyth2wormhole/program/Cargo.toml" -- --locked && \
47-
cp solana/bridge/target/deploy/bridge.so /opt/solana/deps/bridge.so && \
48-
cp solana/bridge/target/deploy/cpi_poster.so /opt/solana/deps/cpi_poster.so && \
49-
cp solana/pyth2wormhole/target/deploy/pyth2wormhole.so /opt/solana/deps/pyth2wormhole.so
48+
RUN --mount=type=cache,target=../wormhole/solana/target \
49+
--mount=type=cache,target=pyth2wormhole/target \
50+
cargo build-bpf --manifest-path "../wormhole/solana/bridge/program/Cargo.toml" -- --locked && \
51+
cargo build-bpf --manifest-path "../wormhole/solana/bridge/cpi_poster/Cargo.toml" -- --locked && \
52+
cargo build-bpf --manifest-path "pyth2wormhole/program/Cargo.toml" -- --locked && \
53+
cp ../wormhole/solana/target/deploy/bridge.so /opt/solana/deps/bridge.so && \
54+
cp ../wormhole/solana/target/deploy/cpi_poster.so /opt/solana/deps/cpi_poster.so && \
55+
cp pyth2wormhole/target/deploy/pyth2wormhole.so /opt/solana/deps/pyth2wormhole.so
5056

5157
COPY --from=pyth-oracle-copy /home/pyth/pyth-client/target/oracle.so /opt/solana/deps/pyth_oracle.so
5258

Dockerfile.wasm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ RUN apt-get update && \
55
apt-get install -y libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang && \
66
apt-get clean && rm -rf /var/lib/apt/lists/*
77

8+
# We default an older nightly since current rust-toolchain makes the
9+
# wasm-pack build unhappy, we introduce it later for our code
810
RUN rustup component add rustfmt && \
911
rustup default nightly-2022-01-02
1012

0 commit comments

Comments
 (0)