protocol.proof

Contents

protocol.proof#

STARK proof and verifying key data structures.

Faithful Python translation of the Rust proof types from the stark-backend and Plonky3 FRI libraries, plus JSON parsing functions for deserialization from serde_json output.

Proof types reference:
stark-backend/src/proof.rs — Proof, Commitments, OpeningProof, OpenedValues,

AdjacentOpenedValues, AirProofData

p3-fri/src/proof.rs — FriProof, QueryProof, CommitPhaseProofStep p3-fri/src/two_adic_pcs.rs — BatchOpening

VK types reference:
stark-backend/src/keygen/types.rs — MultiStarkVerifyingKey, StarkVerifyingKey,

StarkVerifyingParams, TraceWidth

stark-backend/src/air_builders/symbolic/dag.rs — SymbolicExpressionDag,

SymbolicExpressionNode

stark-backend/src/air_builders/symbolic/symbolic_variable.rs — SymbolicVariable, Entry stark-backend/src/interaction/mod.rs — Interaction

Classes#

Commitments

All commitments to a multi-matrix STARK (not preprocessed).

AdjacentOpenedValues

Opened values at zeta and zeta * g for one trace matrix.

OpenedValues

All opened values across preprocessed, main, after-challenge, and quotient.

CommitPhaseProofStep

One round of a FRI query: sibling value + Merkle proof.

BatchOpening

Opened values from a single MMCS batch at a query index.

QueryProof

FRI query proof for a single query index.

FriProof

Complete FRI proof.

OpeningProof

PCS opening proof with opened values.

AirProofData

Proof data for a single AIR.

FriLogUpPartialProof

Partial proof for the FRI LogUp challenge phase.

Proof

Full multi-AIR STARK proof.

EntryType

Kind of symbolic variable entry.

Entry

Symbolic variable entry with kind and offset/part_index.

SymbolicVariable

A variable within the evaluation window (column reference).

SymbolicNodeKind

Kind of symbolic expression node.

SymbolicExpressionNode

A node in the symbolic expression DAG.

SymbolicExpressionDag

DAG of symbolic expressions in topological order.

Interaction

A bus interaction.

SymbolicConstraintsDag

Complete symbolic constraints for a single AIR.

TraceWidth

Widths of different parts of a trace matrix.

StarkVerifyingParams

Verification parameters for a single STARK.

RapPhaseSeqKind

Supported challenge phase protocols.

VerifierSinglePreprocessedData

Verifier data for preprocessed trace for a single AIR.

StarkVerifyingKey

Verifying key for a single STARK (single AIR).

LinearConstraint

Linear constraint on trace heights.

MultiStarkVerifyingKey0

Inner verifying key data (without pre_hash).

MultiStarkVerifyingKey

Complete multi-AIR verifying key.

FriParameters

FRI protocol parameters.

AirInputData

Raw input trace matrices for one AIR, used by the prover.

ProverInputs

All input trace data needed by the prover.

Functions#

parse_proof_json(→ Proof)

Parse a Proof from a JSON dict (serde_json format).

parse_vk_json(→ MultiStarkVerifyingKey)

Parse a MultiStarkVerifyingKey from a JSON dict (serde_json format).

parse_fri_params(→ FriParameters)

Parse FRI parameters from a test vector JSON dict.

parse_prover_inputs(→ ProverInputs)

Parse prover input vectors from JSON.

parse_e2e_vectors(→ tuple[Proof, FriParameters, dict])

Parse complete E2E test vectors.

serialize_proof_json(→ dict)

Serialize a Proof to serde-compatible JSON dict.

Module Contents#

class protocol.proof.Commitments[source]#

All commitments to a multi-matrix STARK (not preprocessed).

Reference:

stark-backend/src/proof.rs (struct Commitments<Com>)

main_trace: list[primitives.field.Digest][source]#
after_challenge: list[primitives.field.Digest][source]#
quotient: primitives.field.Digest[source]#
class protocol.proof.AdjacentOpenedValues[source]#

Opened values at zeta and zeta * g for one trace matrix.

