Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add verifiable staking build script #427

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions staking/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ node_modules
lib
.env
snapshots
/artifacts
14 changes: 14 additions & 0 deletions staking/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Docker image to generate a deterministic build of the Pyth Staking Program
# program. This image extends backpackapp/build to support local dependencies
# outside the Cargo workspace of the program.
keyvankhademi marked this conversation as resolved.
Show resolved Hide resolved
#

FROM backpackapp/build:v0.29.0@sha256:9aee169b2d8b89b4a4243419ae35c176773136e78d751b3e439eff692c9c1293
keyvankhademi marked this conversation as resolved.
Show resolved Hide resolved

WORKDIR /workspace

COPY . .

CMD ["bash", "-c", \
"anchor build --arch sbf && cp target/deploy/staking.so /artifacts/staking.so"]
18 changes: 18 additions & 0 deletions staking/scripts/build_verifiable_staking_program.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -euo pipefail

# Root of the repository
REPO_ROOT=$(git rev-parse --show-toplevel)

echo "Building the image for the staking program"
docker build --platform linux/x86_64 -t staking-build -f "$REPO_ROOT"/staking/Dockerfile "$REPO_ROOT"/staking

echo "Building the staking program"
docker run --platform linux/x86_64 --rm -v "$REPO_ROOT"/staking/artifacts:/artifacts staking-build

echo "Successfully built the staking program."
echo "The artifacts are available at $REPO_ROOT/staking/artifacts"

CHECKSUM=$(sha256sum $REPO_ROOT/staking/artifacts/staking.so | awk '{print $1}')
echo "sha256sum of the staking program: $CHECKSUM"
Loading