protocol.proof#
STARK proof data structures and serialization.
Attributes#
Classes#
Merkle authentication path: leaf values and sibling hashes. |
|
Merkle tree commitment with query proofs. |
|
FRI opening proof: folding trees and final polynomial. |
|
Complete STARK proof for a single AIR. |
Functions#
|
Convert STARK proof to JSON-serializable dictionary. |
|
Load STARK proof from JSON file. |
|
Parse a VadcopFinal proof binary with embedded publics header. |
|
Deserialize binary proof to STARKProof structure. |
|
Serialize proof header and footer (without query proofs) for partial comparison. |
|
Serialize complete STARK proof to binary format (requires query proofs). |
|
Serialize proof dictionary to binary format matching C++ proof2pointer(). |
|
Validate that proof structure matches STARK configuration. |
Module Contents#
- class protocol.proof.MerkleProof[source]#
Merkle authentication path: leaf values and sibling hashes.
- class protocol.proof.ProofTree[source]#
Merkle tree commitment with query proofs.
- pol_queries: list[list[MerkleProof]] = [][source]#
- class protocol.proof.STARKProof[source]#
Complete STARK proof for a single AIR.
Contains all components needed to verify that a prover knows a valid execution trace satisfying the AIR constraints.
- Attributes:
- roots: Merkle roots for each stage commitment (stages 1 to n_stages+1).
roots[0] is stage 1 (witness), roots[-1] is quotient polynomial.
- last_levels: Pre-verified Merkle nodes for last_level_verification optimization.
Indexed by tree: [stage_0, …, stage_n, const_tree].
- evals: Polynomial evaluations at challenge point xi. Each entry is
[c0, c1, c2] coefficients of an FF3 extension field element.
- airgroup_values: Values shared across all AIRs in an airgroup (e.g., gsum_result).
Used for cross-AIR boundary constraints. Each is [c0, c1, c2].
- air_values: Values specific to this individual AIR instance.
Stage 1 values are single FF, stage 2+ are FF3 [c0, c1, c2].
custom_commits: Names of custom commitment schemes used (if any). fri: FRI protocol data - folding trees, query proofs, and final polynomial. nonce: Grinding nonce satisfying the grinding constraint.
- protocol.proof.proof_to_json(proof: STARKProof, n_stages: int, n_field_elements: int = HASH_SIZE) dict[str, Any][source]#
Convert STARK proof to JSON-serializable dictionary.
- protocol.proof.load_proof_from_json(path: str) tuple[STARKProof, dict[str, Any]][source]#
Load STARK proof from JSON file.
- protocol.proof.from_vadcop_final_bytes(data: bytes, stark_info: Any) tuple[STARKProof, numpy.ndarray][source]#
Parse a VadcopFinal proof binary with embedded publics header.
VadcopFinal proofs prepend [n_publics: u64] [publics: n_publics * u64] before the standard proof body (ref: recursion.rs lines 622-627).
- Returns:
Tuple of (STARKProof, publics_array) where publics_array is numpy uint64.
- protocol.proof.from_bytes_full(data: bytes, stark_info: Any) STARKProof[source]#
Deserialize binary proof to STARKProof structure.
Parses the binary format produced by C++ proof2pointer() into a structured STARKProof dataclass with typed fields for all proof components.
- protocol.proof.to_bytes_partial(proof_dict: dict[str, Any], stark_info: Any) tuple[bytes, bytes][source]#
Serialize proof header and footer (without query proofs) for partial comparison.
- protocol.proof.to_bytes_full(proof: STARKProof, stark_info: Any) bytes[source]#
Serialize complete STARK proof to binary format (requires query proofs).
- protocol.proof.to_bytes_full_from_dict(proof_dict: dict[str, Any], stark_info: Any) bytes[source]#
Serialize proof dictionary to binary format matching C++ proof2pointer().
- protocol.proof.validate_proof_structure(proof: STARKProof, stark_info: Any) list[str][source]#
Validate that proof structure matches STARK configuration.