feat(scarb-prove): expose --proof-format flag for cairo_serde output#3125
Merged
maciektr merged 2 commits intoMay 28, 2026
Merged
Conversation
maciektr
approved these changes
May 27, 2026
Contributor
|
Thank you @seritalien ! |
Adds a --proof-format CLI flag to `scarb prove` so users can select the serialization format used by stwo-cairo-prover's `create_and_serialize_proof`. Default remains `json` to preserve existing behavior; the new `cairo-serde` value emits the felt-array layout expected by Cairo-side verifiers, enabling proof-composition (recursive aggregation) pipelines. - utils/scarb-extensions-cli/src/prove.rs: add `proof_format: ProofFormat` field with `default_value_t = ProofFormat::Json`. - utils/scarb-extensions-cli/Cargo.toml: pull cairo-air (optional) under the `prove` feature so the enum is available where the Args are defined. - extensions/scarb-prove/src/main.rs: thread `args.proof_format` into `create_and_serialize_proof` instead of the hardcoded `ProofFormat::Json`.
9b41c97 to
e1c257c
Compare
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.
Summary
Expose
ProofFormat::CairoSerdeonscarb provevia a new--proof-formatflag, mirroring the upstreamstwo-cairo-proverprovebinary. Enables proof-composition pipelines (e.g. recursive aggregation invauban-zkpay) where one Cairo program takes anArray<CairoProof>as input — currently impossible becausescarb proveonly writesCairoProofForRustVerifier-shaped JSON which loses theExtendedStarkProofauxiliary data the in-Cairo verifier needs.Motivation
stwo-cairo-proveralready supportsProofFormat::CairoSerdethroughcreate_and_serialize_proof.scarb provehardcodesProofFormat::Jsonatextensions/scarb-prove/src/main.rs:108. This adds one CLI flag withdefault_value_t = ProofFormat::Jsonso behavior is preserved for existing callers.Use case
Vauban Pay (
vauban-org/vauban-zkpay) recursive aggregation: avauban_zkpay_aggregationCairo executable accepts K innerCairoProofinstances via--arguments-file, callsstwo_cairo_air::verify_cairoK times, then is itself proven by Stwo to produce a single outer STARK thatVaubanSettlementverifies on Starknet. Withoutcairo_serdeoutput fromscarb prove, the K inner proofs cannot be marshaled into the aggregation's args-file without reimplementing the prover offline.Behavior
--proof-format json).--proof-format cairo-serdewrites["0x...", "0x...", ...].scarb verifyalready accepts both formats viacairo_air::utils::ProofFormatround-trip.Compat
Backwards-compatible. No breaking changes.