Apply suggestions from code review

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Kris Nuttycombe 2020-10-05 12:43:59 -06:00 committed by GitHub
parent c367f32ab8
commit cbbc1f9d4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -35,17 +35,17 @@ for the encoding of a memo field:
This ZIP refines the specification of the third case.
+ If the first byte (byte 0)'s value is 0xF4 or smaller, then the reader should:
+ If the first byte (byte 0)'s value is 0xF4 or smaller, then the reader MUST:
+ strip any trailing zero bytes
+ decode it as UTF-8 (replacing any incorrect UTF-8-encoded byte sequences with the replacement character U+FFFD), and display it to the user as a human-readable string.
+ If byte 0's value is 0xF5, then:
+ If byte 0's value is 0xF5, then the reader MUST:
+ Interpret the next few bytes (1 to 9 of them) as a 64-bit unsigned varint/ULEB, and use it as an arbitrary application-defined "type" field.
+ Interpret the next bytes (1 to 2 of them) as a 16-bit unsigned ULEB, and use it as the length field.
+ If 1 + the number bytes used for the type field + the number of bytes used for the length field + the length > 512 then error out, i.e. do not do any further processing of the memo, and do not return any information about the memo to the caller other than the fact that it was incorrectly formatted.
+ Inspect the padding after the end of the indicated length, and if it contains anything other than 0 bytes then error out.
+ Inspect the padding after the end of the indicated length, and if it contains anything other than bytes of value 0x00 then error out.
+ Return to the caller a 3-tuple of the following data:
+ the type — an integer in [0…2⁶⁴)
+ the length — an integer in [0…510)
+ the type — an integer in :math:`[0...2^{64})`
+ the length — an integer in :math:`[0...510)`
+ a byte string of that length which contains the payload
+ If byte 0's value is 0xF6, then the user supplied no memo, and the encrypted memo field should be assumed to be empty.
+ If byte 0's value is between 0xF7 and 0xFE inclusive on both ends, then this memo is from the future, because first byte of 0xF70xFE are reserved for future specifications of this protocol.
@ -58,7 +58,7 @@ See issue `#1849`_ for further discussion.
Rationale
===========
The new protocol specification is an improvement over the current memo field content specification in the protocol spec version 2016.0-beta-1.10 which currently states:
The new protocol specification is an improvement over the current memo field content specification that was in the protocol spec up to version 2020.1.0, which stated:
The usage of the memo field is by agreement between the sender and recipient of the note. The memo field SHOULD be encoded either as: