Skip to main content

setup

Function setup 

Source
pub fn setup<E: PairingCurve, R: RngCore>(
    rng: &mut R,
    max_log_n: usize,
) -> (ProverSetup<E>, VerifierSetup<E>)
Expand description

Generate or load prover and verifier setups from disk

Creates or loads the transparent setup parameters for Dory PCS. First attempts to load from disk; if not found, generates new setup and saves to disk.

Supports polynomials up to 2^max_log_n coefficients arranged as 2^ν × 2^σ matrices where ν + σ = max_log_n and ν ≤ σ (flexible matrix layouts including square and non-square).

Setup file location (OS-dependent):

  • Linux: ~/.cache/dory/dory_{max_log_n}.urs
  • macOS: ~/Library/Caches/dory/dory_{max_log_n}.urs
  • Windows: {FOLDERID_LocalAppData}\dory\dory_{max_log_n}.urs

§Parameters

  • rng: Random number generator for setup generation (used only if not found on disk)
  • max_log_n: Maximum log₂ of polynomial size

§Returns

(ProverSetup, VerifierSetup) - Setup parameters for proving and verification

§Performance

To enable prepared point caching (~20-30% speedup), use the cache feature and call init_cache(&prover_setup.g1_vec, &prover_setup.g2_vec) after setup.

§Panics

Panics if the setup file exists on disk but is corrupted or cannot be deserialized.