p3_batch_stark/proof.rs
1use alloc::vec::Vec;
2
3use p3_lookup::lookup_traits::LookupData;
4use p3_uni_stark::OpenedValues;
5use serde::{Deserialize, Serialize};
6
7use crate::config::{Challenge, Commitment, PcsProof, StarkGenericConfig};
8
9/// A proof of batched STARK instances.
10#[derive(Serialize, Deserialize)]
11#[serde(bound = "")]
12pub struct BatchProof<SC: StarkGenericConfig> {
13 /// Commitments to all trace and quotient polynomials.
14 pub commitments: BatchCommitments<Commitment<SC>>,
15 /// Opened values at the out-of-domain point for all instances.
16 pub opened_values: BatchOpenedValues<Challenge<SC>>,
17 /// PCS opening proof for all commitments.
18 pub opening_proof: PcsProof<SC>,
19 /// Data necessary to verify the global lookup arguments across all instances.
20 pub global_lookup_data: Vec<Vec<LookupData<Challenge<SC>>>>,
21 /// Per-instance log2 of the extended trace domain size.
22 /// For instance i, this stores `log2(|extended trace domain|) = log2(N_i) + is_zk()`.
23 pub degree_bits: Vec<usize>,
24}
25
26/// Commitments for a batch-STARK proof.
27#[derive(Debug, Serialize, Deserialize)]
28pub struct BatchCommitments<Com> {
29 /// Commitment to all main trace matrices (one per instance).
30 pub main: Com,
31 /// Commitment to all permutation polynomials (one per instance).
32 pub permutation: Option<Com>,
33 /// Commitment to all quotient polynomial chunks (across all instances).
34 pub quotient_chunks: Com,
35 /// Commitment to all randomization polynomials (one per instance, if ZK is enabled).
36 pub random: Option<Com>,
37}
38
39/// Opened values for a single instance in a batch-STARK proof, including lookup-related values.
40#[derive(Debug, Serialize, Deserialize)]
41pub struct OpenedValuesWithLookups<Challenge> {
42 /// Standard opened values (trace and quotient).
43 pub base_opened_values: OpenedValues<Challenge>,
44 /// Opened values for the permutation polynomials at the challenge `zeta`.
45 pub permutation_local: Vec<Challenge>,
46 /// Opened values for the permutation polynomials at the next row `g * zeta`.
47 pub permutation_next: Vec<Challenge>,
48}
49
50/// Opened values for all instances in a batch-STARK proof.
51#[derive(Debug, Serialize, Deserialize)]
52pub struct BatchOpenedValues<Challenge> {
53 /// Opened values for each instance, in the same order as provided to the prover.
54 pub instances: Vec<OpenedValuesWithLookups<Challenge>>,
55}