Skip to main content

init_cache

Function init_cache 

Source
pub fn init_cache(g1_vec: &[ArkG1], g2_vec: &[ArkG2])
Expand description

Initialize the global cache with G1 and G2 vectors.

This function implements smart re-initialization:

  • If the cache doesn’t exist, it creates one
  • If the cache exists but is too small, it replaces it with a larger one
  • If the cache exists and is large enough, it does nothing (reuses existing)

This allows multiple proofs with different setup sizes to run in the same process.

§Arguments

  • g1_vec - Vector of G1 points to prepare and cache
  • g2_vec - Vector of G2 points to prepare and cache

§Panics

Panics if the internal RwLock is poisoned.

§Example

use dory_pcs::backends::arkworks::{init_cache, BN254};
use dory_pcs::setup::ProverSetup;

let setup = ProverSetup::<BN254>::new(max_log_n);
init_cache(&setup.g1_vec, &setup.g2_vec);