Skip to content

Commit ca8e9b8

Browse files
committed
BIP 8: Use block heights rather than MTP
1 parent 17e158b commit ca8e9b8

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

README.mediawiki

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Those proposing changes should consider that ultimately consent may rest with th
3131
| [[bip-0008.mediawiki|8]]
3232
|
3333
| Version bits 2017
34-
| Shaolin Fry
34+
| Shaolin Fry, Luke Dashjr
3535
| Informational
3636
| Draft
3737
|- style="background-color: #cfffcf"

bip-0008.mediawiki

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
BIP: 8
33
Title: Version bits 2017
44
Author: Shaolin Fry <[email protected]>
5+
Luke Dashjr <[email protected]>
56
Comments-Summary: No comments yet.
67
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0008
78
Status: Draft
@@ -13,12 +14,16 @@
1314

1415
==Abstract==
1516

16-
This document specifies an alternative to [[bip-0009.mediawiki|BIP9]] that introduces an additional activation parameter to guarantee activation of backward-compatible changes (further called "soft forks").
17+
This document specifies an alternative to [[bip-0009.mediawiki|BIP9]] that corrects for a number of perceived mistakes.
18+
Block heights are used for start and timeout rather than POSIX timestamps.
19+
It additionally introduces an additional activation parameter to guarantee activation of backward-compatible changes (further called "soft forks").
1720

1821
==Motivation==
1922

2023
BIP9 introduced a mechanism for doing parallel soft forking deployments based on repurposing the block nVersion field. Activation is dependent on near unanimous hashrate signalling which may be impractical and is also subject to veto by a small minority of non-signalling hashrate.
2124

25+
Due to using timestamps rather than block heights, it was found to be a risk that a sudden loss of siginificant hashrate could interfere with a late activation.
26+
2227
This specification provides a way to optionally guarantee lock-in at the end of the [[bip-0009.mediawiki|BIP9]] timeout, and therefore activation, while still allowing a hashrate super majority to trigger activation earlier.
2328

2429
==Specification==
@@ -27,8 +32,8 @@ Each soft fork deployment is specified by the following per-chain parameters (fu
2732

2833
# 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.
2934
# 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}.
30-
# The '''starttime''' specifies a minimum median time past of a block at which the bit gains its meaning.
31-
# The '''timeout''' specifies a time at which the deployment is considered failed. If the median time past of a block >= timeout and the soft fork has not yet locked in (including this block's bit state), the deployment is considered failed on all descendants of the block.
35+
# The '''start''' specifies the height of the first block at which the bit gains its meaning.
36+
# 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.
3237
# The '''lockinontimeout''' boolean if set to true, will transition state to '''LOCKED_IN''' at timeout if not already '''LOCKED_IN''' or '''ACTIVE'''.
3338
3439
===Selection guidelines===
@@ -37,22 +42,22 @@ The following guidelines are suggested for selecting these parameters for a soft
3742
3843
# '''name''' should be selected such that no two softforks, concurrent or otherwise, ever use the same name.
3944
# '''bit''' should be selected such that no two concurrent softforks use the same bit.
40-
# '''starttime''' should be set to some date 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.
41-
# '''timeout''' should be 1 year (31536000 seconds) after starttime.
45+
# '''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.
46+
# '''timeout''' should be approximately 1 year after start, and on a block which begins a retarget period. Therefore, '''start''' plus 52416.
4247
# '''lockinontimeout''' should be set to true for any softfork that isn't exclusively for miner benefit.
4348
44-
A later deployment using the same bit is possible as long as the starttime is after the previous one's
49+
A later deployment using the same bit is possible as long as the start is after the previous one's
4550
timeout or activation, but it is discouraged until necessary, and even then recommended to have a pause in between to detect buggy software.
4651
4752
===States===
4853
4954
With each block and soft fork, we associate a deployment state. The possible states are:
5055
5156
# '''DEFINED''' is the first state that each soft fork starts out as. The genesis block is by definition in this state for each deployment.
52-
# '''STARTED''' for blocks past the starttime.
57+
# '''STARTED''' for blocks at or beyond the start height.
5358
# '''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.
5459
# '''ACTIVE''' for all blocks after the LOCKED_IN retarget period.
55-
# '''FAILED''' for all blocks after the timeout time, if LOCKED_IN was not reached and '''lockinontimeout''' is false.
60+
# '''FAILED''' for all blocks after the timeout, if LOCKED_IN was not reached and '''lockinontimeout''' is false.
5661
5762
===Bit flags===
5863
@@ -97,15 +102,13 @@ Otherwise, the next state depends on the previous state:
97102
98103
switch (GetStateForBlock(GetAncestorAtHeight(block, block.height - 2016))) {
99104
100-
We remain in the initial state until either we pass the start time or the timeout. GetMedianTimePast in the code below
101-
refers to the median nTime of a block and its 10 predecessors. The expression GetMedianTimePast(block.parent) is
102-
referred to as MTP in the diagram above, and is treated as a monotonic clock defined by the chain.
105+
We remain in the initial state until either we pass the start height or the timeout.
103106
104107
case DEFINED:
105-
if (GetMedianTimePast(block.parent) >= timeout) {
108+
if (block.height >= timeout) {
106109
return (lockinontimeout == true) ? LOCKED_IN : FAILED;
107110
}
108-
if (GetMedianTimePast(block.parent) >= starttime) {
111+
if (block.height >= start) {
109112
return STARTED;
110113
}
111114
return DEFINED;
@@ -120,7 +123,7 @@ other one simultaneously transitions to STARTED, which would mean both would dem
120123
Note that a block's state never depends on its own nVersion; only on that of its ancestors.
121124
122125
case STARTED:
123-
if (GetMedianTimePast(block.parent) >= timeout) {
126+
if (block.height >= timeout) {
124127
return (lockinontimeout == true) ? LOCKED_IN : FAILED;
125128
}
126129
int count = 0;
@@ -175,6 +178,7 @@ https://github.com/bitcoin/bitcoin/compare/master...shaolinfry:bip-uaversionbits
175178
==Contrasted with BIP 9==
176179
177180
* The '''lockinontimeout''' flag is added. BIP 9 would only transition to the FAILED state when timeout was reached.
181+
* Block heights are used for the deployment monotonic clock, rather than median-time-past.
178182
179183
==Backwards compatibility==
180184

bip-0008/states.png

289 Bytes
Loading

bip-0008/states.svg

Lines changed: 5 additions & 5 deletions
Loading

0 commit comments

Comments
 (0)