BIP 174: clarify format of proprietary extensions. #951

pull rustyrussell wants to merge 1 commits into bitcoin:master from rustyrussell:clarify-178-proprietary changing 1 files +8 −8
  1. rustyrussell commented at 2:07 AM on July 28, 2020: contributor

    "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

  2. BIP 174: clarify format of proprietary extensions.
    "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>
    c4deaf4ae0
  3. in bip-0174.mediawiki:137 in c4deaf4ae0
     132 | @@ -133,8 +133,8 @@ The currently defined global types are as follows:
     133 |  *** <tt>{32-bit uint}</tt>
     134 |  
     135 |  * Type: Proprietary Use Type <tt>PSBT_GLOBAL_PROPRIETARY = 0xFC</tt>
     136 | -** Key: Variable length identifier prefix, followed by a subtype, followed by the key data itself.
     137 | -*** <tt>{0xFC}|<prefix>|{subtype}|{key data}</tt>
     138 | +** Key: Compact size unsigned integer, followed by identifier prefix of that length, followed by a subtype, followed by the key data itself.
     139 | +*** <tt>{0xFC}|{prefixlen}|<prefix>|{subtype}|{key data}</tt>
    


    achow101 commented at 3:15 AM on July 28, 2020:

    The note on notation found earlier in the BIP indicates that <...> means "prefixed by compact size unsigned integer". So this is technically incorrect.


    rustyrussell commented at 3:27 AM on July 28, 2020:

    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!


    achow101 commented at 3:31 AM on July 28, 2020:

    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.

  4. in bip-0174.mediawiki:136 in c4deaf4ae0
     132 | @@ -133,8 +133,8 @@ The currently defined global types are as follows:
     133 |  *** <tt>{32-bit uint}</tt>
     134 |  
     135 |  * Type: Proprietary Use Type <tt>PSBT_GLOBAL_PROPRIETARY = 0xFC</tt>
     136 | -** Key: Variable length identifier prefix, followed by a subtype, followed by the key data itself.
     137 | -*** <tt>{0xFC}|<prefix>|{subtype}|{key data}</tt>
     138 | +** Key: Compact size unsigned integer, followed by identifier prefix of that length, followed by a subtype, followed by the key data itself.
    


    achow101 commented at 3:17 AM on July 28, 2020:

    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.


    rustyrussell commented at 3:25 AM on July 28, 2020:

    This isn't even true in this BIP.

    The key data is variable length. It is not prefixed by a compact size unsigned int!


    achow101 commented at 3:29 AM on July 28, 2020:

    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.


    rustyrussell commented at 5:03 AM on July 28, 2020:

    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?

  5. rustyrussell commented at 5:57 AM on July 28, 2020: contributor

    Closing in favor of more ambitious approach....

  6. rustyrussell closed this on Jul 28, 2020


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me