Reference:

stark-backend/src/proof.rs (struct AdjacentOpenedValues<Challenge>)

local: list[primitives.field.FF4Coeffs][source]#
next: list[primitives.field.FF4Coeffs][source]#
class protocol.proof.OpenedValues[source]#

All opened values across preprocessed, main, after-challenge, and quotient.

Reference:

stark-backend/src/proof.rs (struct OpenedValues<Challenge>)

preprocessed: list[AdjacentOpenedValues][source]#
main: list[list[AdjacentOpenedValues]][source]#
after_challenge: list[list[AdjacentOpenedValues]][source]#
quotient: list[list[list[primitives.field.FF4Coeffs]]][source]#
class protocol.proof.CommitPhaseProofStep[source]#

One round of a FRI query: sibling value + Merkle proof.

Reference:

p3-fri/src/proof.rs (struct CommitPhaseProofStep<F, M>)

sibling_value: primitives.field.FF4Coeffs[source]#
opening_proof: primitives.field.MerklePath[source]#
class protocol.proof.BatchOpening[source]#

Opened values from a single MMCS batch at a query index.

Reference:

p3-fri/src/two_adic_pcs.rs (struct BatchOpening<Val, InputMmcs>)

opened_values: list[list[primitives.field.Fe]][source]#
opening_proof: primitives.field.MerklePath[source]#
class protocol.proof.QueryProof[source]#

FRI query proof for a single query index.

Reference:

p3-fri/src/proof.rs (struct QueryProof<F, M, InputProof>)

input_proof: list[BatchOpening][source]#
commit_phase_openings: list[CommitPhaseProofStep][source]#
class protocol.proof.FriProof[source]#

Complete FRI proof.

Reference:

p3-fri/src/proof.rs (struct FriProof<F, M, Witness, InputProof>)

commit_phase_commits: list[primitives.field.Digest][source]#
query_proofs: list[QueryProof][source]#
final_poly: list[primitives.field.FF4Coeffs][source]#
commit_pow_witnesses: list[int][source]#
query_pow_witness: int[source]#
class protocol.proof.OpeningProof[source]#

PCS opening proof with opened values.

Reference:

stark-backend/src/proof.rs (struct OpeningProof<PcsProof, Challenge>)

proof: FriProof[source]#
values: OpenedValues[source]#
deep_pow_witness: int[source]#
class protocol.proof.AirProofData[source]#

Proof data for a single AIR.

Reference:

stark-backend/src/proof.rs (struct AirProofData<Val, Challenge>)

air_id: int[source]#
degree: int[source]#
exposed_values_after_challenge: list[list[primitives.field.FF4Coeffs]][source]#
public_values: list[primitives.field.Fe][source]#
class protocol.proof.FriLogUpPartialProof[source]#

Partial proof for the FRI LogUp challenge phase.

Reference:

stark-backend/src/interaction/fri_log_up.rs (struct FriLogUpPartialProof<Witness>)

logup_pow_witness: primitives.field.Fe[source]#
class protocol.proof.Proof[source]#

Full multi-AIR STARK proof.

Reference:

stark-backend/src/proof.rs (struct Proof<SC>)

commitments: Commitments[source]#
opening: OpeningProof[source]#
per_air: list[AirProofData][source]#
rap_phase_seq_proof: FriLogUpPartialProof | None = None[source]#
class protocol.proof.EntryType(*args, **kwds)[source]#

Bases: enum.Enum

Kind of symbolic variable entry.

Reference:

stark-backend/src/air_builders/symbolic/symbolic_variable.rs (enum Entry)

PREPROCESSED[source]#
MAIN[source]#
PERMUTATION[source]#
PUBLIC[source]#
CHALLENGE[source]#
EXPOSED[source]#
class protocol.proof.Entry[source]#

Symbolic variable entry with kind and offset/part_index.

Reference:

stark-backend/src/air_builders/symbolic/symbolic_variable.rs (enum Entry)

