Skip to content

Add Zcash memo support to Rust SDK and CLI#276

Open
tzarebczan wants to merge 1 commit into
Near-One:mainfrom
tzarebczan:feat/zcash-memo-support
Open

Add Zcash memo support to Rust SDK and CLI#276
tzarebczan wants to merge 1 commit into
Near-One:mainfrom
tzarebczan:feat/zcash-memo-support

Conversation

@tzarebczan
Copy link
Copy Markdown

@tzarebczan tzarebczan commented May 11, 2026

Package: Zcash memo support

This is the Rust SDK / CLI half of a coordinated two-repo package for Zcash memo support.

Companion PR: Near-One/bridge-sdk-js#470

Summary

Adds an explicit Zcash-only memo path for NEAR-to-Zcash withdrawals while keeping the existing shared BTC/Zcash commands unchanged for users who do not need memo support.

The implementation is additive:

  • Adds near-submit-zcash-transfer with optional --memo.
  • Adds internal init-near-to-zcash-transfer with optional --memo.
  • Adds SDK wrapper methods that preserve existing public method signatures and route None through the existing behavior.
  • Embeds the memo only when the destination resolves to an Orchard shielded output.
  • Leaves transparent Zcash recipients and Bitcoin paths without memo behavior.

Details

The memo is encoded through zcash_protocol::memo::Memo::from_str(...).encode() before being passed into add_orchard_output, matching the Zcash crate's canonical ZIP-302 text memo path. None still uses MemoBytes::empty(), and an empty string follows the crate's canonical empty memo encoding.

This PR also adapts memo propagation to the current upstream random UTXO selection code, so the selected inputs used for Orchard bundle construction remain the upstream selection.selected result.

Cargo.lock includes the local package version sync from the current upstream manifests (bridge-cli 0.3.52 and omni-connector 0.3.15). This was generated by cargo after rebasing onto the latest upstream base.

Relationship to JS PR

The JS companion PR adds the consumer-facing destinationMemo type and validates the 512-byte UTF-8 memo boundary before callers hand the value to the Rust-backed Zcash transfer flow.

Together, the two PRs make Zcash memo support available end-to-end while keeping existing BTC and shared BTC/Zcash paths unchanged.

CLI surface

Existing shared path remains unchanged and does not mention memo:

bridge-cli.exe testnet near-submit-btc-transfer --help
# no --memo option

New Zcash-specific paths expose memo explicitly:

bridge-cli.exe testnet near-submit-zcash-transfer --help
# -m, --memo <MEMO>

bridge-cli.exe testnet internal init-near-to-zcash-transfer --help
# -m, --memo <MEMO>

Validation

  • cargo fmt --check --manifest-path bridge-cli/Cargo.toml
  • cargo fmt --check --manifest-path bridge-sdk/connectors/omni-connector/Cargo.toml
  • cargo test --manifest-path bridge-sdk/connectors/omni-connector/Cargo.toml
  • cargo check --manifest-path bridge-cli/Cargo.toml
  • cargo build --release --manifest-path bridge-cli/Cargo.toml
  • Verified release CLI help output for:
    • near-submit-btc-transfer
    • near-submit-zcash-transfer
    • internal init-near-to-zcash-transfer

Notes

On this Windows checkout, the debug CLI binary currently stack-overflows while rendering clap help before any command runs. The release binary renders help successfully, and all compile/test checks above pass.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@tzarebczan tzarebczan force-pushed the feat/zcash-memo-support branch 2 times, most recently from 8b8aa3c to 1963078 Compare May 18, 2026 13:13
@tzarebczan tzarebczan force-pushed the feat/zcash-memo-support branch from 1963078 to 368de13 Compare May 20, 2026 13:04
@tzarebczan tzarebczan requested a review from a team as a code owner May 20, 2026 13:04
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