Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIP341: speedy trial activation parameters #1104

Merged
merged 5 commits into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion bip-0341.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,43 @@ Examples of preimage for sighashing for each of the sighash modes.

== Deployment ==

TODO
This BIP is deployed concurrently with [[bip-0342.mediawiki|BIP342]].
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Procedurally, should mention bip340 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bip340 on itself can not be deployed because it doesn't describe consensus rules. It is deployed only as part of bip341 and 342.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, make sense


For Bitcoin signet, these BIPs are always active.

For Bitcoin mainnet and testnet3, these BIPs will be deployed by "version bits" with the name "taproot" and bit 2, using [[bip-0009.mediawiki|BIP9]] modified to use a lower threshold, with an additional ''min_activation_height'' parameter and replacing the state transition logic for the DEFINED, STARTED and LOCKED_IN states as follows:

case DEFINED:
if (GetMedianTimePast(block.parent) >= starttime) {
return STARTED;
}
return DEFINED;

case STARTED:
int count = 0;
walk = block;
for (i = 0; i < 2016; i++) {
walk = walk.parent;
if ((walk.nVersion & 0xE0000000) == 0x20000000 && ((walk.nVersion >> bit) & 1) == 1) {
count++;
}
}
if (count >= threshold) {
return LOCKED_IN;
} else if (GetMedianTimePast(block.parent) >= timeout) {
return FAILED;
}
return STARTED;

case LOCKED_IN:
if (block.nHeight < min_activation_height) {
return LOCKED_IN;
}
return ACTIVE;

For Bitcoin mainnet, the starttime is epoch timestamp 1619222400 (midnight 24 April 2021 UTC), timeout is epoch timestamp 1628640000 (midnight 11 August 2021 UTC), the threshold is 1815 blocks (90%) instead of 1916 blocks (95%), and the min_activation_height is block 709632 (expected approximately 12 November 2021).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the datetime conversions but agree with @jnewbery that the wording is ambiguous.

>> Time.at(1619222400).to_time.utc
=> 2021-04-24 00:00:00 UTC

>> Time.at(1628640000).to_time.utc
=> 2021-08-11 00:00:00 UTC
Suggested change
For Bitcoin mainnet, the starttime is epoch timestamp 1619222400 (midnight 24 April 2021 UTC), timeout is epoch timestamp 1628640000 (midnight 11 August 2021 UTC), the threshold is 1815 blocks (90%) instead of 1916 blocks (95%), and the min_activation_height is block 709632 (expected approximately 12 November 2021).
For Bitcoin mainnet, the starttime is epoch timestamp 1619222400 (2021-04-24 00:00:00 UTC), timeout is epoch timestamp 1628640000 (2021-08-11 00:00:00 UTC), the threshold is 1815 blocks (90%) instead of 1916 blocks (95%), and the min_activation_height is block 709632 (expected approximately 12 November 2021).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base value of 2016 isn't currently mentioned in BIP341.

Suggested change
For Bitcoin mainnet, the starttime is epoch timestamp 1619222400 (midnight 24 April 2021 UTC), timeout is epoch timestamp 1628640000 (midnight 11 August 2021 UTC), the threshold is 1815 blocks (90%) instead of 1916 blocks (95%), and the min_activation_height is block 709632 (expected approximately 12 November 2021).
For Bitcoin mainnet, the starttime is epoch timestamp 1619222400 (midnight 24 April 2021 UTC), timeout is epoch timestamp 1628640000 (midnight 11 August 2021 UTC), the threshold is 1815 blocks (90% of the difficulty adjustment period of 2016 blocks) instead of 1916 blocks (95%), and the min_activation_height is block 709632 (expected approximately 12 November 2021).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's actually incidental that it lines up with difficulty, can be configured differently if needed.

1815/0.9 = 2016.66, 1814/0.9 = 2015.55 so 2016 is directly implied as the threshold block.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but explicit would be better. It's only indirectly referred to in the code example.


For Bitcoin testnet3, the starttime is epoch timestamp 1619222400 (midnight 24 April 2021 UTC), timeout is epoch timestamp 1628640000 (midnight 11 August 2021 UTC), the threshold is 1512 blocks (75%), and the min_activation_height is block 0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The same observations apply for this testnet3 sentence.)


== Backwards compatibility ==
As a soft fork, older software will continue to operate without modification.
Expand Down
4 changes: 4 additions & 0 deletions bip-0342.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ In addition to changing the semantics of a number of opcodes, there are also som

<references />

==Deployment==

This proposal is deployed identically to Taproot ([[bip-0341.mediawiki|BIP341]]).

==Examples==

==Acknowledgements==
Expand Down