Skip to content

Implement ZIP 302 structured memos#668

Draft
str4d wants to merge 2 commits intozcash:mainfrom
str4d:structured-memo-types
Draft

Implement ZIP 302 structured memos#668
str4d wants to merge 2 commits intozcash:mainfrom
str4d:structured-memo-types

Conversation

@str4d
Copy link
Copy Markdown
Contributor

@str4d str4d commented Oct 6, 2022

Implements zcash/zips#638.

Closes #2234.
Closes COR-1121.

@str4d
Copy link
Copy Markdown
Contributor Author

str4d commented Oct 6, 2022

Force-pushed to fix a bug and CI lints.

Comment on lines +11 to +12
/// A Sapling return address.
ReturnAddress(PaymentAddress),
Copy link
Copy Markdown
Contributor Author

@str4d str4d Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC I copied this type code from some existing implementation of structured memos. It was Sapling-specific then, but we can easily expand its definition to be any valid recipient address encoding.

Note that this uses a byte encoding rather than a string encoding for more efficient packing, so we may need to consider how this interacts with Unified Addresses (which now exist). We don't need to serialize the network of the address, as that is implicit in the transaction (via the chain in which it is mined), so can just be provided by the caller if they want to take the address and encode it as a string.

@nuttycom nuttycom self-requested a review October 6, 2022 19:18
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 6, 2022

Codecov Report

❌ Patch coverage is 24.60317% with 95 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.59%. Comparing base (32f8ad9) to head (3114723).
⚠️ Report is 419 commits behind head on main.

Files with missing lines Patch % Lines
components/zcash_protocol/src/memo/structured.rs 29.89% 68 Missing ⚠️
components/zcash_protocol/src/memo/builder.rs 0.00% 18 Missing ⚠️
components/zcash_protocol/src/memo.rs 18.18% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #668      +/-   ##
==========================================
- Coverage   58.74%   58.59%   -0.16%     
==========================================
  Files         208      210       +2     
  Lines       27748    27873     +125     
==========================================
+ Hits        16300    16331      +31     
- Misses      11448    11542      +94     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@str4d str4d added the C-zip-impl Category: An implementation of a ZIP, or a request to do so label Jun 17, 2024
@str4d str4d force-pushed the structured-memo-types branch from e7a12ea to 3114723 Compare October 17, 2025 23:09
@str4d
Copy link
Copy Markdown
Contributor Author

str4d commented Oct 17, 2025

Rebased on main. This PR still needs to be rewritten to match what is proposed in zcash/zips#638 (written a year ago but decided upon three years ago, three years after this PR was first implemented).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-zip-impl Category: An implementation of a ZIP, or a request to do so

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Implement ZIP 302 structured memos

2 participants