BIP 141 and 145: GBT updates for SegWit #365

pull luke-jr wants to merge 20 commits into bitcoin:master from luke-jr:segwit_gbt_updates_20160330 changing 2 files +18 −11
  1. luke-jr commented at 10:49 PM on March 30, 2016: member
  2. BIP 141 & 145: Clarify sigop interaction a5447e0c4b
  3. BIP 9: Clarify nVersion interpretation and bit order b8467dfb7c
  4. BIP 9: Add softfork deployment "name" b0b65ceede
  5. BIP 9: GBT specification 12a2131bb4
  6. BIP 145: Update for BIP 9 161b39fa68
  7. BIP 141: Specify VB name 2fa7fb9b5c
  8. luke-jr added the label Proposed BIP modification on Mar 30, 2016
  9. BIP141: Sigop clarification cacf39b057
  10. Update bip-0141.mediawiki a6cc319846
  11. Merge pull request #1 from jl2012/patch-13
    BIP141: Sigop clarification
    5bf411856e
  12. in bip-0009.mediawiki:None in 2fa7fb9b5c outdated
      23 | @@ -24,6 +24,7 @@ In addition, BIP 34 made the integer comparison (nVersion >= 2) a consensus rule
      24 |  
      25 |  Each soft fork deployment is specified by the following per-chain parameters (further elaborated below):
      26 |  
      27 | +# The '''name''' specifies a very brief description of the soft fork, reasonable for use as an identifier.
    


    btcdrak commented at 10:58 AM on March 31, 2016:

    I would suggest the for most of the time, most softforks will role out one consensus BIP so the sensible name would be bipxxxx unless you have a case like with the bip68+112+113 softfork, in which case we labelled that csv. Therefore I would suggest default of bipxxxx unless it's a bundle.

    Thinking more, we probably need a table of soft forks somewhere with name, bip(s), starttime, timeout.


    luke-jr commented at 11:36 PM on April 4, 2016:

    This is outside the scope of this PR, IMO.

  13. sipa commented at 10:42 AM on April 5, 2016: member

    The nVersion field of a block never affects the rules applied, so a miner can always be free to set the nVersion to anything.

  14. luke-jr commented at 10:54 AM on April 5, 2016: member

    @sipa Which part are you referring to? GBT servers may very well want to restrict the nVersion to things they can handle.

  15. sipa commented at 11:04 AM on April 5, 2016: member

    I had interpreted "the server requires support for" as rules the server demanded you to enforce, rather than rules the server demands you to set bits for. It's a bit confusing that rules and rulesenforced are about consensus rules, and rulesrequires is about nVersion bits to be set. Perhaps replace rulesrequired with versionrequired, with an integer of bits the server requires you to set in nversion?

  16. luke-jr commented at 11:21 AM on April 5, 2016: member

    I would have grouped "rules" and "rulesrequired" together, since they deal with bits available/allowed and required; vs "rulesenforced" which is the actual consensus rules being used. Maybe "vbits" and "vbitsrequired"?

  17. jl2012 commented at 3:12 PM on April 5, 2016: contributor

    ACK BIP141

  18. sipa commented at 3:17 PM on April 5, 2016: member

    @luke-jr vbits would just be the same as version, I think?

    Isn't this sufficient:

    • vbrequired: bits in nVersion that the server demands to be set (so an integer)
    • rules: list of strings of deployments whose rules are in effect

    ?

  19. luke-jr commented at 3:32 PM on April 5, 2016: member

    @sipa How will clients know what bits are available and what they mean in context?

  20. sipa commented at 3:36 PM on April 5, 2016: member

    @luke-jr What do you mean by "available"?

  21. luke-jr commented at 9:54 PM on April 5, 2016: member

    @sipa Bits which have a defined meaning.

  22. sipa commented at 10:31 PM on April 5, 2016: member

    @luke-jr Why does that matter? If the bits are not active, they have no relevance for mining the block, as there are never any consensus rules in BIP9 that prevent you from setting any combination at all of version bits. The server may insist that you set some to vote for, but apart from that, that information is not relevant to the client.

  23. luke-jr commented at 10:52 PM on April 5, 2016: member

    The client needs the information to know which bits it wants to or doesn't want to set.

  24. sipa commented at 10:58 PM on April 5, 2016: member

    They can find that in the BIP.

    If they need to rely on the server for that, the server can claim anything, including claiming that there is nothing to vote for.

  25. luke-jr commented at 11:03 PM on April 5, 2016: member

    So put each and every BIP into the GBT client, even before it has activated?

    Consider that the server trusted for name:bit mappings could very well be your own local bitcoind.

  26. luke-jr commented at 11:04 PM on April 5, 2016: member

    Also, even if each BIP were put into the GBT client, the client doesn't have the required blockchain context to determine if the BIP has activated or is still pending.

  27. sipa commented at 11:06 PM on April 5, 2016: member

    If the client software doesn't know about a BIP, why does it care?

    How does it help that the server says "these arbitrary string names exist", if the client doesn't know what protocol changes they correspond to? If they care about the rules, they know the rule's name too.

  28. sipa commented at 11:07 PM on April 5, 2016: member

    @luke-jr Yes, saying with rules are active is useful. Saying which exist isn't. They're just arbitrary strings with no meaning to the client. If they do know about them, they don't need to be told.

  29. luke-jr commented at 12:19 AM on April 6, 2016: member

    For example, a miner might want to use --veto-vbits=bip109 to instruct their software to automatically unset the BIP 109 bit, and reject pools that require it. Or --require-vbits=bip109 for the opposite.

  30. sipa commented at 10:08 AM on April 6, 2016: member

    @luke-jr What if the server doesn't know about a particular BIP yet, but the miner does? If the miner has an opinion about a particular BIP/deployment, they also know what bits to use.

  31. luke-jr commented at 10:12 AM on April 6, 2016: member

    If the server doesn't support it, it shouldn't be indicating it does regardless.

  32. sipa commented at 10:15 AM on April 6, 2016: member

    Well by default nVersion will always be setting bits for everything that it supports. The miner is always free to unset bits from it, but I don't think it's the server's job to explain the consensus rules to the miner.

  33. sipa cross-referenced this on Apr 19, 2016 from issue Segregated witness by sipa
  34. Merge branch 'master' into segwit_gbt_updates_20160330 5f697ea543
  35. bip-0009: Recommend name "bipN" 7e99bbf958
  36. BIP 9 (& 145): Switch to rules/vbavailable/vbrequired GBT interface 4683a9b714
  37. Merge remote-tracking branch 'personal-github/segwit_gbt_updates_20160330' into segwit_gbt_updates_20160330 2e5533849e
  38. luke-jr commented at 8:23 PM on April 23, 2016: member

    @sipa @petertodd @gmaxwell @rustyrussell @CodeShark @jl2012

    This has been revised per discussion. Please re-check and ACK if acceptable.

  39. luke-jr force-pushed on Apr 23, 2016
  40. BIP 9, 22 & 145: Use simple Yes/No rather than templates (which don't work on GitHub) 31c45b611d
  41. luke-jr force-pushed on Apr 23, 2016
  42. BIP 9: Clarify GBT "version" 3cfa48d1e0
  43. BIP 9 & 145: rules/force mutation cc4a94c1c0
  44. luke-jr cross-referenced this on Apr 25, 2016 from issue Versionbits: GBT support by luke-jr
  45. sipa commented at 5:42 AM on April 25, 2016: member

    The changes in BIP22 are just formatting?

  46. luke-jr commented at 6:30 AM on April 25, 2016: member

    Yes, someone noticed the {{templates}} were not rendering on GitHub.

  47. jl2012 commented at 8:20 AM on April 25, 2016: contributor

    ACK 141

  48. jl2012 cross-referenced this on Apr 26, 2016 from issue Sigops are in witnessScript, not witness program by instagibbs
  49. theuni commented at 5:13 PM on May 5, 2016: member

    Concept ACK on GBT changes. It's a bit hazy though as to what the server should do if a softfork rule is missing from the request, and there's the possibility of altering the block (potentially in a nasty way, like coinbase-only) to make it compatible. In segwit's case, would the lack of a "segwit" rule in the request cause an error post-activation, or would witness transactions be filtered out?

  50. luke-jr commented at 4:04 AM on May 6, 2016: member

    It's a bit hazy though as to what the server should do if a softfork rule is missing from the request, and there's the possibility of altering the block (potentially in a nasty way, like coinbase-only) to make it compatible. In segwit's case, would the lack of a "segwit" rule in the request cause an error post-activation, or would witness transactions be filtered out?

    The server has a few options:

    • Filter out witness transactions and use rules/force
    • Produce the full witness-enabled template, and do not use rules/force. The client in this case must refuse to proceed unless it can handle segwit (listed in "rules")
    • Throw an error
  51. theuni commented at 3:10 AM on May 7, 2016: member

    Right, and that ambiguity is kinda nasty without a proposed implementation. I'd go as far as saying that it should never throw an error if there's the possibility of somehow creating a valid block. Maybe another input flag could be added for "fail for degraded blocks".

    Regardless, this needs to be laid out in the BIP.

  52. luke-jr commented at 3:28 AM on May 7, 2016: member

    Which method a server uses in this situation is implementation-specific, not part of the standard. In any case, it is already documented clearly here: https://github.com/bitcoin/bips/pull/365/files#diff-6a9961b118279d111faf86ad6ebbfedbR204

    Please feel free to proposed improved language.

  53. theuni commented at 4:01 AM on May 7, 2016: member

    NACK that. Where preferences can be communicated, they should be, and they should be respected by the server. Otherwise what ends up being "part of the standard" is the default behavior of the leading implementation.

  54. luke-jr commented at 4:05 AM on May 7, 2016: member

    I don't understand what you're NACKing.

  55. theuni commented at 5:14 PM on May 7, 2016: member

    I'm NACKing the language that makes the behavior implementation-specific. I'm suggest changes to either:

    • Add a rules/degraded value to the template, so that the miner is aware that the block has been downgraded in some way as a result of a missing input rule. This is different from the rules/force key, in that the latter does not necessarily mean that the block has been degraded. or
    • Add an optional "error_degraded" key to the request that signals that the server should not try to degrade the block as a result of a missing input rule, but throw an error instead.

    Along with the addition of text along the lines of Unless signaled (by whichever mechanism above), the server should always attempt to provide the client with a template that will allow the client to create a valid block, degraded only as much as is necessary. Only in the case where no solution from the client would be valid should the server return an error.

    With those changes, it would be clear what the implementation for Core should look like.

  56. luke-jr commented at 5:29 PM on May 7, 2016: member

    Any item in "rules" the client does not understand implies it must error or (if "rules/force" is allowed) "is degraded".

  57. theuni commented at 5:53 PM on May 7, 2016: member

    Force (as I read it) doesn't necessarily mean degraded. It could simply mean that a serialization change would break the block, but that transactions haven't been removed. For example some future soft-fork that specifies a required order for transactions.

    More importantly though, the text above guarantees backwards-compatibility when possible, as opposed to letting the implementation decide.

  58. luke-jr commented at 9:44 PM on May 7, 2016: member

    A softfork requiring ordered transactions would necessarily need to a new "rules" entry. When there are no rules that the client doesn't understand, "rules/force" is a no-op.

    It's not the business of the spec to force backward compatibility. Implementations that don't want to provide it should be free not to.

  59. Replace "rules/force" mutation with a "cannot be ignored" prefix to rule names 162e2e0025
  60. bip-0009: Remove n/a paragraph 5e6f3ba3be
  61. in bip-0009.mediawiki:None in 162e2e0025 outdated
     195 | +Without this prefix, GBT clients may assume the rule will not impact usage of the template as-is; typical examples of this would be when previously valid transactions cease to be valid, such as BIPs 16, 65, 66, 68, 112, and 113.
     196 | +If a client does not understand a rule without the prefix, it may use it unmodified for mining.
     197 | +On the other hand, when this prefix is used, it indicates a more subtle change to the block structure or generation transaction; examples of this would be BIP 34 (because it modifies coinbase construction) and 141 (since it modifies the txid hashing and adds a commitment to the generation transaction).
     198 | +A client that does not understand a rule prefixed by '!' must not attempt to process the template, and must not attempt to use it for mining even unmodified.
     199 | +
     200 | +Servers should only signal this mutation when they have verified a client behaving this way will not produce invalid blocks.
    


    sipa commented at 6:45 PM on May 11, 2016:

    Does this section still match the text before?


    luke-jr commented at 9:54 PM on May 11, 2016:

    No, it was left over. Removed.

  62. in bip-0141.mediawiki:None in e8e5d5bc04 outdated
     119 | @@ -120,9 +120,11 @@ The new rule is ''block cost'' ≤ 4,000,000.
     120 |  
     121 |  Sigops per block is currently limited to 20,000. We change this restriction as follows:
     122 |  
     123 | -''Sigop cost'' is defined. The cost of a sigop in traditional script is 4, while the cost of a sigop in witness program is 1.
     124 | +Sigops in the current pubkey script, signature script, and P2SH check script are counted at 4 times their previous value.
    


    sipa commented at 11:13 PM on May 13, 2016:

    Any reason for removing the sigop cost terminology? I thought it was useful to distinguish from the original sigops definition.


    luke-jr commented at 11:20 PM on May 13, 2016:

    I don't see how the original sigops definition is relevant post-segwit. ie, what's the point?


    sipa commented at 11:39 PM on May 13, 2016:

    Avoiding confusion :)


    luke-jr commented at 12:04 AM on May 14, 2016:

    I personally find it more confusing to have two terms for essentially the same thing of different versions... should GBT be changed to remove sigops/sigoplimit and add sigopcost/sigopcostlimit as well?

  63. sipa commented at 11:15 PM on May 13, 2016: member

    @theuni Have your concerns been addressed?

  64. Merge remote-tracking branch 'origin/master' into segwit_gbt_updates_20160330 ce426ab4e1
  65. luke-jr force-pushed on May 15, 2016
  66. luke-jr cross-referenced this on May 22, 2016 from issue BIP 9: GBT updates for versionbits by luke-jr
  67. Merge branch 'master' into segwit_gbt_updates_20160330 8324bc512e
  68. luke-jr renamed this:
    BIP 9, 141, and 145: GBT updates for VB & SW
    BIP 141 and 145: GBT updates for SegWit
    on May 31, 2016
  69. sipa commented at 5:51 PM on June 1, 2016: member

    ACK

  70. luke-jr merged this on Jun 1, 2016
  71. luke-jr closed this on Jun 1, 2016

  72. luke-jr deleted the branch on Apr 21, 2017
  73. dgenr8 cross-referenced this on Sep 28, 2018 from issue Bip135 3 by dagurval

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 11:10 UTC

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