kind: EntryType[source]#
offset: int | None = None[source]#
part_index: int | None = None[source]#
class protocol.proof.SymbolicVariable[source]#

A variable within the evaluation window (column reference).

Reference:

stark-backend/src/air_builders/symbolic/symbolic_variable.rs (struct SymbolicVariable<F>)

entry: Entry[source]#
index: int[source]#
class protocol.proof.SymbolicNodeKind(*args, **kwds)[source]#

Bases: enum.Enum

Kind of symbolic expression node.

Reference:

stark-backend/src/air_builders/symbolic/dag.rs (enum SymbolicExpressionNode)

VARIABLE[source]#
IS_FIRST_ROW[source]#
IS_LAST_ROW[source]#
IS_TRANSITION[source]#
CONSTANT[source]#
ADD[source]#
SUB[source]#
NEG[source]#
MUL[source]#
class protocol.proof.SymbolicExpressionNode[source]#

A node in the symbolic expression DAG.

Reference:

stark-backend/src/air_builders/symbolic/dag.rs (enum SymbolicExpressionNode<F>)

Fields vary by kind: - VARIABLE: variable is set - CONSTANT: constant_value is set - ADD/SUB/MUL: left_idx, right_idx, degree_multiple are set - NEG: idx, degree_multiple are set - IS_FIRST_ROW/IS_LAST_ROW/IS_TRANSITION: no extra fields

kind: SymbolicNodeKind[source]#
variable: SymbolicVariable | None = None[source]#
constant_value: primitives.field.Fe | None = None[source]#
left_idx: int | None = None[source]#
right_idx: int | None = None[source]#
idx: int | None = None[source]#
degree_multiple: int | None = None[source]#
class protocol.proof.SymbolicExpressionDag[source]#

DAG of symbolic expressions in topological order.

Reference:

stark-backend/src/air_builders/symbolic/dag.rs (struct SymbolicExpressionDag<F>)

nodes: list[SymbolicExpressionNode][source]#
constraint_idx: list[int][source]#
class protocol.proof.Interaction[source]#

A bus interaction.

Reference:

stark-backend/src/interaction/mod.rs (struct Interaction<Expr>)

In the DAG form, message and count are node indices (int).

message: list[int][source]#
count: int[source]#
bus_index: int[source]#
count_weight: int[source]#
class protocol.proof.SymbolicConstraintsDag[source]#

Complete symbolic constraints for a single AIR.

Reference:

stark-backend/src/air_builders/symbolic/dag.rs (struct SymbolicConstraintsDag<F>)

constraints: SymbolicExpressionDag[source]#
interactions: list[Interaction][source]#
class protocol.proof.TraceWidth[source]#

Widths of different parts of a trace matrix.

Reference:

stark-backend/src/keygen/types.rs (struct TraceWidth)

preprocessed: int | None[source]#
cached_mains: list[int][source]#
common_main: int[source]#
after_challenge: list[int][source]#
class protocol.proof.StarkVerifyingParams[source]#

Verification parameters for a single STARK.

Reference:

stark-backend/src/keygen/types.rs (struct StarkVerifyingParams)

width: TraceWidth[source]#
num_public_values: int[source]#
num_exposed_values_after_challenge: list[int][source]#
num_challenges_to_sample: list[int][source]#
class protocol.proof.RapPhaseSeqKind(*args, **kwds)[source]#

Bases: enum.Enum

Supported challenge phase protocols.

Reference:

stark-backend/src/interaction/mod.rs (enum RapPhaseSeqKind)

FRI_LOG_UP[source]#
class protocol.proof.VerifierSinglePreprocessedData[source]#

Verifier data for preprocessed trace for a single AIR.

Reference:

stark-backend/src/keygen/types.rs (struct VerifierSinglePreprocessedData<Com>)

commit: primitives.field.Digest[source]#
class protocol.proof.StarkVerifyingKey[source]#

Verifying key for a single STARK (single AIR).

Reference:

stark-backend/src/keygen/types.rs (struct StarkVerifyingKey<Val, Com>)

