Why
TrustedSetupProvider::with_unsafe_srs regenerates the unsafe SRS on every call even though it already writes it into the content-keyed test cache, so every build_for_test pays minutes of SRS generation that the cache should absorb.
This is the highest leverage optimization of #3405 (SRS reuse alone measured at 75 to 61 minutes nightly in PR #3345).
What
Reuse the SRS file already persisted under target/mithril-circuit-test-cache so SRS generation is paid once per machine and per fingerprint, for both SnarkProverSetup::build_for_test and IvcSnarkProverSetup::build_for_test.
How
Why
TrustedSetupProvider::with_unsafe_srsregenerates the unsafe SRS on every call even though it already writes it into the content-keyed test cache, so everybuild_for_testpays minutes of SRS generation that the cache should absorb.This is the highest leverage optimization of #3405 (SRS reuse alone measured at 75 to 61 minutes nightly in PR #3345).
What
Reuse the SRS file already persisted under
target/mithril-circuit-test-cacheso SRS generation is paid once per machine and per fingerprint, for bothSnarkProverSetup::build_for_testandIvcSnarkProverSetup::build_for_test.How
with_unsafe_srs: when the SRS file exists use itFile::createwrite with the temp-plus-rename pattern already used bystore_srs_bytes_to_fileParamsKZG::downsize(Lagrange basis recomputation) costs about 3x the k=20 SRS generation and is paid on every setup load, warm or coldbuild_for_testconstructors hit the cache on a warm second run