Compare commits

...

2 Commits

Author SHA1 Message Date
str4d 0fd8a9e08f
Merge ef5529a0bd into 146936c3a1 2024-03-15 08:31:05 +10:00
Jack Grigg ef5529a0bd ZIP 302: Revert "Final changes to remove undecided parts of the draft"
This reverts commit de694d4509.
2022-10-07 07:22:36 +13:00
2 changed files with 45 additions and 2 deletions

View File

@ -3,6 +3,7 @@
<head>
<title>ZIP 302: Standardized Memo Field Format</title>
<meta charset="utf-8" />
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js?config=TeX-AMS-MML_HTMLorMML"></script>
<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"></head>
<body>
<section>
@ -37,10 +38,38 @@ Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/105">https://githu
<li>decode it as a UTF-8 string (if decoding fails then report an error).</li>
</ul>
</li>
<li>
<dl>
<dt>If the first byte has a value of 0xF5, then the reader MUST:</dt>
<dd>
<ul>
<li>Interpret the next few bytes (1 to 9 of them) as a 64-bit unsigned variable-length integer <a id="footnote-reference-3" class="footnote_reference" href="#bitcoin-compactsize">3</a>, and use it as an arbitrary application-defined "type" field.</li>
<li>Interpret the next 1 or 2 bytes as a CompactSize value constrained to the range 0..510, and use the resulting value as the length of the remaining data.</li>
<li>If 1 + the number bytes used for the type field + the number of bytes used for the length field + the length &gt; 512 then report an error.</li>
<li>Inspect the padding after the end of the indicated length, and if it contains anything other than bytes of value 0x00 then report an error.</li>
<li>
<dl>
<dt>Return to the caller a 3-tuple of the following data:</dt>
<dd>
<ul>
<li>the type — an integer in
<span class="math">\([0...2^{64})\)</span>
</li>
<li>the length — an integer in
<span class="math">\([0...510)\)</span>
</li>
<li>a byte string of that length that contains the payload</li>
</ul>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</li>
<li>If the first byte has a value of 0xF6, and the remaining 511 bytes are 0x00, then the user supplied no memo, and the encrypted memo field is to be treated as empty.</li>
<li>If the memo matches any of these patterns, then this memo is from the future, because these ranges are reserved for future updates to this specification:
<ul>
<li>The first byte has a value of 0xF5.</li>
<li>The first byte has a value of 0xF6, and the remaining 511 bytes are not all 0x00.</li>
<li>The first byte has a value between 0xF7 and 0xFE inclusive.</li>
</ul>

View File

@ -45,13 +45,27 @@ contents of a memo. It does not define consensus requirements.
+ strip any trailing zero bytes
+ decode it as a UTF-8 string (if decoding fails then report an error).
+ If the first byte has a value of 0xF5, then the reader MUST:
+ Interpret the next few bytes (1 to 9 of them) as a 64-bit unsigned variable-length
integer [#Bitcoin-CompactSize]_, and use it as an arbitrary application-defined
"type" field.
+ Interpret the next 1 or 2 bytes as a CompactSize value constrained to the range 0..510, and use
the resulting value as the length of the remaining data.
+ If 1 + the number bytes used for the type field + the number of bytes used for the
length field + the length > 512 then report an error.
+ Inspect the padding after the end of the indicated length, and if it
contains anything other than bytes of value 0x00 then report an error.
+ Return to the caller a 3-tuple of the following data:
+ the type — an integer in :math:`[0...2^{64})`
+ the length — an integer in :math:`[0...510)`
+ a byte string of that length that contains the payload
+ If the first byte has a value of 0xF6, and the remaining 511 bytes are 0x00, then the user
supplied no memo, and the encrypted memo field is to be treated as empty.
+ If the memo matches any of these patterns, then this memo is from the future, because
these ranges are reserved for future updates to this specification:
+ The first byte has a value of 0xF5.
+ The first byte has a value of 0xF6, and the remaining 511 bytes are not all 0x00.
+ The first byte has a value between 0xF7 and 0xFE inclusive.