orchard 0.15.4 release: Accelerate batched trial decryption with GLV endomorphism windows - #539
Conversation
173b7b7 to
c28e811
Compare
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
2bbebf6 to
a22ff95
Compare
2bbebf6 to
b23b643
Compare
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>
b23b643 to
a7a974c
Compare
ebfull
left a comment
There was a problem hiding this comment.
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!
| /// | ||
| /// 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 |
There was a problem hiding this comment.
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.
| /// identical shared secrets. | ||
| #[derive(Clone, Debug)] | ||
| enum PreparedEpkInner { | ||
| /// A `group::Wnaf` window table. |
There was a problem hiding this comment.
Perhaps another opportunity to crosslink, which helps prevent bitrot.
|
|
a7a974c to
5bbbcd4
Compare
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 inlineendomodule. Same feature and the same byte-exact results — cleaner layering, with GLV living inpasta_curvesand 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_tabledbuilds every ephemeral key's window viaTable::batch(one shared normalization across the whole batch).batch_ka_agree_decdecomposes each viewing key once viaDecomposed::newand reuses it against every ephemeral key's window, through theBatchDomain::batch_ka_agree_dechook added inzcash_note_encryption0.4.2.The per-output entry points (
try_note_decryptionetc.) are untouched. There are no public API changes;src/endo.rsis removed (its GLV moved topasta_curves).Correctness
Shared secrets are byte-identical to the per-item path.
note_encryption'sbatched_agreement_matches_per_itemandbatched_compact_decryption_matches_per_item_{orchard,ironwood}pin this for bothOrchardDomainandIronwoodDomainover hit / miss / undecodable lanes; the full existing suite passes. The GLV KATs and proptests now live inpasta_curves::glv.Stack
glvmodule)batch_ka_agree_decOriginal work by @LukasKorba (#530).
Filed with Claude Code assistance.