fix: make PCZT trial decryption generic over MemoSize#6
Merged
Conversation
OrchardDomain::for_pczt_action and the ShieldedOutput impl for pczt::Action were pinned to ZcashMemo, so a pczt::Bundle<DashMemo> built via Builder::<DashMemo>::build_for_pczt had no supported trial-decryption path: a Signer could not verify the outputs it was asked to authorize, and orphan rules prevent downstream crates from adding the impl themselves. Generalize both over M: MemoSize, delegate for_pczt_action to for_nullifier instead of duplicating its body, and add a regression test that trial-decrypts a DashMemo PCZT output end-to-end. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesGeneric PCZT action decryption
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant Test
participant OrchardDomain
participant PcztAction as "pczt::Action<M>"
Test->>OrchardDomain: for_pczt_action(&PcztAction)
OrchardDomain->>PcztAction: ephemeral_key(), cmstar()
OrchardDomain->>PcztAction: enc_ciphertext()
PcztAction-->>OrchardDomain: Option<&M::NoteCiphertextBytes>
OrchardDomain-->>Test: decrypted note value, address, memo
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Jul 2, 2026
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
OrchardDomain::for_pczt_actionandimpl ShieldedOutput<OrchardDomain<ZcashMemo>> for pczt::Actionwere pinned toZcashMemo, even thoughpczt::Bundle/Action/OutputandBuilder::build_for_pcztare generic overM: MemoSize(feat: make memo size generic via MemoSize trait #1)pczt::Bundle<DashMemo>had no supported trial-decryption path: a PCZT Signer could not verify the outputs it was being asked to authorize (try_note_decryption(&OrchardDomain::for_pczt_action(action), ...)did not compile forM = DashMemo), and because both the trait and the types live in this crate, orphan rules prevent downstream crates from adding the impl themselvesM: MemoSizeChanges
OrchardDomain::for_pczt_actionmoved into the genericimpl<M: MemoSize> OrchardDomain<M>block, taking&pczt::Action<M>; now delegates tofor_nullifierinstead of duplicating its bodyimpl<M: MemoSize> ShieldedOutput<OrchardDomain<M>> for pczt::Action<M>replaces the ZcashMemo-only impl;enc_ciphertextreturnsOption<&M::NoteCiphertextBytes>pczt_trial_decryption_is_memo_size_generic: builds apczt::Bundle<DashMemo>viaBuilder::<DashMemo>::build_for_pczt, trial-decrypts the output throughfor_pczt_action, and checks note value, recipient address, and the 36-byte memo round-tripNo behavior change for
ZcashMemousers — the generic impls subsume the old pinned ones.Test plan
cargo test --lib pczt— 6 passed (including the full proving PCZT role tests and the new regression test)cargo check --all-featurescargo clippy --all-featurescleancargo fmt -- --check🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests