Skip to content

docs: pin toolchain and document reproducible builds for deployed contracts - #68

Open
Fabluchy wants to merge 2 commits into
MergeFi:mainfrom
Fabluchy:feat/reproducible-builds
Open

docs: pin toolchain and document reproducible builds for deployed contracts#68
Fabluchy wants to merge 2 commits into
MergeFi:mainfrom
Fabluchy:feat/reproducible-builds

Conversation

@Fabluchy

Copy link
Copy Markdown

Summary

Closes #59 — makes the deployed testnet contract WASM independently verifiable against published source, and honestly documents how far that verification currently goes.

What changed

  • rust-toolchain.toml — pins rustc 1.95.0 (+ the wasm32v1-none target) so rustup auto-selects the exact toolchain for anyone building this repo. CI's dtolnay/rust-toolchain steps pick this up automatically (no explicit toolchain input is set).
  • Cargo.toml — soroban-sdk pinned exactly (=26.1.0) instead of a caret range; decision recorded in the README (issue No reproducible-build / supply-chain verification — deployed testnet WASM hash cannot be independently confirmed against published source #59 asks for this to be considered).
  • README.md
    • deployed-contracts table now includes the actual on-chain WASM SHA-256 for all three contracts, read directly from the testnet ledger (not computed from source);
    • new "Reproducible builds" section: the full verify recipe, the never run cargo update before a build you intend to deploy rule, the soroban-sdk pinning decision, and the honest state of the currently-deployed bytecode (see below).
  • scripts/verify-wasm-hash.mjs + make verify — compare locally built .wasm against the ledger-recorded hash for each deployed contract; exits non-zero on mismatch.
  • contracts/escrow/src/test.rs — fixed a pre-existing failing test (test_multi_sponsor_refund_returns_exact_contributions_to_each_sponsor): it set the ledger timestamp inside the deadline + GRACE_PERIOD window, so the permissionless-refund path never opened and the call failed auth. Was failing on main (29/30 escrow tests) and would have kept CI red.

What the verification found (important, documented in the README)

Forensics on the deployed WASM (embedded contractmetav0 metadata records rsver = 1.95.0, and panic-location strings embed /Users/user/.cargo/... registry paths) show the deployed contracts were built from commit 8a7efbf (2026-07-05) with rustc 1.95.0 on macOS:

  1. Current main does not produce the deployed hashes — the deployed contracts predate the multi-sponsor crowdfunding, mergefi-common extraction, and milestones-crowdfunding changes. make verify on main reports a mismatch by design until the contracts are redeployed.
  2. Even at commit 8a7efbf with rustc 1.95.0, a Linux build is ~99% byte-identical but not hash-identical to the deployed macOS build (16 of 184 functions differ by 1–2 bytes plus function-ordering; sizes and metadata match exactly) — because soroban-sdk panic locations embed the build machine's absolute CARGO_HOME path and LLVM/LTO codegen is host-dependent. This is precisely the supply-chain limitation the issue is about, and it's now documented with the exact hashes so a reader can see it rather than trust it.

The ledger-recorded hashes (published in the README) are the ground truth via make verify.

Verification

  • cargo test --workspace56/56 pass (30 escrow, 19 milestones, 7 maintenance-pool)
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --check — clean
  • make build (wasm32v1-none, rustc 1.95.0) — succeeds; make verify correctly reports mismatch vs. the pre-crowdfunding deployed bytecode (documented)

closes #59

Fabluchy and others added 2 commits August 17, 2026 12:32
test_multi_sponsor_refund_returns_exact_contributions_to_each_sponsor
set the ledger timestamp to 300 with a fund deadline of 200, which is
still inside refund's deadline + GRACE_PERIOD (14 days) window — so the
permissionless-refund path never opened and the call failed the admin
auth check under `set_auths(&[])`. Align it with the other
permissionless tests by jumping to deadline + GRACE_PERIOD exactly, and
clean up pre-existing trailing whitespace that failed `cargo fmt --check`.

This was failing on main (29/30 escrow tests) and would have kept CI red.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
…tracts

Closes the reproducible-build / supply-chain verification gap for the
deployed testnet contracts:

- Add rust-toolchain.toml pinning rustc 1.95.0 (with the wasm32v1-none
  target), so rustup auto-selects the exact toolchain instead of relying
  on README prose. dtolnay/rust-toolchain in CI picks this up too.
- Pin soroban-sdk exactly ("=26.1.0") instead of a caret range, removing
  one further axis of non-determinism independent of Cargo.lock, and
  record the decision in the README.
- Publish the actual on-chain WASM SHA-256 for all three deployed testnet
  contracts in the README's contract table, read directly from the ledger
  (not computed from source). Document that they were built from commit
  8a7efbf with rustc 1.95.0 on macOS, that current main does not produce
  them (pre-crowdfunding source), and that even at that commit a Linux
  build is ~99% byte-identical but not hash-identical due to host-dependent
  LLVM/LTO codegen and the embedded absolute CARGO_HOME path.
- Add the full verification recipe (build -> sha256sum -> make verify),
  the no-cargo-update rule, and scripts/verify-wasm-hash.mjs + `make
  verify` to compare local builds against the ledger-recorded hashes.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@Fabluchy is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

No reproducible-build / supply-chain verification — deployed testnet WASM hash cannot be independently confirmed against published source

1 participant