Skip to main content

SoundnessCalculator

Struct SoundnessCalculator 

Source
pub struct SoundnessCalculator {
    pub logup_bits: f64,
    pub gkr_sumcheck_bits: f64,
    pub gkr_batching_bits: f64,
    pub zerocheck_sumcheck_bits: f64,
    pub constraint_batching_bits: f64,
    pub stacked_reduction_bits: f64,
    pub whir_bits: f64,
    pub whir_details: WhirSoundnessCalculator,
    pub total_bits: f64,
}

Fields§

§logup_bits: f64

Security bits from LogUp α/β sampling and PoW.

§gkr_sumcheck_bits: f64

Security bits from ordinary GKR sumcheck rounds.

§gkr_batching_bits: f64

Security bits from GKR μ/λ batching per layer.

§zerocheck_sumcheck_bits: f64

Security bits from ZeroCheck sumcheck after the fused input-layer boundary.

§constraint_batching_bits: f64

Security bits from the fused GKR/ZeroCheck input boundary and constraint batching.

§stacked_reduction_bits: f64

Security bits from stacked reduction sumcheck.

§whir_bits: f64

Security bits from WHIR (minimum across all rounds and error sources).

§whir_details: WhirSoundnessCalculator

Detailed WHIR soundness breakdown.

§total_bits: f64

Total security bits (minimum of all components).

Implementations§

Source§

impl SoundnessCalculator

Source

pub fn calculate( params: &SystemParams, base_field_order: f64, challenge_field_bits: f64, max_num_constraints_per_air: usize, num_airs: usize, max_constraint_degree: usize, max_log_trace_height: usize, num_trace_columns: usize, num_stacked_columns: usize, n_logup: usize, ) -> Self

Calculates soundness for the given system parameters.

§Arguments
  • params - System parameters including WHIR config and LogUp parameters.
  • base_field_order - Order p of the base field that sample_bits reduces. For BabyBear: 2^31 - 2^27 + 1. Used to charge the sample_bits sampling bias (query bad-set argument and proof-of-work).
  • challenge_field_bits - Bits in the challenge field. For BabyBear4: ~124 bits.
  • max_num_constraints_per_air - Maximum constraints in any single AIR.
  • num_airs - Number of AIRs being batched.
  • max_constraint_degree - Maximum degree of any constraint polynomial.
  • max_log_trace_height - Maximum log₂(trace height) across all AIRs.
  • num_trace_columns - Total columns batched in stacked reduction.
  • num_stacked_columns - Total columns across all commitments (for WHIR μ batching).
  • n_logup - GKR depth (log₂ of total interactions), or 0 if no interactions.
  • proximity_regime - Unique decoding or other regimes (for WHIR-related calculations).
Source

pub fn logup_soundness( max_interaction_count: u32, log_max_message_length: u32, challenge_field_bits: f64, log2_list_size: f64, ) -> f64

LogUp soundness from α/β sampling (before proof-of-work grinding).

  • α: Random evaluation point to test whether Σ p(y)/q(y) = 0. If interactions are unbalanced, the sum is a non-zero rational function with a bounded number of roots. By Schwartz-Zippel, a random α detects this with high probability.
  • β: Random challenge for compressing interaction messages into field elements. Degeneracy would allow distinct message tuples to collide.

Security = |F_ext| - log₂(2 × max_interaction_count) - log_max_message_length - log₂(L_PCS)

Proof-of-work grinding is an orthogonal amplification that callers add on top via Self::effective_pow_bits. This is the single source of truth for the formula; SDK parameter selection calibrates against it.

Reference: Section 4 of docs/Soundness_of_Interactions_via_LogUp.pdf

Source

pub fn whir_proximity_gap_security( proximity_regime: ProximityRegime, challenge_field_bits: f64, log_degree: usize, log_inv_rate: usize, batch_size: usize, ) -> ProximityGapSecurity

Computes WHIR proximity gap security bits.

Per WHIR paper: err*(C, ℓ, δ) = (ℓ - 1) · 2^m / (ρ · |F|)

  • UniqueDecoding: Security bits = |F_ext| - log₂(ℓ - 1) - log₂(degree) - log₂(1/rate)
  • ListDecoding { m }: Uses BCHKS25/TR25-169 Theorem 1.5 (contrapositive) to bound the “bad z set” size by a, with Haböck’s global extension introducing a linear factor (ℓ - 1).
Source§

impl SoundnessCalculator

Source

pub fn calculate_from_vk<SC: StarkProtocolConfig>( vk: &MultiStarkVerifyingKey<SC>, ) -> Self

Computes a conservative soundness estimate for the verifier defined by the given vk.

The verifying key does not fix a single proof shape: optional AIRs may be absent and trace heights can vary within verifier-enforced bounds. This function therefore uses verifier-side upper bounds derived from the key.

Trait Implementations§

Source§

impl Clone for SoundnessCalculator

Source§

fn clone(&self) -> SoundnessCalculator

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SoundnessCalculator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more