Skip to content

solana: Deterministic builds via Docker#646

Merged
nvsriram merged 7 commits into
mainfrom
solana/deterministic-docker-build
Jul 10, 2025
Merged

solana: Deterministic builds via Docker#646
nvsriram merged 7 commits into
mainfrom
solana/deterministic-docker-build

Conversation

@nvsriram

@nvsriram nvsriram commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

This PR was initially based on #403. However, due to reasons mentioned in this comment, the Dockerfile changes were reverted.

tl;dr:
This PR adds:

  • Add artifacts-mainnet, artifacts-solana-devnet, and artifacts-tilt-devnet Makefile target to generate verifiable build artifacts using solana-verify build
  • Remove prod-build Makefile target

@nvsriram

Copy link
Copy Markdown
Contributor Author

Solutions considered

Custom Docker stage

Instead of spinning up Docker ourselves and building it, make prod-build that calls anchor build --verifiable under the hood does the same thing. Hence, we don't need the Dockerfile changes to generate the artifacts.

anchor build --verifiable

This fails when trying to build for Anchor v0.29.0. This is because Anchor v0.29.0 Dockerfile uses the old domain (release.solana.com) to install Solana CLI which now fails. Hence, we remove the prod-build target as well.

solana-verify build

This works similar to anchor build --verifiable but uses the new recommended domain (release.anza.xyz) to install Solana CLI. We thus use this as the preferred solution.

@nvsriram

Copy link
Copy Markdown
Contributor Author

Solutions considered

Custom Docker stage

Instead of spinning up Docker ourselves and building it, make prod-build that calls anchor build --verifiable under the hood does the same thing. Hence, we don't need the Dockerfile changes to generate the artifacts.

anchor build --verifiable

This fails when trying to build for Anchor v0.29.0. This is because Anchor v0.29.0 Dockerfile uses the old domain (release.solana.com) to install Solana CLI which now fails. Hence, we remove the prod-build target as well.

solana-verify build

This works similar to anchor build --verifiable but uses the new recommended domain (release.anza.xyz) to install Solana CLI. We thus use this as the preferred solution.

To verify that the solutions generate equivalent artifacts, I generated solana-devnet artifacts using all 3 solutions and compared the executable hashes using:

solana-verify get-executable-hash artifacts-solana-devnet/deploy/example_native_token_transfers.so

All 3 solutions resulted in the same hash (66b5a2c0cd434050906dad40b9681407994e9755feb3c40ca7073fe7a251892f)

@nvsriram
nvsriram requested review from evgeniko and kcsongor June 27, 2025 19:14
@aadam-10
aadam-10 requested review from nik-suri and removed request for kcsongor July 2, 2025 17:15
@nvsriram
nvsriram force-pushed the solana/deterministic-docker-build branch 4 times, most recently from 5ece147 to 1becd63 Compare July 9, 2025 21:47
@nvsriram
nvsriram force-pushed the solana/deterministic-docker-build branch from 1becd63 to 0c4a3fe Compare July 10, 2025 15:46
@nvsriram
nvsriram merged commit c1c3aa5 into main Jul 10, 2025
9 checks passed
@nvsriram
nvsriram deleted the solana/deterministic-docker-build branch July 10, 2025 16:48
dimpar pushed a commit to mezo-org/ntt-bridge-musd-testnet that referenced this pull request Mar 12, 2026
This PR was initially based on wormhole-foundation/native-token-transfers#403. However, due to reasons mentioned in [this comment](wormhole-foundation/native-token-transfers#646 (comment)), the Dockerfile changes were reverted.

tl;dr: 
This PR adds:
* Add `artifacts-mainnet`, `artifacts-solana-devnet`, and `artifacts-tilt-devnet` Makefile target to generate verifiable build artifacts using `solana-verify build`
* Remove `prod-build` Makefile target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants