Skip to content

Commit

Permalink
Remove -tachyonactivationtime from CLI args & consensus rules
Browse files Browse the repository at this point in the history
Summary
---

Since this upgrade was relay-rules-only, the activation time is no
longer relevant for validating the blockchain itself, thus the time
should no longer be tracked or stored.

Additionally, since the activation logic was removed by a previous MR,
nothing was using this value in the codebase, and it was just dead code.

Summary of changes:

- removed the CLI arg `-tachyonactivationtime`
- removed the function IsTachyonEnabled in activation.cpp since nothing
  other than unit tests was calling it.
- removed the unit test that called this function since it is not needed
- removed `tachyonActivationTime` from the consensus params
- left comments in place about what the activation time once was where the
  old data used to live.

Test Plan
---

`ninja all check-all && ninja bench_bitcoin`
  • Loading branch information
cculianu committed May 20, 2021
1 parent 55ac736 commit 48ce9ee
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 67 deletions.
20 changes: 2 additions & 18 deletions src/chainparams.cpp
Expand Up @@ -134,8 +134,8 @@ class CMainParams : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC protocol upgrade
consensus.tachyonActivationTime = 1621080000;
// May 15, 2021 12:00:00 UTC protocol upgrade was 1621080000, but since this upgrade was for relay rules only,
// we do not track this time (since it does not apply at all to the blockchain itself).

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;
Expand Down Expand Up @@ -345,10 +345,6 @@ class CTestNetParams : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC tentative protocol upgrade
// (always active on test networks)
consensus.tachyonActivationTime = 0;

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;

Expand Down Expand Up @@ -519,10 +515,6 @@ class CTestNet4Params : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC tentative protocol upgrade
// (always active on test networks)
consensus.tachyonActivationTime = 0;

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;

Expand Down Expand Up @@ -666,10 +658,6 @@ class CScaleNetParams : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC tentative protocol upgrade
// (always active on test networks)
consensus.tachyonActivationTime = 0;

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;

Expand Down Expand Up @@ -797,10 +785,6 @@ class CRegTestParams : public CChainParams {
// Nov 15, 2020 12:00:00 UTC protocol upgrade
consensus.axionActivationTime = 1605441600;

// May 15, 2021 12:00:00 UTC tentative protocol upgrade
// (always active on test networks)
consensus.tachyonActivationTime = 0;

// May 15, 2022 12:00:00 UTC tentative protocol upgrade
consensus.upgrade8ActivationTime = 1652616000;

Expand Down
10 changes: 0 additions & 10 deletions src/consensus/activation.cpp
Expand Up @@ -91,16 +91,6 @@ bool IsAxionEnabled(const Consensus::Params &params,
gArgs.GetArg("-axionactivationtime", params.axionActivationTime);
}

bool IsTachyonEnabled(const Consensus::Params &params,
const CBlockIndex *pindexPrev) {
if (pindexPrev == nullptr) {
return false;
}

return pindexPrev->GetMedianTimePast() >=
gArgs.GetArg("-tachyonactivationtime", params.tachyonActivationTime);
}

bool IsUpgrade8Enabled(const Consensus::Params &params, const CBlockIndex *pindexPrev) {
if (pindexPrev == nullptr) {
return false;
Expand Down
5 changes: 2 additions & 3 deletions src/consensus/activation.h
Expand Up @@ -39,9 +39,8 @@ bool IsPhononEnabled(const Consensus::Params &params,
bool IsAxionEnabled(const Consensus::Params &params,
const CBlockIndex *pindexPrev);

/** Check if May 15th, 2021 protocol upgrade has activated. */
bool IsTachyonEnabled(const Consensus::Params &params,
const CBlockIndex *pindexPrev);
/** Note: May 15th, 2021 protocol upgrade was relay-only, and has no on-chain rules.
* The function "IsTachyonEnabled" that used to live here has been removed. */

/** Check if tentative May 15th, 2022 protocol upgrade has activated. */
bool IsUpgrade8Enabled(const Consensus::Params &params, const CBlockIndex *pindexPrev);
Expand Down
6 changes: 4 additions & 2 deletions src/consensus/params.h
Expand Up @@ -43,8 +43,10 @@ struct Params {
int phononHeight;
/** Unix time used for MTP activation of 15 Nov 2020 12:00:00 UTC upgrade */
int axionActivationTime;
/** Unix time used for tentative MTP activation of 15 May 2021 12:00:00 UTC upgrade */
int tachyonActivationTime;

/** Note: Unix time used for MTP activation of the 15 May 2021 12:00:00 UTC upgrade was 1621080000, but since
* it was a relay-rules-only upgrade, so we no longer track this time for blockchain consensus. */

/** Unix time used for tentative MTP activation of 15 May 2022 12:00:00 UTC upgrade */
int64_t upgrade8ActivationTime;
/** Default blocksize limit -- can be overridden with the -excessiveblocksize= command-line switch */
Expand Down
7 changes: 0 additions & 7 deletions src/init.cpp
Expand Up @@ -941,13 +941,6 @@ void SetupServerArgs() {
"default: %d). This option only has an effect on regtest or scalenet.",
defaultChainParams->GetConsensus().axionActivationTime),
true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg(
"-tachyonactivationtime=<n>",
strprintf("Activation time of the May 2021 Bitcoin Cash Network Upgrade "
"(<n> seconds since epoch, default: %d, non-mainnet: %d)",
defaultChainParams->GetConsensus().tachyonActivationTime,
testnetChainParams->GetConsensus().tachyonActivationTime),
true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg(
"-upgrade8activationtime=<n>",
strprintf("Activation time of the tentative May 2022 Bitcoin Cash Network Upgrade (<n> seconds since epoch, "
Expand Down
26 changes: 0 additions & 26 deletions src/test/activation_tests.cpp
Expand Up @@ -104,32 +104,6 @@ BOOST_AUTO_TEST_CASE(isaxionenabled) {
}
}

BOOST_AUTO_TEST_CASE(istachyonenabled) {
CBlockIndex prev;

const Consensus::Params &params = Params().GetConsensus();
const auto activation =
gArgs.GetArg("-tachyonctivationtime", params.tachyonActivationTime);
SetMockTime(activation - 1000000);

BOOST_CHECK(!IsTachyonEnabled(params, nullptr));

std::array<CBlockIndex, 12> blocks;
for (size_t i = 1; i < blocks.size(); ++i) {
blocks[i].pprev = &blocks[i - 1];
}
BOOST_CHECK(!IsTachyonEnabled(params, &blocks.back()));

SetMTP(blocks, activation - 1);
BOOST_CHECK(!IsTachyonEnabled(params, &blocks.back()));

SetMTP(blocks, activation);
BOOST_CHECK(IsTachyonEnabled(params, &blocks.back()));

SetMTP(blocks, activation + 1);
BOOST_CHECK(IsTachyonEnabled(params, &blocks.back()));
}

BOOST_AUTO_TEST_CASE(isupgrade8enabled) {
CBlockIndex prev;

Expand Down
1 change: 0 additions & 1 deletion src/test/main.cpp
Expand Up @@ -23,7 +23,6 @@ struct CustomArgumentsFixture {
const std::set<std::string> testArgs = {
testsuitename,
"-axionactivationtime",
"-tachyonactivationtime",
};

for (const auto &arg : testArgs) {
Expand Down

0 comments on commit 48ce9ee

Please sign in to comment.