summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2017-06-25 06:29:23 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2017-06-25 06:36:14 +0000
commit155ce23c2f78158c92dcde56620e20797c3a3b91 (patch)
tree9e39b9ee30250650fe9d6c1f4889896fa3cf0c00
parentd7662ab88c86551a384be0888f3566181403a5ee (diff)
downloadbips-155ce23c2f78158c92dcde56620e20797c3a3b91.tar.xz
BIP 8: Add FAILING state to allow lockinontimeout upgrades
-rw-r--r--bip-0008.mediawiki29
-rw-r--r--bip-0008/states.pngbin21180 -> 27151 bytes
-rw-r--r--bip-0008/states.svg22
3 files changed, 36 insertions, 15 deletions
diff --git a/bip-0008.mediawiki b/bip-0008.mediawiki
index feb9327..26e8572 100644
--- a/bip-0008.mediawiki
+++ b/bip-0008.mediawiki
@@ -33,7 +33,7 @@ Each soft fork deployment is specified by the following per-chain parameters (fu
# The '''name''' specifies a very brief description of the soft fork, reasonable for use as an identifier. For deployments described in a single BIP, it is recommended to use the name "bipN" where N is the appropriate BIP number.
# The '''bit''' determines which bit in the nVersion field of the block is to be used to signal the soft fork lock-in and activation. It is chosen from the set {0,1,2,...,28}.
# The '''start''' specifies the height of the first block at which the bit gains its meaning.
-# The '''timeout''' specifies a block height at which the miner signalling ends. Once this height has been reached, if the soft fork has not yet locked in (excluding this block's bit state), the deployment is either considered failed on all descendants of the block, or, if '''lockinontimeout'' is true, transitions to the '''LOCKED_IN''' state.
+# The '''timeout''' specifies a block height at which the miner signalling ends. Once this height has been reached, if the soft fork has not yet locked in (excluding this block's bit state), the deployment is either considered failed on all descendants of the block (but see the exception during '''FAILING''' state), or, if '''lockinontimeout'' is true, transitions to the '''LOCKED_IN''' state.
# The '''lockinontimeout''' boolean if set to true, will transition state to '''LOCKED_IN''' at timeout if not already '''LOCKED_IN''' or '''ACTIVE'''.
===Selection guidelines===
@@ -44,7 +44,7 @@ The following guidelines are suggested for selecting these parameters for a soft
# '''bit''' should be selected such that no two concurrent softforks use the same bit.
# '''start''' should be set to some block height in the future, approximately one month after a software release date including the soft fork. This allows for some release delays, while preventing triggers as a result of parties running pre-release software, and ensures a reasonable number of full nodes have upgraded prior to activation. It should be rounded up to the next height which begins a retarget period.
# '''timeout''' should be approximately 1 year after start, and on a block which begins a retarget period. Therefore, '''start''' plus 52416.
-# '''lockinontimeout''' should be set to true for any softfork that isn't exclusively for miner benefit.
+# '''lockinontimeout''' should be set to true for any softfork that is expected or found to have political opposition from a non-negligable percent of miners. (It can be set after the initial deployment, but cannot be cleared once set.)
A later deployment using the same bit is possible as long as the start is after the previous one's
timeout or activation, but it is discouraged until necessary, and even then recommended to have a pause in between to detect buggy software.
@@ -57,7 +57,8 @@ With each block and soft fork, we associate a deployment state. The possible sta
# '''STARTED''' for blocks at or beyond the start height.
# '''LOCKED_IN''' for one retarget period after the first retarget period with STARTED blocks of which at least threshold have the associated bit set in nVersion, or for one retarget period after the timeout when '''lockinontimeout''' is true.
# '''ACTIVE''' for all blocks after the LOCKED_IN retarget period.
-# '''FAILED''' for all blocks after the timeout, if LOCKED_IN was not reached and '''lockinontimeout''' is false.
+# '''FAILING''' for one retarget period after the timeout, if LOCKED_IN was not reached and '''lockinontimeout''' is false.
+# '''FAILED''' for all blocks after the FAILING retarget period.
===Bit flags===
@@ -107,17 +108,17 @@ We remain in the initial state until either we pass the start height or the time
case DEFINED:
if (block.height >= timeout) {
- return (lockinontimeout == true) ? LOCKED_IN : FAILED;
+ return (lockinontimeout == true) ? LOCKED_IN : FAILING;
}
if (block.height >= start) {
return STARTED;
}
return DEFINED;
-After a period in the STARTED state, if we're past the timeout, we switch to LOCKED_IN or FAILED. If not, we tally the bits set,
+After a period in the STARTED state, if we're past the timeout, we switch to LOCKED_IN or FAILING. If not, we tally the bits set,
and transition to LOCKED_IN if a sufficient number of blocks in the past period set the deployment bit in their
version numbers. The threshold is ≥1916 blocks (95% of 2016), or ≥1512 for testnet (75% of 2016).
-The transition to FAILED takes precendence, as otherwise an ambiguity can arise.
+The transition to FAILING takes precendence, as otherwise an ambiguity can arise.
There could be two non-overlapping deployments on the same bit, where the first one transitions to LOCKED_IN while the
other one simultaneously transitions to STARTED, which would mean both would demand setting the bit.
@@ -125,7 +126,7 @@ Note that a block's state never depends on its own nVersion; only on that of its
case STARTED:
if (block.height >= timeout) {
- return (lockinontimeout == true) ? LOCKED_IN : FAILED;
+ return (lockinontimeout == true) ? LOCKED_IN : FAILING;
}
int count = 0;
walk = block;
@@ -140,6 +141,19 @@ Note that a block's state never depends on its own nVersion; only on that of its
}
return STARTED;
+If the deployment is not LOCKED_IN by the timeout (or '''lockinontimeout'''), it has a single retarget period during which it may still become active, only by unanimous signalling in every block.
+This state exists such that if '''lockinontimeout''' is set to true later, it remains compatible with the original deployment.
+
+ case FAILING:
+ walk = block;
+ for (i = 0; i < 2016; i++) {
+ walk = walk.parent;
+ if (walk.nVersion & 0xE0000000 == 0x20000000 && ((walk.nVersion >> bit) & 1) != 1) {
+ return FAILED;
+ }
+ }
+ return ACTIVE;
+
After a retarget period of LOCKED_IN, we automatically transition to ACTIVE.
case LOCKED_IN:
@@ -180,6 +194,7 @@ https://github.com/bitcoin/bitcoin/compare/master...shaolinfry:bip-uaversionbits
* The '''lockinontimeout''' flag is added. BIP 9 would only transition to the FAILED state when timeout was reached.
* Block heights are used for the deployment monotonic clock, rather than median-time-past.
+* The last-ditch effort during a new FAILING state is added to allow '''lockinontimeout''' to be safely set after the initial deployment.
==Backwards compatibility==
diff --git a/bip-0008/states.png b/bip-0008/states.png
index de94501..f4acde1 100644
--- a/bip-0008/states.png
+++ b/bip-0008/states.png
Binary files differ
diff --git a/bip-0008/states.svg b/bip-0008/states.svg
index f7d9f9d..07a0ab8 100644
--- a/bip-0008/states.svg
+++ b/bip-0008/states.svg
@@ -1,4 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 608 464" width="608" height="464">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 848 464" width="848" height="464">
<defs>
<style type="text/css"><![CDATA[
rect {
@@ -41,11 +41,17 @@
<text x="176" y="408" font-size="20" text-anchor="middle">ACTIVE</text>
<path d="M 128 416 a 24 32 0 1 1 0 -32"/><!-- loop -->
- <rect x="304" y="112" width="128" height="32"/>
- <text x="368" y="136" font-size="20" text-anchor="middle">FAILED</text>
- <path d="M 416 144 a 24 32 0 1 0 0 -32"/><!-- loop -->
- <path d="M 240 64 l 64 48"/>
- <text x="280" y="80" font-size="12" text-anchor="start">timeout &lt;= height</text>
- <path d="M 240 192 l 64 -48"/>
- <text x="280" y="180" font-size="12" text-anchor="start">(lockinontimeout == false) AND (timeout &lt;= height)</text>
+ <rect x="640" y="176" width="128" height="32"/>
+ <text x="704" y="200" font-size="20" text-anchor="middle">FAILING</text>
+ <path d="M 240 64 l 400 112"/>
+ <text x="440" y="108" font-size="12" text-anchor="start">timeout &lt;= height</text>
+ <path d="M 240 192 l 400 0"/>
+ <text x="408" y="184" font-size="12" text-anchor="middle">(lockinontimeout == false) AND (timeout &lt;= height)</text>
+ <path d="M 704 208 l 0 176"/>
+ <text x="720" y="296" font-size="12" text-anchor="start">NOT all blocks signal</text>
+ <path d="M 656 208 c 0 196 -416 176 -416 176"/>
+ <text x="544" y="352" font-size="12" text-anchor="start">all blocks signal</text>
+ <rect x="640" y="384" width="128" height="32"/>
+ <text x="704" y="408" font-size="20" text-anchor="middle">FAILED</text>
+ <path d="M 756 416 a 24 32 0 1 0 0 -32"/><!-- loop -->
</svg>