Skip to content

Commit f2d5bdc

Browse files
authored
chore(target_chains/solana): add verifiable build script (#1378)
This change adds a Dockerfile based on Anchor's default verifiable build dockerfile and a script to build the program using that Dockerfile. The script also prints the sha256sum of the program which can be used to verify on-chain deployments.
1 parent e394f56 commit f2d5bdc

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

target_chains/solana/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.anchor
33
.DS_Store
44
target
5+
artifacts
56
**/*.rs.bk
67
node_modules
78
lib

target_chains/solana/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Docker image to generate a deterministic build of the Pyth Solana Receiver
3+
# program. This image extends backpackapp/build to support local dependencies
4+
# outside the Cargo workspace of the program.
5+
#
6+
7+
FROM backpackapp/build:v0.29.0@sha256:9aee169b2d8b89b4a4243419ae35c176773136e78d751b3e439eff692c9c1293
8+
9+
WORKDIR /workspace
10+
11+
COPY pythnet/pythnet_sdk pythnet/pythnet_sdk
12+
COPY target_chains/solana target_chains/solana
13+
14+
WORKDIR /workspace/target_chains/solana
15+
16+
CMD ["bash", "-c", \
17+
"anchor build -p pyth_solana_receiver --arch sbf && cp target/sbf-solana-solana/release/pyth_solana_receiver.so /artifacts/pyth_solana_receiver.so"]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Root of the repository
6+
REPO_ROOT=$(git rev-parse --show-toplevel)
7+
8+
9+
echo "Building the image for the receiver program"
10+
docker build --platform linux/x86_64 -t solana-receiver-builder -f $REPO_ROOT/target_chains/solana/Dockerfile $REPO_ROOT
11+
12+
echo "Building the receiver program"
13+
docker run --platform linux/x86_64 --rm -v $REPO_ROOT/target_chains/solana/artifacts:/artifacts solana-receiver-builder
14+
15+
echo "Successfully built the receiver program."
16+
echo "The artifacts are available at $REPO_ROOT/target_chains/solana/artifacts"
17+
18+
CHECKSUM=$(sha256sum $REPO_ROOT/target_chains/solana/artifacts/pyth_solana_receiver.so | awk '{print $1}')
19+
echo "sha256sum of the pyth_solana_receiver program: $CHECKSUM"

0 commit comments

Comments
 (0)