Skip to content

Add stellar contract verify command#2586

Draft
fnando wants to merge 20 commits into
contract-build-verifiablefrom
contract-verify
Draft

Add stellar contract verify command#2586
fnando wants to merge 20 commits into
contract-build-verifiablefrom
contract-verify

Conversation

@fnando
Copy link
Copy Markdown
Member

@fnando fnando commented May 22, 2026

⚠️ Depends on #2585 — do not merge until #2585 lands on main. This PR's base is contract-build-verifiable, so once #2585 merges, GitHub will automatically retarget this one to main.

What

Adds a new stellar contract verify subcommand that takes a contract id (--id, fetched from the network) or a local WASM (--wasm), reads the SEP-58 build metadata embedded in it (bldimg, source identification, build flags), re-runs the recorded build inside the recorded container image, and byte-compares the result against the original to confirm the WASM is reproducible.

Notable bits:

  • Source materialization works for both git pairs (source_repo + source_rev) and tarballs (tarball_url + tarball_sha256). For WASMs that record only tarball_sha256, the user can supply a local file or URL via --tarball-url.
  • Git cloning uses gix (with rustls TLS) instead of shelling out to git, so the command has no runtime dependency on a system git binary and there's a single retrieval channel to gate on.
  • A trust prompt fires before pulling an unrecognized bldimg, and unconditionally for any tarball source (tarballs are never default-trusted). --trust skips it; the prompt overrides --quiet so it can't be silenced by accident. The default trust list is the stellar/stellar-cli image.
  • The materialized source directory is created with hardened permissions so a local attacker can't slip a file in mid-verify.
  • Integration tests cover the git source path, tarball-by-URL, tarball-by-local-file (with --tarball-sha256), and the trust-prompt flow; they live in the existing integration tier.

Why

#2585 makes it possible to produce a verifiable build; this PR is the other half — a way to check a deployed contract against its claimed source. Together they close the SEP-58 loop end-to-end in the CLI.

Known limitations

N/A

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX May 22, 2026
@fnando fnando moved this from Backlog (Not Ready) to In Progress in DevX May 22, 2026
@fnando fnando self-assigned this May 22, 2026
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​reqwest@​0.13.37910094100100
Addedcargo/​gix@​0.83.08110093100100
Addedcargo/​tar@​0.4.4610010093100100
Updatedcargo/​tempfile@​3.21.0 ⏵ 3.27.098 -110093100100

View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant