BIP 174: clarify format of proprietary extensions.#951
BIP 174: clarify format of proprietary extensions.#951rustyrussell wants to merge 1 commit intobitcoin:masterfrom
Conversation
"Variable length string identifier" is not defined anywhere, and the suggestion to use "0x00" is also deeply unclear. I assumed it meant a nul-terminated string! Be explicit: you mean it must be a compact siz1\e unsigned int length, followed by that many identifier bytes, followed by a compact size unsigned int subtype, followed by optional keydata. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
| ** Key: Variable length identifier prefix, followed by a subtype, followed by the key data itself. | ||
| *** <tt>{0xFC}|<prefix>|{subtype}|{key data}</tt> | ||
| ** Key: Compact size unsigned integer, followed by identifier prefix of that length, followed by a subtype, followed by the key data itself. | ||
| *** <tt>{0xFC}|{prefixlen}|<prefix>|{subtype}|{key data}</tt> |
There was a problem hiding this comment.
The note on notation found earlier in the BIP indicates that <...> means "prefixed by compact size unsigned integer". So this is technically incorrect.
There was a problem hiding this comment.
Thanks, I missed that!
Is this boutique notation used in other BIPs? I haven't seen it before and it was completely non-intuitive to me!
There was a problem hiding this comment.
Is this boutique notation used in other BIPs? I haven't seen it before and it was completely non-intuitive to me!
I think I made up the notation as a placeholder and just never changed it to something else.
| * Type: Proprietary Use Type <tt>PSBT_GLOBAL_PROPRIETARY = 0xFC</tt> | ||
| ** Key: Variable length identifier prefix, followed by a subtype, followed by the key data itself. | ||
| *** <tt>{0xFC}|<prefix>|{subtype}|{key data}</tt> | ||
| ** Key: Compact size unsigned integer, followed by identifier prefix of that length, followed by a subtype, followed by the key data itself. |
There was a problem hiding this comment.
Because everything variable length in Bitcoin is prefixed by a compact size unsigned int, "Variable length ..." is the correct way to describe this. Further clarification of this should be in a parenthetical rather than listed as its own separate entity.
There was a problem hiding this comment.
This isn't even true in this BIP.
The key data is variable length. It is not prefixed by a compact size unsigned int!
There was a problem hiding this comment.
The key data is variable length. It is not prefixed by a compact size unsigned int!
Uhh... no? It definitely is prefixed by the size, it's just usually 0x01.
There was a problem hiding this comment.
Not quite: the entire key is prefixed by the size. The keydata length is implied.
You also use 0 as a terminator in various places in this BIP, eschewing explicit length there.
And bitcoin uses NUL as a terminator on command names in the wire protocol (within a fixed length field, because reasons?)
Given this lack of consistency, I think we're best off being horribly explicit?
|
Closing in favor of more ambitious approach.... |
"Variable length string identifier" is not defined anywhere, and the suggestion
to use "0x00" is also deeply unclear. I assumed it meant a nul-terminated
string!
Be explicit: you mean it must be a compact siz1\e unsigned int length, followed
by that many identifier bytes, followed by a compact size unsigned int subtype,
followed by optional keydata.
Signed-off-by: Rusty Russell rusty@rustcorp.com.au