mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-15 00:59:38 +02:00
Merge bitcoin/bitcoin#26201: Remove Taproot BIP 9 deployment
74f71c5054Remove Taproot activation height (Sjors Provoost) Pull request description: Drop `DEPLOYMENT_TAPROOT` from `consensus.vDeployments`. Now that the commit (7c08d81e11) which changes taproot to be enforced for all blocks is included in v24.0, it seems a good time to remove no longer needed non-consensus code. Clarify what is considered a `BuriedDeployment`. We drop taproot from `getdeploymentinfo` RPC, rather than mark it as `buried`, because this is not a buried deployment in the sense of [BIP 90](https://github.com/bitcoin/bips/blob/master/bip-0090.mediawiki). This is because the activation height has been completely removed from the code, unlike the hardcoded `DEPLOYMENT_SEGWIT` height which is still relied on.[^1] See discussion in #24737 and #26162. [^1]: `DEPLOYMENT_SEGWIT` is used in `IsBlockMutated` to determine if witness data is allowed, it's used for [BIP147](https://github.com/bitcoin/bips/blob/master/bip-0147.mediawiki), to trigger `NeedsRedownload()` for users who upgraded after a decade, and for a few other things. ACKs for top commit: ajtowns: reACK74f71c5054achow101: ACK74f71c5054sedited: Re-ACK74f71c5054darosior: utACK74f71c5054Tree-SHA512: 217e0ee2e144ccfb04cf012f45b75d08f8541287a5531bd18aa81e38bad2f38d28b772137f471c46b63875840ec044cb61a2a832e3a9e89a6183e8ab36b1b9c9
This commit is contained in:
4
doc/release-notes-26201.md
Normal file
4
doc/release-notes-26201.md
Normal file
@@ -0,0 +1,4 @@
|
||||
RPC
|
||||
---
|
||||
|
||||
- 'taproot' has been removed from 'getdeploymentinfo' because its historical activation height is no longer used anywhere in the codebase. (#26201)
|
||||
@@ -20,6 +20,7 @@ namespace Consensus {
|
||||
/**
|
||||
* A buried deployment is one where the height of the activation has been hardcoded into
|
||||
* the client implementation long after the consensus change has activated. See BIP 90.
|
||||
* Consensus changes for which the new rules are enforced from genesis are not listed here.
|
||||
*/
|
||||
enum BuriedDeployment : int16_t {
|
||||
// buried deployments get negative values to avoid overlap with DeploymentPos
|
||||
@@ -27,14 +28,16 @@ enum BuriedDeployment : int16_t {
|
||||
DEPLOYMENT_CLTV,
|
||||
DEPLOYMENT_DERSIG,
|
||||
DEPLOYMENT_CSV,
|
||||
// SCRIPT_VERIFY_WITNESS is enforced from genesis, but the check for downloading
|
||||
// missing witness data is not. BIP 147 also relies on hardcoded activation height.
|
||||
DEPLOYMENT_SEGWIT,
|
||||
};
|
||||
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_SEGWIT; }
|
||||
|
||||
enum DeploymentPos : uint16_t {
|
||||
DEPLOYMENT_TESTDUMMY,
|
||||
DEPLOYMENT_TAPROOT, // Deployment of Schnorr/Taproot (BIPs 340-342)
|
||||
// NOTE: Also add new deployments to VersionBitsDeploymentInfo in deploymentinfo.cpp
|
||||
// Removing an entry may require bumping MinBIP9WarningHeight.
|
||||
MAX_VERSION_BITS_DEPLOYMENTS
|
||||
};
|
||||
constexpr bool ValidDeployment(DeploymentPos dep) { return dep < MAX_VERSION_BITS_DEPLOYMENTS; }
|
||||
@@ -105,7 +108,7 @@ struct Params {
|
||||
* BIP 16 exception blocks. */
|
||||
int SegwitHeight;
|
||||
/** Don't warn about unknown BIP 9 activations below this height.
|
||||
* This prevents us from warning about the CSV and segwit activations. */
|
||||
* This prevents us from warning about the CSV, segwit and taproot activations. */
|
||||
int MinBIP9WarningHeight;
|
||||
std::array<BIP9Deployment,MAX_VERSION_BITS_DEPLOYMENTS> vDeployments;
|
||||
/** Proof of work parameters */
|
||||
|
||||
@@ -13,10 +13,6 @@ const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> Versi
|
||||
.name = "testdummy",
|
||||
.gbt_optional_rule = true,
|
||||
},
|
||||
VBDeploymentInfo{
|
||||
.name = "taproot",
|
||||
.gbt_optional_rule = true,
|
||||
},
|
||||
};
|
||||
|
||||
std::string DeploymentName(Consensus::BuriedDeployment dep)
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
|
||||
consensus.CSVHeight = 419328; // 000000000000000004a1b34462cb8aeebd5799177f7a29cf28f2d1961716b5b5
|
||||
consensus.SegwitHeight = 481824; // 0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893
|
||||
consensus.MinBIP9WarningHeight = 483840; // segwit activation height + miner confirmation window
|
||||
consensus.MinBIP9WarningHeight = 711648; // taproot activation height + miner confirmation window
|
||||
consensus.powLimit = uint256{"00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"};
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacing = 10 * 60;
|
||||
@@ -106,14 +106,6 @@ public:
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].threshold = 1815; // 90%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].period = 2016;
|
||||
|
||||
// Deployment of Taproot (BIPs 340-342)
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 1619222400; // April 24th, 2021
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1628640000; // August 11th, 2021
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 709632; // Approximately November 12th, 2021
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 1815; // 90%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 2016;
|
||||
|
||||
consensus.nMinimumChainWork = uint256{"0000000000000000000000000000000000000001128750f82f4c366153a3a030"};
|
||||
consensus.defaultAssumeValid = uint256{"00000000000000000000ccebd6d74d9194d8dcdc1d177c478e094bfad51ba5ac"}; // 938343
|
||||
|
||||
@@ -223,7 +215,7 @@ public:
|
||||
consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182
|
||||
consensus.CSVHeight = 770112; // 00000000025e930139bac5c6c31a403776da130831ab85be56578f3fa75369bb
|
||||
consensus.SegwitHeight = 834624; // 00000000002b980fcd729daaa248fd9316a5200e9b367f4ff2c42453e84201ca
|
||||
consensus.MinBIP9WarningHeight = 836640; // segwit activation height + miner confirmation window
|
||||
consensus.MinBIP9WarningHeight = 2013984; // taproot activation height + miner confirmation window
|
||||
consensus.powLimit = uint256{"00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"};
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacing = 10 * 60;
|
||||
@@ -237,14 +229,6 @@ public:
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].threshold = 1512; // 75%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].period = 2016;
|
||||
|
||||
// Deployment of Taproot (BIPs 340-342)
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 1619222400; // April 24th, 2021
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1628640000; // August 11th, 2021
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 1512; // 75%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 2016;
|
||||
|
||||
consensus.nMinimumChainWork = uint256{"0000000000000000000000000000000000000000000017dde1c649f3708d14b6"};
|
||||
consensus.defaultAssumeValid = uint256{"000000007a61e4230b28ac5cb6b5e5a0130de37ac1faf2f8987d2fa6505b67f4"}; // 4842348
|
||||
|
||||
@@ -345,14 +329,6 @@ public:
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].threshold = 1512; // 75%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].period = 2016;
|
||||
|
||||
// Deployment of Taproot (BIPs 340-342)
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 1512; // 75%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 2016;
|
||||
|
||||
consensus.nMinimumChainWork = uint256{"0000000000000000000000000000000000000000000009a0fe15d0177d086304"};
|
||||
consensus.defaultAssumeValid = uint256{"0000000002368b1e4ee27e2e85676ae6f9f9e69579b29093e9a82c170bf7cf8a"}; // 123613
|
||||
|
||||
@@ -496,14 +472,6 @@ public:
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].threshold = 1815; // 90%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].period = 2016;
|
||||
|
||||
// Activation of Taproot (BIPs 340-342)
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 1815; // 90%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 2016;
|
||||
|
||||
// message start is defined as the first 4 bytes of the sha256d of the block script
|
||||
HashWriter h{};
|
||||
h << consensus.signet_challenge;
|
||||
@@ -586,13 +554,6 @@ public:
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].threshold = 108; // 75%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].period = 144; // Faster than normal for regtest (144 instead of 2016)
|
||||
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].threshold = 108; // 75%
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].period = 144;
|
||||
|
||||
consensus.nMinimumChainWork = uint256{};
|
||||
consensus.defaultAssumeValid = uint256{};
|
||||
|
||||
|
||||
@@ -1481,7 +1481,6 @@ UniValue DeploymentInfo(const CBlockIndex* blockindex, const ChainstateManager&
|
||||
SoftForkDescPushBack(blockindex, softforks, chainman, Consensus::DEPLOYMENT_CSV);
|
||||
SoftForkDescPushBack(blockindex, softforks, chainman, Consensus::DEPLOYMENT_SEGWIT);
|
||||
SoftForkDescPushBack(blockindex, softforks, chainman, Consensus::DEPLOYMENT_TESTDUMMY);
|
||||
SoftForkDescPushBack(blockindex, softforks, chainman, Consensus::DEPLOYMENT_TAPROOT);
|
||||
return softforks;
|
||||
}
|
||||
} // anon namespace
|
||||
@@ -1489,7 +1488,8 @@ UniValue DeploymentInfo(const CBlockIndex* blockindex, const ChainstateManager&
|
||||
RPCHelpMan getdeploymentinfo()
|
||||
{
|
||||
return RPCHelpMan{"getdeploymentinfo",
|
||||
"Returns an object containing various state info regarding deployments of consensus changes.",
|
||||
"Returns an object containing various state info regarding deployments of consensus changes.\n"
|
||||
"Consensus changes for which the new rules are enforced from genesis are not listed in \"deployments\".",
|
||||
{
|
||||
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Default{"hash of current chain tip"}, "The block hash at which to query deployment state"},
|
||||
},
|
||||
|
||||
@@ -947,8 +947,14 @@ static RPCHelpMan getblocktemplate()
|
||||
result.pushKV("capabilities", std::move(aCaps));
|
||||
|
||||
UniValue aRules(UniValue::VARR);
|
||||
// See getblocktemplate changes in BIP 9:
|
||||
// ! indicates a more subtle change to the block structure or generation transaction
|
||||
// Otherwise clients may assume the rule will not impact usage of the template as-is.
|
||||
aRules.push_back("csv");
|
||||
if (!fPreSegWit) aRules.push_back("!segwit");
|
||||
if (!fPreSegWit) {
|
||||
aRules.push_back("!segwit");
|
||||
aRules.push_back("taproot");
|
||||
}
|
||||
if (consensusParams.signet_blocks) {
|
||||
// indicate to miner that they must understand signet rules
|
||||
// when attempting to mine with this template
|
||||
|
||||
@@ -436,6 +436,9 @@ class MiningTest(BitcoinTestFramework):
|
||||
self.log.info("getblocktemplate: segwit rule must be set")
|
||||
assert_raises_rpc_error(-8, "getblocktemplate must be called with the segwit rule set", node.getblocktemplate, {})
|
||||
|
||||
self.log.info("getblocktemplate: result should set the right rules")
|
||||
assert_equal(['csv', '!segwit', 'taproot'], self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['rules'])
|
||||
|
||||
self.log.info("submitblock: Test block decode failure")
|
||||
assert_raises_rpc_error(-22, "Block decode failed", node.submitblock, block.serialize()[:-15].hex())
|
||||
|
||||
|
||||
@@ -241,19 +241,6 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
},
|
||||
'active': False
|
||||
},
|
||||
'taproot': {
|
||||
'type': 'bip9',
|
||||
'bip9': {
|
||||
'start_time': -1,
|
||||
'timeout': 9223372036854775807,
|
||||
'min_activation_height': 0,
|
||||
'status': 'active',
|
||||
'status_next': 'active',
|
||||
'since': 0,
|
||||
},
|
||||
'height': 0,
|
||||
'active': True
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user