Skip to content

zcash_client_backend: rename and restructure Recipient::InternalAccount / BuildRecipient#2596

Merged
nuttycom merged 2 commits into
mainfrom
refactor/recipient-variant-naming
Jul 10, 2026
Merged

zcash_client_backend: rename and restructure Recipient::InternalAccount / BuildRecipient#2596
nuttycom merged 2 commits into
mainfrom
refactor/recipient-variant-naming

Conversation

@schell

@schell schell commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Resolves #2595.

Two commits:

  1. Renames zcash_client_backend::wallet::Recipient::InternalAccount (and its
    BuildRecipient/PcztRecipient mirrors) to InternalShielded, for symmetry with
    Recipient::InternalTransparent. The prior name did not communicate the actual
    distinction between the two internal variants — payload domain (shielded note vs.
    transparent address), not some special relationship to "the account". The
    Recipient enum doc comments are expanded to spell out the two independent axes the
    variants vary along. This is a public, semver-breaking rename; a Changed entry is
    added to the unreleased section of zcash_client_backend/CHANGELOG.md.
    PcztRecipient's variant order (and thus its postcard encoding within a PCZT) is
    unchanged.

  2. Splits the private BuildRecipient type into ShieldedBuildRecipient and
    TransparentBuildRecipient, matching the two functions that previously consumed a
    single BuildRecipient with two unreachable!() arms apiece
    (into_recipient_with_note, used only for shielded outputs where a decrypted Note
    is available; into_recipient_with_outpoint, used only for transparent outputs
    where an OutPoint is available). Each split type carries only the variants
    relevant to its domain, and each has a single into_recipient method that is a
    total function. PcztRecipient::from_recipient is likewise split. This is a
    private, internal-only change with no effect on the public API.

Both follow from review discussion on #2550:
#2550 (comment)

Verification

  • cargo fmt --all -- --check
  • cargo clippy --all-features --all-targets -- -D warnings (workspace)
  • cargo check -p zcash_client_backend with --all-features, --no-default-features,
    --features transparent-inputs, --features orchard
  • cargo test --workspace --all-features (all green, no failures)
  • cargo doc --no-deps --workspace --all-features --document-private-items (nightly):
    no new warnings (4 pre-existing warnings, unrelated to this change)
  • Verified commit 1 builds standalone

Co-Authored-By: Claude noreply@anthropic.com

schell and others added 2 commits July 10, 2026 13:12
…ielded

Rename `Recipient::InternalAccount` (and the `BuildRecipient`/`PcztRecipient`
mirrors) to `InternalShielded`, for symmetry with `Recipient::InternalTransparent`.
The prior name did not communicate the actual distinction between the two
internal variants, which is payload domain (shielded note vs. transparent
address) rather than any special relationship to "the account" — as noted in
review of #2550: #2595

The enum-level and per-variant doc comments on `Recipient` are expanded to
spell out the two independent axes the variants vary along (relationship to
the wallet, and payload domain).

`PcztRecipient`'s variant order (and thus its postcard encoding) is
unchanged; only the variant name changes for that private mirror type.

Co-Authored-By: Claude <noreply@anthropic.com>
Split the private BuildRecipient type into ShieldedBuildRecipient and
TransparentBuildRecipient, matching the two functions that previously
consumed a single BuildRecipient with two unreachable!() arms apiece
(into_recipient_with_note, used only for shielded outputs where a decrypted
Note is available; into_recipient_with_outpoint, used only for transparent
outputs where an OutPoint is available). Each split type now carries only
the variants relevant to its domain, and each has a single into_recipient
method that is a total function over its variants.

PcztRecipient::from_recipient is likewise split into
from_shielded_recipient and from_transparent_recipient.

When the transparent-inputs feature is disabled, TransparentBuildRecipient
has only its (always-present) External variant, which does not reference
AccountId; a never-constructed Unconstructible(PhantomData<AccountId>,
Infallible) variant keeps AccountId a used type parameter in that
configuration, while letting the exhaustiveness of matches on the type be
proven by the compiler (`match absurd {}`) rather than asserted at runtime.

This is a private, internal-only change with no effect on the public API.

Follow-up from #2595

Co-Authored-By: Claude <noreply@anthropic.com>
@schell
schell requested a review from nullcopy July 10, 2026 02:26

@nuttycom nuttycom 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.

utACK e53d979

@nuttycom
nuttycom merged commit 339234f into main Jul 10, 2026
49 checks passed
@nuttycom
nuttycom deleted the refactor/recipient-variant-naming branch July 10, 2026 09:51
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.

zcash_client_backend: Revisit the naming and delineation of Recipient::InternalTransparent vs. Recipient::InternalAccount

2 participants