fix: cache uncompressed CRS after first decompression#22002
Merged
Conversation
ludamad
approved these changes
Mar 25, 2026
64211ff to
ebd7c0b
Compare
ebd7c0b to
bfec44a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
C++ native (
get_bn254_crs.cpp): Check for cachedbn254_g1.dat(uncompressed) first. On cache miss, decompress frombn254_g1_compressed.datand write the uncompressed cache. On download, cache both compressed and uncompressed.C++ WASM (
bbapi_srs.hpp/cpp):srsInitSrsauto-detects input format (32B vs 64B per point). When decompressing compressed input, it returns the uncompressed bytes in the response so the caller can cache them.Browser (
cached_net_crs.ts): Check IndexedDB for uncompressedg1Datafirst. AddcacheUncompressed()to persist after first decompression.Node.js (
crs/node/index.ts): Checkbn254_g1.datfirst, fall back tobn254_g1_compressed.dat. AddcacheUncompressed()to write uncompressed file.Wiring (
barretenberg/index.ts):initSRSChonkcaptures thesrsInitSrsresponse and callscrs.cacheUncompressed()when uncompressed bytes are returned.Test plan
bbwith only compressed CRS on disk, verify it createsbn254_g1.datand uses it on second run./scripts/run_test.sh bbapi/exception_handling.test.jspasses (schema change)./scripts/run_test.sh barretenberg/blake2s.test.jspasses (skipSrsInit)