SP
perf: cache Dory test setup via LazyLock
spaceandtimefdn/sxt-proof-of-sql#1136

Caches Dory test setups (PublicParameters, VerifierSetup, ProverSetup) via LazyLock so they’re initialized once per test binary instead of once per test function.

The test suite was calling PublicParameters::test_rand with the same deterministic seed ~53 times and VerifierSetup::from ~47 times. Each call does BLS12-381 pairing operations and produces identical output every time. This gets rid of that.

New module test_dory_setup_cache.rs provides cached_public_parameters(nu), cached_verifier_setup(nu), and cached_prover_setup(nu) for nu values 2-6. Uses Box::leak to get &'static PublicParameters so ProverSetup<'static> can live in a LazyLock.

17 files changed across the dory module and e2e planner tests. Tests that intentionally use mismatched setups (e.g. we_fail_to_verify_*_when_the_setups_differ) are left as-is.

A few things I left alone:

  • No [profile.test] optimization level changes (#610 already did that)
  • Tests that need the RNG to advance past PublicParameters::test_rand still call it as a no-op so subsequent random vector generation stays deterministic
  • fold_scalars_test.rs uses nu=0 which isn’t worth caching

All 171 dory tests pass, all 13 e2e planner tests pass, no new clippy warnings.

Closes #557

/claim #557

Claim

Total prize pool $100
Total paid $0
Status Pending
Submitted February 14, 2026
Last updated February 14, 2026

Contributors

NE

Nenad Ilic

@nenadilic84

100%

Sponsors

SP

Space and Time

@spaceandtimelabs

$100