Add stellar contract verify command#2586
Conversation
|
Hi @fnando, we just submitted a proposal for the Contract Source Verification Service RFP and it mentioned your draft PR. It’s great that SEP-58 core verification logic is now embedded directly in While designing our tech architecture document for the RFP, we noticed retroactive verification is a mandatory requirement for the upcoming verification service, but contracts deployed before At the moment, In your notable bits, you mention that the user can supply a local file or URL via It is the responsibility of the verifier to flag these verification results as having their build environment provided by the user submitting the verification and not recorded on-chain in WASM metadata. Does this suggestion makes sense and do you plan to add support for user-supplied build environment + source identification parameters while finalizing this draft? |
|
@saimeunt Yes, the scenario makes sense, but I don't think it should live under The way I see it, the verification service is the one responsible for receiving and storing everything needed to build the contract (source code, OS distro, build options, etc.). For that reason I'd keep the SEP-58 path in the CLI strictly tied to the immutable, on-chain The real distinction isn't whether the build image is custom (an on-chain metadata can reference a custom image too, and that's equally hard to trust without auditing the image). It's chain of custody: on-chain fields are immutable and tied to the deployer, while user-supplied fields have no such provenance. That's exactly the case you raised; it's the verifier's responsibility to flag those results as "build environment provided by the submitter, not recorded on-chain." I'd put all of that under out-of-band verification: the registry works with developers to verify contracts and covers everything SEP-58 doesn't (private source, pre-SEP-58 contracts1, etc.). The registry marks the contract verified, and it's ultimately up to users to trust the registry's findings, so the more verification services a developer goes through, the higher the trust. Footnotes
|
|
A verification service doesn't need to use the cli to verify with data not in the wasm meta. It should use the docker image directly. |
|
@fnando @leighmcculloch Thanks for your answers, I agree Verifiers will use their own logic built on top of the |
557647b to
6e7c125
Compare
main. This PR's base iscontract-build-verifiable, so once #2585 merges, GitHub will automatically retarget this one tomain.What
Adds a new
stellar contract verifysubcommand that takes a contract id (--id) or WASM hash (--wasm-hash) to fetch from the network, or a local WASM (--wasm) — the three are mutually exclusive. It 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_sha256(required) and, optionally, asource_uri. Verify fetches the source tarball from the recordedsource_uri, or from a--source-urioverride (anhttp(s)URL or a local file path), checks its SHA-256 against the recorded value, then extracts it. The source is always a content-addressed tarball, so there's no runtime dependency on a systemgitbinary.--verifiablebuild machinery rather than reimplementing it: the same source-archive extraction (under the data dir, permission-hardened), the same container run, and the same--metacomposition — so the rebuilt WASM's metadata matches the original byte-for-byte.bldimg, and unconditionally for any tarball source (tarballs are never default-trusted).--trustskips it; the prompt overrides--quietso it can't be silenced by accident. The default trust list is the stellar/stellar-cli image.contract init, build verifiably, regenerate the matching archive withcontract archive, verify it via--source-uri, plus verify-by---idand a tampered-bytes failure case. 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