Skip to content

perf(recursion): use inline Blake2b-256 for transcript#1232

Closed
quangvdao wants to merge 2 commits intoa16z:mainfrom
quangvdao:quang/inlines-for-transcript
Closed

perf(recursion): use inline Blake2b-256 for transcript#1232
quangvdao wants to merge 2 commits intoa16z:mainfrom
quangvdao:quang/inlines-for-transcript

Conversation

@quangvdao
Copy link
Copy Markdown
Contributor

Summary

Use Jolt’s Blake2 inline implementation for the Fiat–Shamir transcript in non-host (recursion/guest-verifier) builds to reduce zkVM cycle counts.

Key Changes

  • Add a Blake2b-256 hasher to jolt-inlines-blake2 (output-length parameterized to 32 bytes; not truncation).
  • Switch Blake2bTranscript to use the inline Blake2b-256 backend when feature = \"host\" is disabled.
  • Wire jolt-core minimal feature to include jolt-inlines-blake2, with target-specific dependency features so it compiles on non-RISC-V while emitting the custom instruction on RISC-V.

Testing

  • cargo fmt --all
  • cargo test -p jolt-inlines-blake2 --features host
  • cargo test -p jolt-core
  • cargo test -p jolt-core --no-default-features --features minimal
  • cargo clippy -p jolt-inlines-blake2 --all-targets --features host
  • cargo clippy -p jolt-core --all-targets
  • cargo clippy -p jolt-core --no-default-features --features minimal --lib --tests

Review Guidance

  • The transcript algorithm is unchanged (still Blake2b-256); only the hashing backend changes for recursion builds.
  • Focus on feature gating (host vs minimal) and ensuring equivalence between the inline and reference implementations.

Add a Blake2b-256 hasher to jolt-inlines and wire jolt-core's non-host (minimal) transcript to use it, reducing cycle counts in recursive verification.
Factor shared streaming/hash logic into a const-generic internal Blake2b implementation and keep Blake2b/Blake2b256 as thin wrappers.
@quangvdao quangvdao closed this Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant