Skip to content

Commit 5a4133f

Browse files
committed
feat: bury v20 deployment
1 parent 6c69808 commit 5a4133f

File tree

14 files changed

+46
-106
lines changed

14 files changed

+46
-106
lines changed

src/chainparams.cpp

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ class CMainParams : public CChainParams {
192192
consensus.DIP0024Height = 1737792; // 0000000000000001342be9c0b75ad40c276beaad91616423c4d9cb101b3db438
193193
consensus.DIP0024QuorumsHeight = 1738698; // 000000000000001aa25181e4c466e593992c98f9eb21c69ee757b8bb0af50244
194194
consensus.V19Height = 1899072; // 0000000000000015e32e73052d663626327004c81c5c22cb8b42c361015c0eae
195-
consensus.MinBIP9WarningHeight = 1899072 + 2016; // V19 activation height + miner confirmation window
195+
consensus.V20Height = 1987776; // 000000000000001bf41cff06b76780050682ca29e61a91c391893d4745579777
196+
consensus.MinBIP9WarningHeight = 1987776 + 2016; // V20 activation height + miner confirmation window
196197
consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
197198
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
198199
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@@ -207,14 +208,6 @@ class CMainParams : public CChainParams {
207208
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
208209
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
209210

210-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
211-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 1700006400; // November 15, 2023
212-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = 1731628800; // November 15, 2024
213-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 4032;
214-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 3226; // 80% of 4032
215-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 2420; // 60% of 4032
216-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
217-
218211
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
219212
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1704067200; // January 1, 2024
220213
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = 1767225600; // January 1, 2026
@@ -394,7 +387,8 @@ class CTestNetParams : public CChainParams {
394387
consensus.DIP0024Height = 769700; // 0000008d84e4efd890ae95c70a7a6126a70a80e5c19e4cb264a5b3469aeef172
395388
consensus.DIP0024QuorumsHeight = 770730; // 0000003c43b3ae7fffe61278ca5537a0e256ebf4d709d45f0ab040271074d51e
396389
consensus.V19Height = 850100; // 000004728b8ff2a16b9d4eebb0fd61eeffadc9c7fe4b0ec0b5a739869401ab5b
397-
consensus.MinBIP9WarningHeight = 850100 + 2016; // v19 activation height + miner confirmation window
390+
consensus.V20Height = 905100; // 0000020c5e0f86f385cbf8e90210de9a9fd63633f01433bf47a6b3227a2851fd
391+
consensus.MinBIP9WarningHeight = 905100 + 2016; // v19 activation height + miner confirmation window
398392
consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
399393
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
400394
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@@ -409,14 +403,6 @@ class CTestNetParams : public CChainParams {
409403
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
410404
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
411405

412-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
413-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 1693526400; // Friday, September 1, 2023 0:00:00
414-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
415-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 100;
416-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 80; // 80% of 100
417-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 60; // 60% of 100
418-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
419-
420406
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
421407
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1693526400; // Friday, September 1, 2023 0:00:00
422408
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
@@ -570,7 +556,8 @@ class CDevNetParams : public CChainParams {
570556
consensus.DIP0024Height = 300;
571557
consensus.DIP0024QuorumsHeight = 300;
572558
consensus.V19Height = 300;
573-
consensus.MinBIP9WarningHeight = 300 + 2016; // v19 activation height + miner confirmation window
559+
consensus.V20Height = 300;
560+
consensus.MinBIP9WarningHeight = 300 + 2016; // v20 activation height + miner confirmation window
574561
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
575562
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
576563
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@@ -585,14 +572,6 @@ class CDevNetParams : public CChainParams {
585572
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
586573
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
587574

588-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
589-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 1661990400; // Sep 1st, 2022
590-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
591-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 120;
592-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 80; // 80% of 100
593-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 60; // 60% of 100
594-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
595-
596575
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
597576
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1661990400; // Sep 1st, 2022
598577
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
@@ -810,6 +789,7 @@ class CRegTestParams : public CChainParams {
810789
consensus.DIP0024Height = 900;
811790
consensus.DIP0024QuorumsHeight = 900;
812791
consensus.V19Height = 900;
792+
consensus.V20Height = 1200;
813793
consensus.MinBIP9WarningHeight = 0;
814794
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
815795
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
@@ -826,14 +806,6 @@ class CRegTestParams : public CChainParams {
826806
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
827807
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
828808

829-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
830-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 0;
831-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
832-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 400;
833-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 384; // 80% of 480
834-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 288; // 60% of 480
835-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
836-
837809
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
838810
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 0;
839811
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
@@ -1062,6 +1034,8 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
10621034
consensus.DIP0008Height = int{height};
10631035
} else if (name == "dip0020") {
10641036
consensus.DIP0020Height = int{height};
1037+
} else if (name == "v20") {
1038+
consensus.V20Height = int{height};
10651039
} else {
10661040
throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg));
10671041
}

src/chainparamsbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
2222
argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2323
argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2424
argsman.AddArg("-bip147height=<activation>", "Override BIP147 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
25-
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0001, dip0008, dip0020). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
25+
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0001, dip0008, dip0020, v20). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
2626
argsman.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2727
argsman.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2828
argsman.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);

src/consensus/params.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ enum BuriedDeployment : int16_t {
3232
DEPLOYMENT_DIP0024,
3333
DEPLOYMENT_BRR,
3434
DEPLOYMENT_V19,
35+
DEPLOYMENT_V20,
3536
};
36-
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_V19; }
37+
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_V20; }
3738

3839
enum DeploymentPos : uint16_t {
3940
DEPLOYMENT_TESTDUMMY,
40-
DEPLOYMENT_V20, // Deployment of EHF, LLMQ Randomness Beacon
4141
DEPLOYMENT_MN_RR, // Deployment of Masternode Reward Location Reallocation
4242
// NOTE: Also add new deployments to VersionBitsDeploymentInfo in deploymentinfo.cpp
4343
MAX_VERSION_BITS_DEPLOYMENTS
@@ -142,6 +142,8 @@ struct Params {
142142
int DIP0024QuorumsHeight;
143143
/** Block height at which V19 (Basic BLS and EvoNodes) becomes active */
144144
int V19Height;
145+
/** Block height at which V20 (Deployment of EHF, LLMQ Randomness Beacon) becomes active */
146+
int V20Height;
145147
/** Don't warn about unknown BIP 9 activations below this height.
146148
* This prevents us from warning about the CSV and DIP activations. */
147149
int MinBIP9WarningHeight;
@@ -205,6 +207,8 @@ struct Params {
205207
return BRRHeight;
206208
case DEPLOYMENT_V19:
207209
return V19Height;
210+
case DEPLOYMENT_V20:
211+
return V20Height;
208212
} // no default case, so the compiler can warn about missing cases
209213
return std::numeric_limits<int>::max();
210214
}

src/deploymentinfo.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_B
1111
/*.name =*/ "testdummy",
1212
/*.gbt_force =*/ true,
1313
},
14-
{
15-
/*.name =*/"v20",
16-
/*.gbt_force =*/true,
17-
},
1814
{
1915
/*.name =*/"mn_rr",
2016
/*.gbt_force =*/true,
@@ -49,6 +45,8 @@ std::string DeploymentName(Consensus::BuriedDeployment dep)
4945
return "realloc";
5046
case Consensus::DEPLOYMENT_V19:
5147
return "v19";
48+
case Consensus::DEPLOYMENT_V20:
49+
return "v20";
5250
} // no default case, so the compiler can warn about missing cases
5351
return "";
5452
}

src/evo/mnhftx.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ std::optional<CMNHFManager::Signals> CMNHFManager::GetFromCache(const CBlockInde
319319
}
320320
{
321321
LOCK(cs_cache);
322-
if (ThresholdState::ACTIVE != v20_activation.State(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) {
322+
if (!DeploymentActiveAt(*pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) {
323323
mnhfCache.insert(blockHash, signals);
324324
return signals;
325325
}
@@ -340,10 +340,8 @@ void CMNHFManager::AddToCache(const Signals& signals, const CBlockIndex* const p
340340
LOCK(cs_cache);
341341
mnhfCache.insert(blockHash, signals);
342342
}
343-
{
344-
LOCK(cs_cache);
345-
if (ThresholdState::ACTIVE != v20_activation.State(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) return;
346-
}
343+
if (!DeploymentActiveAt(*pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) return;
344+
347345
m_evoDb.Write(std::make_pair(DB_SIGNALS, blockHash), signals);
348346
}
349347

src/evo/mnhftx.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ class CMNHFManager : public AbstractEHFManager
109109
// versionBit <-> height
110110
unordered_lru_cache<uint256, Signals, StaticSaltedHasher> mnhfCache GUARDED_BY(cs_cache) {MNHFCacheSize};
111111

112-
// This cache is used only for v20 activation to avoid double lock through VersionBitsConditionChecker::SignalHeight
113-
VersionBitsCache v20_activation GUARDED_BY(cs_cache);
114112
public:
115113
explicit CMNHFManager(CEvoDB& evoDb);
116114
~CMNHFManager();

src/governance/classes.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -490,21 +490,7 @@ CAmount CSuperblock::GetPaymentsLimit(const CChain& active_chain, int nBlockHeig
490490
return 0;
491491
}
492492

493-
const CBlockIndex* pindex = active_chain.Tip();
494-
if (pindex->nHeight > nBlockHeight) pindex = pindex->GetAncestor(nBlockHeight);
495-
496-
const auto v20_state = g_versionbitscache.State(pindex, consensusParams, Consensus::DEPLOYMENT_V20);
497-
bool fV20Active{v20_state == ThresholdState::ACTIVE};
498-
if (!fV20Active && nBlockHeight > pindex->nHeight) {
499-
// If fV20Active isn't active yet and nBlockHeight refers to a future SuperBlock
500-
// then we need to check if the fork is locked_in and see if it will be active by the time of the future SuperBlock
501-
if (v20_state == ThresholdState::LOCKED_IN) {
502-
int activation_height = g_versionbitscache.StateSinceHeight(pindex, consensusParams, Consensus::DEPLOYMENT_V20) + static_cast<int>(Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize);
503-
if (nBlockHeight >= activation_height) {
504-
fV20Active = true;
505-
}
506-
}
507-
}
493+
const bool fV20Active{nBlockHeight >= consensusParams.V20Height};
508494

509495
// min subsidy for high diff networks and vice versa
510496
int nBits = consensusParams.fPowAllowMinDifficultyBlocks ? UintToArith256(consensusParams.powLimit).GetCompact() : 1;

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,7 @@ RPCHelpMan getblockchaininfo()
18061806
SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_DIP0024);
18071807
SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_BRR);
18081808
SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_V19);
1809-
SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_V20);
1809+
SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_V20);
18101810
SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_MN_RR);
18111811
SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY);
18121812

src/test/util/setup_common.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,15 @@ TestChainSetup::TestChainSetup(int num_blocks, const std::vector<const char*>& e
337337
/* TestChain100Setup */
338338
{ 100, uint256S("0x6ffb83129c19ebdf1ae3771be6a67fe34b35f4c956326b9ba152fac1649f65ae") },
339339
/* TestChainDIP3BeforeActivationSetup */
340-
{ 430, uint256S("0x592b23a8882162ea48606e40c9ee00b2166ddae092c691d7f1b1758ec13647d9") },
340+
{ 430, uint256S("0x0bcefaa33fec56cd84d05d0e76cd6a78badcc20f627d91903646de6a07930a14") },
341341
/* TestChainDIP3Setup */
342-
{ 431, uint256S("0x49db248651517f3fc3725fbbc7087db90552d487d11e0962b0148fc4788aeb77") },
342+
{ 431, uint256S("0x5fd3aa5ef29464839499d7f847edd9362e3e73392b79d3bd88b1591f5fb17d4e") },
343343
/* TestChainBRRBeforeActivationSetup */
344-
{ 497, uint256S("0x626036f6adff51fbbdd0c609e827ef6a3730ce2498a3eb33edeb27092d006170") },
344+
{ 497, uint256S("0x23c31820ec5160b7181bfdf328e2b76cd12c9fa4544d892b7f01e74dd6220849") },
345345
/* TestChainV19BeforeActivationSetup */
346-
{ 894, uint256S("0x03cbf1871d7d915cda10aded00ced45f71a4e2acf6a3c7a77a1ff488267dd1cd") },
346+
{ 894, uint256S("0x2885cf0fe8fdf29803b6c65002ba2570ff011531d8ea92be312a85d655e00c51") },
347347
/* TestChainV19Setup */
348-
{ 899, uint256S("0x405a630e16d0ca0efe3abb0e24c9a157a69ec2e07b04333cc5d004efa634ac89") },
348+
{ 899, uint256S("0x7df3c857ce647b3ecd0d4b389b6b0f16e2bdc60b20a8d01c4ad946fe5f15dbc2") },
349349
}
350350
};
351351

test/functional/feature_cltv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ def set_test_params(self):
8888
f'-testactivationheight=cltv@{CLTV_HEIGHT}',
8989
'-whitelist=noban@127.0.0.1',
9090
'-dip3params=9000:9000',
91+
'-testactivationheight=v20@9000', # disabled for this test
9192
'-par=1', # Use only one script thread to get the exact reject reason for testing
9293
'-acceptnonstdtxn=1', # cltv_invalidate is nonstandard
93-
'-vbparams=v20:0:999999999999:0:480:384:288:5:0' # Delay v20 for this test as we don't need it
9494
]]
9595
self.setup_clean_chain = True
9696
self.rpc_timeout = 480

0 commit comments

Comments
 (0)