Skip to content

Commit dacd6a2

Browse files
authored
Merge pull request bitcoin#1080 from achow101/bip8-more-params
BIP 8: Add minimum activation height
2 parents cd3885c + 54fe116 commit dacd6a2

File tree

4 files changed

+60
-46
lines changed

4 files changed

+60
-46
lines changed

bip-0008.mediawiki

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Each soft fork deployment is specified by the following per-chain parameters (fu
3939
# The '''startheight''' specifies the height of the first block at which the bit gains its meaning.
4040
# The '''timeoutheight''' 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 considered failed on all descendants of the block.
4141
# The '''threshold''' specifies the minimum number of block per retarget period which indicate lock-in of the soft fork during the subsequent period.
42+
# The '''minimum_activation_height''' specifies the height of the first block at which the soft fork is allowed to become active.
4243
# The '''lockinontimeout''' boolean if set to true, blocks are required to signal in the final period, ensuring the soft fork has locked in by timeoutheight.
4344
4445
===Selection guidelines===
@@ -47,15 +48,16 @@ The following guidelines are suggested for selecting these parameters for a soft
4748

4849
# '''name''' should be selected such that no two softforks, concurrent or otherwise, ever use the same name. For deployments described in a single BIP, it is recommended to use the name "bipN" where N is the appropriate BIP number.
4950
# '''bit''' should be selected such that no two concurrent softforks use the same bit. The bit chosen should not overlap with active usage (legitimately or otherwise) for other purposes.
50-
# '''startheight''' should be set to some block height in the future when a majority of economic activity is expected to have upgraded to a software release including the activation parameters. Some allowance should be made for potential release delays. It should be rounded up to the next height which begins a retarget period for simplicity.
51+
# '''startheight''' should be set to some block height in the future. It should be rounded up to the next height which begins a retarget period for simplicity. If '''minimum_activation_height''' is not going to be set, then '''startheight''' should be set to a height when a majority of economic activity is expected to have upgraded to software including the activation parameters. Some allowance should be made for potential release delays. If '''minimum_activation_height''' is going to be set, then '''startheight''' can be set to be soon after software with parameters is expected to be released. This shifts the time for upgrading from before signaling begins to during the LOCKED_IN state.
5152
# '''timeoutheight''' should be set to a block height when it is considered reasonable to expect the entire economy to have upgraded by, probably at least 1 year, or 52416 blocks (26 retarget intervals) after '''startheight'''.
5253
# '''threshold''' should be 1815 blocks (90% of 2016), or 1512 (75%) for testnet.
54+
# '''minimum_activation_height''' should be set to several retarget periods in the future if the '''startheight''' is to be very soon after software with parameters is expected to be released. '''minimum_activation_height''' should be set to a height when a majority of economic activity is expected to have upgraded to software including the activation parameters. This allows more time to be spent in the LOCKED_IN state so that nodes can upgrade. This may be set to 0 to have the LOCKED_IN state be a single retarget period.
5355
# '''lockinontimeout''' should be set to true for any softfork that is expected or found to have political opposition from a non-negligible percent of miners. (It can be set after the initial deployment, but cannot be cleared once set.)
5456
5557
A later deployment using the same bit is possible as long as the startheight is after the previous one's
5658
timeoutheight or activation, but it is discouraged until necessary, and even then recommended to have a pause in between to detect buggy software.
5759

58-
'''startheight''' and '''timeoutheight''' must be an exact multiple of 2016 (ie, at a retarget boundary), and '''timeoutheight''' must be at least 4096 blocks (2 retarget intervals) after '''startheight'''.
60+
'''startheight''', '''timeoutheight''', and '''minimum_activation_height''' must be an exact multiple of 2016 (ie, at a retarget boundary), and '''timeoutheight''' must be at least 4096 blocks (2 retarget intervals) after '''startheight'''.
5961

6062
===States===
6163

@@ -64,8 +66,8 @@ With each block and soft fork, we associate a deployment state. The possible sta
6466
# '''DEFINED''' is the first state that each soft fork starts out as. The genesis block is by definition in this state for each deployment.
6567
# '''STARTED''' for blocks at or beyond the startheight.
6668
# '''MUST_SIGNAL''' for one retarget period prior to the timeout, if LOCKED_IN was not reached and '''lockinontimeout''' is true.
67-
# '''LOCKED_IN''' for one retarget period after the first retarget period with STARTED (or MUST_SIGNAL) blocks of which at least threshold have the associated bit set in nVersion.
68-
# '''ACTIVE''' for all blocks after the LOCKED_IN retarget period.
69+
# '''LOCKED_IN''' for at least one retarget period after the first retarget period with STARTED (or MUST_SIGNAL) blocks of which at least threshold have the associated bit set in nVersion. A soft fork remains in LOCKED_IN until at least '''minimum_activation_height''' is reached.
70+
# '''ACTIVE''' for all blocks after the LOCKED_IN state.
6971
# '''FAILED''' for all blocks after the timeoutheight if LOCKED_IN is not reached.
7072
7173
===Bit flags===
@@ -93,7 +95,8 @@ During the MUST_SIGNAL phase, if '''(2016 - threshold)''' blocks in the retarget
9395

9496
<img src="bip-0008/states.png" align="middle"></img>
9597

96-
Note that when '''lockinontimeout''' is true, the LOCKED_IN state will be reached no later than at a height of '''timeoutheight''', and ACTIVE will be reached no later than at a height of '''timeoutheight + 2016'''.
98+
Note that when '''lockinontimeout''' is true, the LOCKED_IN state will be reached no later than at a height of '''timeoutheight'''.
99+
Regardless of the value of '''lockinontimeout''', if LOCKED_IN is reached, ACTIVE will be reached either one retarget period later, or at '''minimum_activation_height''', whichever comes later.
97100

98101
The genesis block has state DEFINED for each deployment, by definition.
99102

@@ -153,10 +156,14 @@ If we have finished a period of MUST_SIGNAL, we transition directly to LOCKED_IN
153156
case MUST_SIGNAL:
154157
return LOCKED_IN;
155158
156-
After a retarget period of LOCKED_IN, we automatically transition to ACTIVE.
159+
After at least one retarget period of LOCKED_IN, we automatically transition to ACTIVE if the minimum activation height is reached. Otherwise LOCKED_IN continues.
157160

158161
case LOCKED_IN:
159-
return ACTIVE;
162+
if (block.height >= minimum_activation_height) {
163+
return ACTIVE;
164+
} else {
165+
return LOCKED_IN;
166+
}
160167
161168
And ACTIVE and FAILED are terminal states, which a deployment stays in once they're reached.
162169

bip-0008/states.dot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ digraph {
77
"DEFINED" -> "STARTED" [label="height >= start_height"];
88
"STARTED" -> "MUST_SIGNAL" [label="height + 2016 >= timeoutheight AND lockinontimeout"];
99
"STARTED" -> "FAILED" [label="height >= timeoutheight\nAND\nNOT lockinontimeout"];
10-
"LOCKED_IN" -> "ACTIVE" [label="always"];
10+
"LOCKED_IN" -> "ACTIVE" [label="height >= minimum_activation_height"];
11+
"LOCKED_IN":se -> "LOCKED_IN":ne [label="height < minimum_activation_height"];
1112
"MUST_SIGNAL" -> "LOCKED_IN" [label="always"];
1213

1314
edge [weight = 1];

bip-0008/states.png

14.1 KB
Loading

bip-0008/states.svg

Lines changed: 44 additions & 38 deletions
Loading

0 commit comments

Comments
 (0)