-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add verifiable staking build script (#427)
* feat: add script to build verifiable staking program A new script called build_verifiable_staking_program.sh has been added, along with a Dockerfile to build an image for the staking program. The script builds the image and the staking program using this image, placing the artifacts at a specified location and printing the sha256sum of the staking program. * fix: add /artifacts to .gitignore in staking directory The /artifacts line has been added to the .gitignore file within the staking directory. This change ensures that generated artifacts from the newly added build script and Dockerfile are not tracked by git. * fix: use the correct version of anchor and solana for verifiable build * chore: update docker file docs
- Loading branch information
1 parent
aad326c
commit 7c1d53e
Showing
5 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ node_modules | |
lib | ||
.env | ||
snapshots | ||
/artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 projectserum/build which is based on backpackapp/build | ||
# but with a specific version of the Solana CLI and Anchor CLI. | ||
# | ||
|
||
FROM projectserum/build:v0.27.0@sha256:0e11aced57c448c7da9bf0a563a146398ac8b88f357b8fc2e1be314b42320686 | ||
|
||
WORKDIR /workspace | ||
|
||
COPY . . | ||
|
||
CMD ["bash", "-c", \ | ||
"anchor build && cp target/deploy/staking.so /artifacts/staking.so"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |