feat(cli): add verify-hash command to diff local WASM against on-chain - #823
Closed
davidugorji wants to merge 1 commit into
Closed
feat(cli): add verify-hash command to diff local WASM against on-chain#823davidugorji wants to merge 1 commit into
davidugorji wants to merge 1 commit into
Conversation
Adds a `bc-forge verify-hash` command that answers whether a deployed
contract is actually running the code in the local build tree.
The local side hashes the raw .wasm bytes with SHA-256, which is exactly
how Soroban derives the code hash it stores, so the two values are
directly comparable. Verified against sha256sum on the same artifact.
The on-chain side reads the contract instance ledger entry and walks
val -> instance -> executable to the referenced wasmHash, rather than
trusting a hash cached in .bc-forge.json, so the check reflects what the
network currently serves.
Distinct verdicts separate the failure modes an operator cares about:
- match local build is what the network runs
- mismatch contract runs different code than the local build
- missing_local the build artifact was not found or is unreadable
- missing_onchain no instance entry, or a Stellar-asset contract with
no uploaded WASM
- invalid malformed input or a failed RPC lookup
The command exits non-zero on anything other than a match so it can gate
a release pipeline.
Closes BCPathway#700
davidugorji
force-pushed
the
feat/700-cli-verify-hash
branch
from
August 26, 2026 15:24
a53b4b0 to
e430607
Compare
|
@davidugorji Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the
verify-hashCLI utility.Answers whether a deployed contract is actually running the code in the local build tree. The local side takes the SHA-256 of the raw
.wasmbytes (exactly how Soroban derives its code hash); the on-chain side reads the contract instance ledger entry and walks to the referencedwasmHash, rather than trusting a hash cached in config. Exits non-zero on anything but a match.Verdicts:
match,mismatch,missing_local,missing_onchain,invalid.Verification:
tscclean, 14/14 unit tests pass, and the local hash was cross-checked againstsha256sumon the same artifact.Closes #700