preprocessed_data: VerifierSinglePreprocessedData | None[source]#
params: StarkVerifyingParams[source]#
symbolic_constraints: SymbolicConstraintsDag[source]#
quotient_degree: int[source]#
rap_phase_seq_kind: RapPhaseSeqKind[source]#
class protocol.proof.LinearConstraint[source]#

Linear constraint on trace heights.

Reference:

stark-backend/src/keygen/types.rs (struct LinearConstraint)

coefficients: list[int][source]#
threshold: int[source]#
class protocol.proof.MultiStarkVerifyingKey0[source]#

Inner verifying key data (without pre_hash).

Reference:

stark-backend/src/keygen/types.rs (struct MultiStarkVerifyingKey0<SC>)

per_air: list[StarkVerifyingKey][source]#
trace_height_constraints: list[LinearConstraint][source]#
log_up_pow_bits: int[source]#
deep_pow_bits: int[source]#
class protocol.proof.MultiStarkVerifyingKey[source]#

Complete multi-AIR verifying key.

Reference:

stark-backend/src/keygen/types.rs (struct MultiStarkVerifyingKey<SC>)

inner: MultiStarkVerifyingKey0[source]#
pre_hash: primitives.field.Digest[source]#
class protocol.proof.FriParameters[source]#

FRI protocol parameters.

Reference:

stark-sdk/src/config/mod.rs (struct FriParameters)

log_blowup: int[source]#
log_final_poly_len: int[source]#
num_queries: int[source]#
query_proof_of_work_bits: int[source]#
commit_proof_of_work_bits: int[source]#
protocol.proof.parse_proof_json(data: dict) Proof[source]#

Parse a Proof from a JSON dict (serde_json format).

Handles the JSON produced by serde_json::to_vec(&proof) for Proof<BabyBearPoseidon2Config>.

Reference:

stark-backend/src/proof.rs (struct Proof<SC>)

protocol.proof.parse_vk_json(data: dict) MultiStarkVerifyingKey[source]#

Parse a MultiStarkVerifyingKey from a JSON dict (serde_json format).

Reference:

stark-backend/src/keygen/types.rs (struct MultiStarkVerifyingKey<SC>)

protocol.proof.parse_fri_params(data: dict) FriParameters[source]#

Parse FRI parameters from a test vector JSON dict.

Reference:

crates/test-vectors/src/lib.rs (struct FriParamsMeta)

class protocol.proof.AirInputData[source]#

Raw input trace matrices for one AIR, used by the prover.

Reference:

crates/test-vectors/src/lib.rs (struct AirInputVectors)

air_id: int[source]#
common_main: list[list[primitives.field.Fe]] | None[source]#
cached_mains: list[list[list[primitives.field.Fe]]][source]#
preprocessed: list[list[primitives.field.Fe]] | None[source]#
class protocol.proof.ProverInputs[source]#

All input trace data needed by the prover.

Reference:

crates/test-vectors/src/lib.rs (struct ProverInputVectors)

per_air: list[AirInputData][source]#
protocol.proof.parse_prover_inputs(data: dict) ProverInputs[source]#

Parse prover input vectors from JSON.

Field values are canonical u32, no Montgomery conversion needed (traces are raw field elements, not serialized proof data).

Reference:

crates/test-vectors/src/lib.rs (struct ProverInputVectors)

protocol.proof.parse_e2e_vectors(vectors: dict) tuple[Proof, FriParameters, dict][source]#

Parse complete E2E test vectors.

Returns:

(proof, fri_params, commitments_meta) where: - proof: parsed Proof dataclass - fri_params: parsed FriParameters - commitments_meta: dict with main_trace_commitments, after_challenge_commitments,

quotient_commitment from the test vector (pre-extracted canonical values)

Reference:

crates/test-vectors/src/lib.rs (struct E2eProofVectors)

protocol.proof.serialize_proof_json(proof: Proof) dict[source]#

Serialize a Proof to serde-compatible JSON dict.

Converts canonical field elements back to Montgomery form and uses the exact JSON structure produced by Rust’s serde_json.