Add Zcash memo support to Rust SDK and CLI#276
Open
tzarebczan wants to merge 1 commit into
Open
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
8b8aa3c to
1963078
Compare
1963078 to
368de13
Compare
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.
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:
near-submit-zcash-transferwith optional--memo.init-near-to-zcash-transferwith optional--memo.Nonethrough the existing behavior.Details
The memo is encoded through
zcash_protocol::memo::Memo::from_str(...).encode()before being passed intoadd_orchard_output, matching the Zcash crate's canonical ZIP-302 text memo path.Nonestill usesMemoBytes::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.selectedresult.Cargo.lockincludes the local package version sync from the current upstream manifests (bridge-cli0.3.52 andomni-connector0.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
destinationMemotype 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:
New Zcash-specific paths expose memo explicitly:
Validation
cargo fmt --check --manifest-path bridge-cli/Cargo.tomlcargo fmt --check --manifest-path bridge-sdk/connectors/omni-connector/Cargo.tomlcargo test --manifest-path bridge-sdk/connectors/omni-connector/Cargo.tomlcargo check --manifest-path bridge-cli/Cargo.tomlcargo build --release --manifest-path bridge-cli/Cargo.tomlnear-submit-btc-transfernear-submit-zcash-transferinternal init-near-to-zcash-transferNotes
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.