Skip to content

Commit

Permalink
Bury taproot deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke authored and ajtowns committed May 23, 2022
1 parent fcf6c8f commit 710adad
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 45 deletions.
29 changes: 6 additions & 23 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class CMainParams : public CChainParams {
consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
consensus.CSVHeight = 419328; // 000000000000000004a1b34462cb8aeebd5799177f7a29cf28f2d1961716b5b5
consensus.SegwitHeight = 481824; // 0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893
consensus.TaprootHeight = 709632; // 0000000000000000000687bca986194dc2c1f949318629b44bb54ec0a94d8244
consensus.MinBIP9WarningHeight = 483840; // segwit activation height + miner confirmation window
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand All @@ -85,12 +86,6 @@ class CMainParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay

// 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.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000002927cdceccbd5209e81e80db");
consensus.defaultAssumeValid = uint256S("0x000000000000000000052d314a259755ca65944e68df6b12a067ea8f1f5a7091"); // 724466

Expand Down Expand Up @@ -191,6 +186,7 @@ class CTestNetParams : public CChainParams {
consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182
consensus.CSVHeight = 770112; // 00000000025e930139bac5c6c31a403776da130831ab85be56578f3fa75369bb
consensus.SegwitHeight = 834624; // 00000000002b980fcd729daaa248fd9316a5200e9b367f4ff2c42453e84201ca
consensus.TaprootHeight = 2011968; // 000000000000eb906ab072652b86b05a1afeb95df53ed5c5a63aa3574e1f1b33
consensus.MinBIP9WarningHeight = 836640; // segwit activation height + miner confirmation window
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand All @@ -204,12 +200,6 @@ class CTestNetParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay

// 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.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000064728c7be6fe4b2f961");
consensus.defaultAssumeValid = uint256S("0x00000000000163cfb1f97c4e4098a3692c8053ad9cab5ad9c86b338b5c00b8b7"); // 2143398

Expand Down Expand Up @@ -330,6 +320,7 @@ class SigNetParams : public CChainParams {
consensus.BIP66Height = 1;
consensus.CSVHeight = 1;
consensus.SegwitHeight = 1;
consensus.TaprootHeight = 1;
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
consensus.nPowTargetSpacing = 10 * 60;
consensus.fPowAllowMinDifficultyBlocks = false;
Expand All @@ -343,12 +334,6 @@ class SigNetParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay

// 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

// message start is defined as the first 4 bytes of the sha256d of the block script
CHashWriter h(SER_DISK, 0);
h << consensus.signet_challenge;
Expand Down Expand Up @@ -398,6 +383,7 @@ class CRegTestParams : public CChainParams {
consensus.BIP66Height = 1; // Always active unless overridden
consensus.CSVHeight = 1; // Always active unless overridden
consensus.SegwitHeight = 0; // Always active unless overridden
consensus.TaprootHeight = 1; // Always active unless overridden
consensus.MinBIP9WarningHeight = 0;
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand All @@ -412,11 +398,6 @@ class CRegTestParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay

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.nMinimumChainWork = uint256{};
consensus.defaultAssumeValid = uint256{};

Expand Down Expand Up @@ -512,6 +493,8 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
consensus.BIP65Height = int{height};
} else if (name == "csv") {
consensus.CSVHeight = int{height};
} else if (name == "taproot") {
consensus.TaprootHeight = int{height};
} else {
throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg));
}
Expand Down
8 changes: 6 additions & 2 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ enum BuriedDeployment : int16_t {
DEPLOYMENT_DERSIG,
DEPLOYMENT_CSV,
DEPLOYMENT_SEGWIT,
DEPLOYMENT_TAPROOT,
};
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_SEGWIT; }
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_TAPROOT; }

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
MAX_VERSION_BITS_DEPLOYMENTS
};
Expand Down Expand Up @@ -85,6 +85,8 @@ struct Params {
* Note that segwit v0 script rules are enforced on all blocks except the
* BIP 16 exception blocks. */
int SegwitHeight;
/** Block height at which Schnorr/Taproot (BIPs 340-342) becomes active. */
int TaprootHeight;
/** Don't warn about unknown BIP 9 activations below this height.
* This prevents us from warning about the CSV and segwit activations. */
int MinBIP9WarningHeight;
Expand Down Expand Up @@ -128,6 +130,8 @@ struct Params {
return CSVHeight;
case DEPLOYMENT_SEGWIT:
return SegwitHeight;
case DEPLOYMENT_TAPROOT:
return TaprootHeight;
} // no default case, so the compiler can warn about missing cases
return std::numeric_limits<int>::max();
}
Expand Down
6 changes: 2 additions & 4 deletions src/deploymentinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_B
/*.name =*/ "testdummy",
/*.gbt_force =*/ true,
},
{
/*.name =*/ "taproot",
/*.gbt_force =*/ true,
},
};

std::string DeploymentName(Consensus::BuriedDeployment dep)
Expand All @@ -31,6 +27,8 @@ std::string DeploymentName(Consensus::BuriedDeployment dep)
return "csv";
case Consensus::DEPLOYMENT_SEGWIT:
return "segwit";
case Consensus::DEPLOYMENT_TAPROOT:
return "taproot";
} // no default case, so the compiler can warn about missing cases
return "";
}
2 changes: 1 addition & 1 deletion test/functional/feature_taproot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ def set_test_params(self):
if self.options.previous_release:
self.wallet_names = [None, self.default_wallet_name]
else:
self.extra_args[0].append("-vbparams=taproot:1:1")
self.extra_args[0].append("-testactivationheight=taproot@999999")

def setup_nodes(self):
self.add_nodes(self.num_nodes, self.extra_args, versions=[
Expand Down
16 changes: 2 additions & 14 deletions test/functional/rpc_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def check_signalling_deploymentinfo_result(self, gdi_result, height, blockhash,
'bip65': {'type': 'buried', 'active': True, 'height': 4},
'csv': {'type': 'buried', 'active': True, 'height': 5},
'segwit': {'type': 'buried', 'active': True, 'height': 6},
'taproot': {'type': 'buried', 'active': True, 'height': 1},
'testdummy': {
'type': 'bip9',
'bip9': {
Expand All @@ -213,20 +214,7 @@ def check_signalling_deploymentinfo_result(self, gdi_result, height, blockhash,
},
'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
}
}
}
})

def _test_getdeploymentinfo(self):
Expand Down
6 changes: 5 additions & 1 deletion test/functional/wallet_taproot.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ class WalletTaprootTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 3
self.setup_clean_chain = True
self.extra_args = [['-keypool=100'], ['-keypool=100'], ["-vbparams=taproot:1:1"]]
self.extra_args = [
['-keypool=100'],
['-keypool=100'],
["-testactivationheight=taproot@999999"],
]
self.supports_cli = False

def skip_test_if_missing_module(self):
Expand Down

0 comments on commit 710adad

Please sign in to comment.