Skip to content

orchard 0.15.4 release: Accelerate batched trial decryption with GLV endomorphism windows - #539

Merged
nuttycom merged 2 commits into
mainfrom
batched-trial-decryption-glv
Jul 23, 2026
Merged

orchard 0.15.4 release: Accelerate batched trial decryption with GLV endomorphism windows#539
nuttycom merged 2 commits into
mainfrom
batched-trial-decryption-glv

Conversation

@nuttycom

@nuttycom nuttycom commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Supersedes #530: rebased onto main (0.15.3) and reworked to consume the GLV primitive from zcash/pasta_curves#93 (pasta_curves::glv) instead of a self-contained inline endo module. Same feature and the same byte-exact results — cleaner layering, with GLV living in pasta_curves and orchard as a thin consumer.

What changes

The GLV primitive — batched odd-multiples windows built with a single shared inversion, per-scalar decomposition + wNAF recoding, and the shared-doubling Straus ladder — now lives in pasta_curves::glv (Table / Decomposed / Table::mul_decomposed). orchard consumes it in the batched pipeline:

  • PreparedEphemeralPublicKey::batch_tabled builds every ephemeral key's window via Table::batch (one shared normalization across the whole batch).
  • batch_ka_agree_dec decomposes each viewing key once via Decomposed::new and reuses it against every ephemeral key's window, through the BatchDomain::batch_ka_agree_dec hook added in zcash_note_encryption 0.4.2.

The per-output entry points (try_note_decryption etc.) are untouched. There are no public API changes; src/endo.rs is removed (its GLV moved to pasta_curves).

Correctness

Shared secrets are byte-identical to the per-item path. note_encryption's batched_agreement_matches_per_item and batched_compact_decryption_matches_per_item_{orchard,ironwood} pin this for both OrchardDomain and IronwoodDomain over hit / miss / undecodable lanes; the full existing suite passes. The GLV KATs and proptests now live in pasta_curves::glv.

Stack

  • pasta_curves 0.5.2 (the glv module)
  • zcash_note_encryption 0.4.2batch_ka_agree_dec

Original work by @LukasKorba (#530).


Filed with Claude Code assistance.

@nuttycom
nuttycom force-pushed the batched-trial-decryption-glv branch from 173b7b7 to c28e811 Compare July 22, 2026 03:09
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.92%. Comparing base (7e90bf2) to head (c28e811).
⚠️ Report is 154 commits behind head on main.

Files with missing lines Patch % Lines
src/keys.rs 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #539      +/-   ##
==========================================
+ Coverage   77.74%   82.92%   +5.18%     
==========================================
  Files          39       24      -15     
  Lines        3509     3046     -463     
==========================================
- Hits         2728     2526     -202     
+ Misses        781      520     -261     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nuttycom
nuttycom force-pushed the batched-trial-decryption-glv branch 2 times, most recently from 2bbebf6 to a22ff95 Compare July 22, 2026 15:53
Comment thread Cargo.toml Outdated
@nuttycom
nuttycom force-pushed the batched-trial-decryption-glv branch 2 times, most recently from 2bbebf6 to b23b643 Compare July 23, 2026 03:03
@nuttycom
nuttycom marked this pull request as ready for review July 23, 2026 05:17
@nuttycom
nuttycom marked this pull request as draft July 23, 2026 13:38
Batched trial decryption is the hot loop of light-client scanning: every
compact output's ephemeral key is multiplied by each of the wallet's incoming
viewing keys. This accelerates that loop using the Pallas cube-root
endomorphism.

The GLV primitive — batched odd-multiples windows built with a single shared
inversion, per-scalar decomposition + wNAF recoding, and the shared-doubling
Straus ladder — lives in `pasta_curves::glv` (`Table` / `Decomposed` /
`Table::mul_decomposed`). orchard consumes it in the batched pipeline:

- `batch_epk` builds every ephemeral key's window via `Table::batch` (one
  shared normalization across the whole batch).
- `batch_ka_agree_dec` decomposes each viewing key once via `Decomposed::new`
  and reuses it against every ephemeral key's window, through the
  `BatchDomain::batch_ka_agree_dec` hook added in zcash_note_encryption 0.4.2.

The per-output entry points (`try_note_decryption` etc.) are untouched. Shared
secrets are byte-identical to the per-item path (the batched-equality tests in
`note_encryption` pin this for both OrchardDomain and IronwoodDomain). No public
API changes. The minimum zcash_note_encryption version becomes 0.4.2.

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nuttycom
nuttycom force-pushed the batched-trial-decryption-glv branch from b23b643 to a7a974c Compare July 23, 2026 16:00
@nuttycom
nuttycom marked this pull request as ready for review July 23, 2026 16:01
@nuttycom nuttycom changed the title Accelerate batched trial decryption with GLV endomorphism windows orchard 0.15.4: Accelerate batched trial decryption with GLV endomorphism windows Jul 23, 2026
ebfull
ebfull previously approved these changes Jul 23, 2026

@ebfull ebfull left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Details of the underlying mechanism and pasta_curves APIs don't really need to be exposed in the documentation, but I don't see anything wrong here!

Comment thread src/keys.rs
///
/// Individually-prepared keys carry a `group::Wnaf` window table, consumed by
/// the per-item multiplication. Batch-prepared keys carry a GLV odd-multiples
/// window instead (see `pasta_curves::glv`), which is cheaper to build across a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could crosslink to the module here (and in some other places) instead of just mentioning it, especially to avoid bitrot. Alternatively, don't even discuss GLV in user-facing docs.

Comment thread src/keys.rs
/// identical shared secrets.
#[derive(Clone, Debug)]
enum PreparedEpkInner {
/// A `group::Wnaf` window table.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps another opportunity to crosslink, which helps prevent bitrot.

@ebfull

ebfull commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

This PR title ideally wouldn't contain the version number of Orchard that we might speculate it would be merged into. Nevermind, we're releasing from this branch.

@ebfull ebfull changed the title orchard 0.15.4: Accelerate batched trial decryption with GLV endomorphism windows Accelerate batched trial decryption with GLV endomorphism windows Jul 23, 2026
@ebfull ebfull changed the title Accelerate batched trial decryption with GLV endomorphism windows orchard 0.15.3 release: Accelerate batched trial decryption with GLV endomorphism windows Jul 23, 2026
@nuttycom
nuttycom force-pushed the batched-trial-decryption-glv branch from a7a974c to 5bbbcd4 Compare July 23, 2026 16:35
@nuttycom
nuttycom merged commit 9d07047 into main Jul 23, 2026
20 checks passed
@nuttycom nuttycom changed the title orchard 0.15.3 release: Accelerate batched trial decryption with GLV endomorphism windows orchard 0.15.4 release: Accelerate batched trial decryption with GLV endomorphism windows Jul 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.

4 participants