Skip to content

ZIP 302: Structured memos#638

Draft
str4d wants to merge 5 commits into
mainfrom
zip302-structured-memos
Draft

ZIP 302: Structured memos#638
str4d wants to merge 5 commits into
mainfrom
zip302-structured-memos

Conversation

@str4d

@str4d str4d commented Oct 6, 2022

Copy link
Copy Markdown
Collaborator

Closes #1208.
Closes COR-1074.

Comment thread zip-0302.rst Outdated
nuttycom
nuttycom previously approved these changes Oct 6, 2022

@nuttycom nuttycom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK

Comment thread zip-0302.rst Outdated
Comment thread zip-0302.rst Outdated
Comment thread zip-0302.rst Outdated
daira
daira previously approved these changes Oct 26, 2022

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

ACK

@daira daira marked this pull request as ready for review October 26, 2022 21:24
@str4d

str4d commented Nov 23, 2022

Copy link
Copy Markdown
Collaborator Author

In ZIP Sync today, we decided that:

  • We would specify the multi-TLV format using prefix byte 0xF7.
    • Concatenated TLV tuples.
    • Type code 0x00 is an optional "no more TLV tuples" marker, after which everything must be 0x00 (i.e. fixed padding).
  • We would abandon 0xF5 as "for legacy private agreement", and document that newer applications should prefer 0xFF which is unambiguously for this purpose.
    • We decided that using up another top-level prefix byte here is fine, because it opens up the typecode space significantly (it adds >250 new single-byte typecodes that can encode 509 bytes, which is not a significant reduction from the 511 bytes that a top-level prefix byte can encode).

@str4d str4d force-pushed the zip302-structured-memos branch from ef5529a to 2824c4b Compare July 18, 2024 05:02
@str4d

str4d commented Jul 18, 2024

Copy link
Copy Markdown
Collaborator Author

I've replaced the old contents of this PR (which just reverted the prior content that was removed from the original ZIP 302 PR) with an initial draft following what was decided in ZIP Sync almost 2 years ago.

@str4d str4d mentioned this pull request Jul 18, 2024
@str4d str4d force-pushed the zip302-structured-memos branch from 2824c4b to ff9b60e Compare July 18, 2024 05:08
@str4d str4d changed the base branch from main to zip302-abandon-f5 July 18, 2024 05:08
@str4d str4d deleted the branch main July 18, 2024 12:44
@str4d str4d closed this Jul 18, 2024
@str4d str4d reopened this Sep 28, 2025
@str4d str4d changed the base branch from zip302-abandon-f5 to main September 28, 2025 17:06
@str4d str4d dismissed stale reviews from daira and nuttycom September 28, 2025 17:06

The base branch was changed.

Comment thread zips/zip-0302.rst Outdated
Comment thread zips/zip-0302.rst Outdated
@str4d str4d force-pushed the zip302-structured-memos branch from b1c32ef to 369dba1 Compare October 17, 2025 05:06
Comment thread zips/zip-0302.rst Outdated
daira
daira previously approved these changes Oct 17, 2025

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

ACK modulo a suggestion.

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

ACK

Comment thread zips/zip-0302.rst
Comment on lines +101 to +125
- Read the next ``partLength`` bytes to obtain ``partValue``. If ``partLength`` would
require the reader to read past the end of the memo bytes, return an error.
- Store ``(partType, partVersion, partValue)`` and continue parsing.

If an error occurs, readers MUST treat the entire memo as invalid (ignoring any
``MemoPart`` that was successfully parsed prior to the error).

Defined memo part types
```````````````````````

The following memo part types (and corresponding versioned value encodings) are defined:

+--------------+-----------------+-------------------------------------------------------------------------------------+
| ``partType`` | ``partVersion`` | ``partValue`` encoding |
+==============+=================+=====================================================================================+
| 160 | 0 | A UTF-8 string. |
| | | If decoding fails then return an error; readers MUST NOT replace invalid sequences. |
+--------------+-----------------+-------------------------------------------------------------------------------------+
| 255 | 0 | Unconstrained data, for private use (like ``0xFF`` outside structured memos). |
| | | Readers should not make any assumptions about the encoding or content of this data. |
+--------------+-----------------+-------------------------------------------------------------------------------------+
| 10000-19999 | Currently unassigned range for "assigned private use". |
+--------------+-----------------+-------------------------------------------------------------------------------------+
| 65530-65535 | For temporary experimentation. |
+--------------+-----------------+-------------------------------------------------------------------------------------+

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In ZIP Sync, we decided to require that the parser default to "unknown-reject": if a partType is unknown, error and do not return any understood part types to the wallet. We will then define that any partType in the range 30000-65535 is "optional" and can be stored in an Unknown handler (and then move the "assigned private use" section to the start of this range).

@daira

daira commented Nov 7, 2025

Copy link
Copy Markdown
Collaborator

This is pending resolution of @str4d's #638 (comment), so moving to draft.

@daira daira marked this pull request as draft November 7, 2025 22:01
@daira daira assigned daira and str4d Nov 7, 2025
@linear

linear Bot commented Mar 9, 2026

Copy link
Copy Markdown

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.

ZIP 302: Add support for Structured Memos

5 participants