feat: bury v20 deployment

This commit is contained in:
Konstantin Akimov 2024-08-13 17:10:24 +07:00
parent 64cedb30bd
commit 1087489fd4
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
14 changed files with 46 additions and 109 deletions

View File

@ -192,7 +192,8 @@ public:
consensus.DIP0024Height = 1737792; // 0000000000000001342be9c0b75ad40c276beaad91616423c4d9cb101b3db438 consensus.DIP0024Height = 1737792; // 0000000000000001342be9c0b75ad40c276beaad91616423c4d9cb101b3db438
consensus.DIP0024QuorumsHeight = 1738698; // 000000000000001aa25181e4c466e593992c98f9eb21c69ee757b8bb0af50244 consensus.DIP0024QuorumsHeight = 1738698; // 000000000000001aa25181e4c466e593992c98f9eb21c69ee757b8bb0af50244
consensus.V19Height = 1899072; // 0000000000000015e32e73052d663626327004c81c5c22cb8b42c361015c0eae consensus.V19Height = 1899072; // 0000000000000015e32e73052d663626327004c81c5c22cb8b42c361015c0eae
consensus.MinBIP9WarningHeight = 1899072 + 2016; // V19 activation height + miner confirmation window consensus.V20Height = 1987776; // 000000000000001bf41cff06b76780050682ca29e61a91c391893d4745579777
consensus.MinBIP9WarningHeight = 1987776 + 2016; // V20 activation height + miner confirmation window
consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20 consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@ -207,14 +208,6 @@ public:
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; 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_TESTDUMMY].min_activation_height = 0; // No activation delay
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 1700006400; // November 15, 2023
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = 1731628800; // November 15, 2024
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 4032;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 3226; // 80% of 4032
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 2420; // 60% of 4032
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10; consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1704067200; // January 1, 2024 consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1704067200; // January 1, 2024
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = 1767225600; // January 1, 2026 consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = 1767225600; // January 1, 2026
@ -394,7 +387,8 @@ public:
consensus.DIP0024Height = 769700; // 0000008d84e4efd890ae95c70a7a6126a70a80e5c19e4cb264a5b3469aeef172 consensus.DIP0024Height = 769700; // 0000008d84e4efd890ae95c70a7a6126a70a80e5c19e4cb264a5b3469aeef172
consensus.DIP0024QuorumsHeight = 770730; // 0000003c43b3ae7fffe61278ca5537a0e256ebf4d709d45f0ab040271074d51e consensus.DIP0024QuorumsHeight = 770730; // 0000003c43b3ae7fffe61278ca5537a0e256ebf4d709d45f0ab040271074d51e
consensus.V19Height = 850100; // 000004728b8ff2a16b9d4eebb0fd61eeffadc9c7fe4b0ec0b5a739869401ab5b consensus.V19Height = 850100; // 000004728b8ff2a16b9d4eebb0fd61eeffadc9c7fe4b0ec0b5a739869401ab5b
consensus.MinBIP9WarningHeight = 850100 + 2016; // v19 activation height + miner confirmation window consensus.V20Height = 905100; // 0000020c5e0f86f385cbf8e90210de9a9fd63633f01433bf47a6b3227a2851fd
consensus.MinBIP9WarningHeight = 905100 + 2016; // v19 activation height + miner confirmation window
consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20 consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@ -409,14 +403,6 @@ public:
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; 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_TESTDUMMY].min_activation_height = 0; // No activation delay
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 1693526400; // Friday, September 1, 2023 0:00:00
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 80; // 80% of 100
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 60; // 60% of 100
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10; consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1693526400; // Friday, September 1, 2023 0:00:00 consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1693526400; // Friday, September 1, 2023 0:00:00
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
@ -570,7 +556,8 @@ public:
consensus.DIP0024Height = 300; consensus.DIP0024Height = 300;
consensus.DIP0024QuorumsHeight = 300; consensus.DIP0024QuorumsHeight = 300;
consensus.V19Height = 300; consensus.V19Height = 300;
consensus.MinBIP9WarningHeight = 300 + 2016; // v19 activation height + miner confirmation window consensus.V20Height = 300;
consensus.MinBIP9WarningHeight = 300 + 2016; // v20 activation height + miner confirmation window
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1 consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@ -585,14 +572,6 @@ public:
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; 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_TESTDUMMY].min_activation_height = 0; // No activation delay
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 1661990400; // Sep 1st, 2022
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 120;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 80; // 80% of 100
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 60; // 60% of 100
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10; consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1661990400; // Sep 1st, 2022 consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1661990400; // Sep 1st, 2022
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
@ -810,6 +789,7 @@ public:
consensus.DIP0024Height = 900; consensus.DIP0024Height = 900;
consensus.DIP0024QuorumsHeight = 900; consensus.DIP0024QuorumsHeight = 900;
consensus.V19Height = 900; consensus.V19Height = 900;
consensus.V20Height = 1200;
consensus.MinBIP9WarningHeight = 0; consensus.MinBIP9WarningHeight = 0;
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1 consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
@ -826,14 +806,6 @@ public:
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; 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_TESTDUMMY].min_activation_height = 0; // No activation delay
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 400;
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 384; // 80% of 480
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 288; // 60% of 480
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10; consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 0; consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
@ -1062,6 +1034,8 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
consensus.DIP0008Height = int{height}; consensus.DIP0008Height = int{height};
} else if (name == "dip0020") { } else if (name == "dip0020") {
consensus.DIP0020Height = int{height}; consensus.DIP0020Height = int{height};
} else if (name == "v20") {
consensus.V20Height = int{height};
} else { } else {
throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg)); throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg));
} }

View File

@ -22,7 +22,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-bip147height=<activation>", "Override BIP147 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-bip147height=<activation>", "Override BIP147 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
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); 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);
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); 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);
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); 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);
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); 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);

View File

@ -32,12 +32,12 @@ enum BuriedDeployment : int16_t {
DEPLOYMENT_DIP0024, DEPLOYMENT_DIP0024,
DEPLOYMENT_BRR, DEPLOYMENT_BRR,
DEPLOYMENT_V19, DEPLOYMENT_V19,
DEPLOYMENT_V20,
}; };
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_V19; } constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_V20; }
enum DeploymentPos : uint16_t { enum DeploymentPos : uint16_t {
DEPLOYMENT_TESTDUMMY, DEPLOYMENT_TESTDUMMY,
DEPLOYMENT_V20, // Deployment of EHF, LLMQ Randomness Beacon
DEPLOYMENT_MN_RR, // Deployment of Masternode Reward Location Reallocation DEPLOYMENT_MN_RR, // Deployment of Masternode Reward Location Reallocation
// NOTE: Also add new deployments to VersionBitsDeploymentInfo in deploymentinfo.cpp // NOTE: Also add new deployments to VersionBitsDeploymentInfo in deploymentinfo.cpp
MAX_VERSION_BITS_DEPLOYMENTS MAX_VERSION_BITS_DEPLOYMENTS
@ -142,6 +142,8 @@ struct Params {
int DIP0024QuorumsHeight; int DIP0024QuorumsHeight;
/** Block height at which V19 (Basic BLS and EvoNodes) becomes active */ /** Block height at which V19 (Basic BLS and EvoNodes) becomes active */
int V19Height; int V19Height;
/** Block height at which V20 (Deployment of EHF, LLMQ Randomness Beacon) becomes active */
int V20Height;
/** Don't warn about unknown BIP 9 activations below this height. /** Don't warn about unknown BIP 9 activations below this height.
* This prevents us from warning about the CSV and DIP activations. */ * This prevents us from warning about the CSV and DIP activations. */
int MinBIP9WarningHeight; int MinBIP9WarningHeight;
@ -205,6 +207,8 @@ struct Params {
return BRRHeight; return BRRHeight;
case DEPLOYMENT_V19: case DEPLOYMENT_V19:
return V19Height; return V19Height;
case DEPLOYMENT_V20:
return V20Height;
} // no default case, so the compiler can warn about missing cases } // no default case, so the compiler can warn about missing cases
return std::numeric_limits<int>::max(); return std::numeric_limits<int>::max();
} }

View File

@ -11,10 +11,6 @@ const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_B
/*.name =*/ "testdummy", /*.name =*/ "testdummy",
/*.gbt_force =*/ true, /*.gbt_force =*/ true,
}, },
{
/*.name =*/"v20",
/*.gbt_force =*/true,
},
{ {
/*.name =*/"mn_rr", /*.name =*/"mn_rr",
/*.gbt_force =*/true, /*.gbt_force =*/true,
@ -49,6 +45,8 @@ std::string DeploymentName(Consensus::BuriedDeployment dep)
return "realloc"; return "realloc";
case Consensus::DEPLOYMENT_V19: case Consensus::DEPLOYMENT_V19:
return "v19"; return "v19";
case Consensus::DEPLOYMENT_V20:
return "v20";
} // no default case, so the compiler can warn about missing cases } // no default case, so the compiler can warn about missing cases
return ""; return "";
} }

View File

@ -319,7 +319,7 @@ std::optional<CMNHFManager::Signals> CMNHFManager::GetFromCache(const CBlockInde
} }
{ {
LOCK(cs_cache); LOCK(cs_cache);
if (ThresholdState::ACTIVE != v20_activation.State(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) { if (!DeploymentActiveAt(*pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) {
mnhfCache.insert(blockHash, signals); mnhfCache.insert(blockHash, signals);
return signals; return signals;
} }
@ -340,10 +340,8 @@ void CMNHFManager::AddToCache(const Signals& signals, const CBlockIndex* const p
LOCK(cs_cache); LOCK(cs_cache);
mnhfCache.insert(blockHash, signals); mnhfCache.insert(blockHash, signals);
} }
{ if (!DeploymentActiveAt(*pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) return;
LOCK(cs_cache);
if (ThresholdState::ACTIVE != v20_activation.State(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) return;
}
m_evoDb.Write(std::make_pair(DB_SIGNALS, blockHash), signals); m_evoDb.Write(std::make_pair(DB_SIGNALS, blockHash), signals);
} }

View File

@ -109,8 +109,6 @@ private:
// versionBit <-> height // versionBit <-> height
unordered_lru_cache<uint256, Signals, StaticSaltedHasher> mnhfCache GUARDED_BY(cs_cache) {MNHFCacheSize}; unordered_lru_cache<uint256, Signals, StaticSaltedHasher> mnhfCache GUARDED_BY(cs_cache) {MNHFCacheSize};
// This cache is used only for v20 activation to avoid double lock through VersionBitsConditionChecker::SignalHeight
VersionBitsCache v20_activation GUARDED_BY(cs_cache);
public: public:
explicit CMNHFManager(CEvoDB& evoDb); explicit CMNHFManager(CEvoDB& evoDb);
~CMNHFManager(); ~CMNHFManager();

View File

@ -490,21 +490,7 @@ CAmount CSuperblock::GetPaymentsLimit(const CChain& active_chain, int nBlockHeig
return 0; return 0;
} }
const CBlockIndex* pindex = active_chain.Tip(); const bool fV20Active{nBlockHeight >= consensusParams.V20Height};
if (pindex->nHeight > nBlockHeight) pindex = pindex->GetAncestor(nBlockHeight);
const auto v20_state = g_versionbitscache.State(pindex, consensusParams, Consensus::DEPLOYMENT_V20);
bool fV20Active{v20_state == ThresholdState::ACTIVE};
if (!fV20Active && nBlockHeight > pindex->nHeight) {
// If fV20Active isn't active yet and nBlockHeight refers to a future SuperBlock
// 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
if (v20_state == ThresholdState::LOCKED_IN) {
int activation_height = g_versionbitscache.StateSinceHeight(pindex, consensusParams, Consensus::DEPLOYMENT_V20) + static_cast<int>(Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize);
if (nBlockHeight >= activation_height) {
fV20Active = true;
}
}
}
// min subsidy for high diff networks and vice versa // min subsidy for high diff networks and vice versa
int nBits = consensusParams.fPowAllowMinDifficultyBlocks ? UintToArith256(consensusParams.powLimit).GetCompact() : 1; int nBits = consensusParams.fPowAllowMinDifficultyBlocks ? UintToArith256(consensusParams.powLimit).GetCompact() : 1;

View File

@ -1806,7 +1806,7 @@ RPCHelpMan getblockchaininfo()
SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_DIP0024); SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_DIP0024);
SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_BRR); SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_BRR);
SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_V19); SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_V19);
SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_V20); SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_V20);
SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_MN_RR); SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_MN_RR);
SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY); SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY);

View File

@ -337,15 +337,15 @@ TestChainSetup::TestChainSetup(int num_blocks, const std::vector<const char*>& e
/* TestChain100Setup */ /* TestChain100Setup */
{ 100, uint256S("0x6ffb83129c19ebdf1ae3771be6a67fe34b35f4c956326b9ba152fac1649f65ae") }, { 100, uint256S("0x6ffb83129c19ebdf1ae3771be6a67fe34b35f4c956326b9ba152fac1649f65ae") },
/* TestChainDIP3BeforeActivationSetup */ /* TestChainDIP3BeforeActivationSetup */
{ 430, uint256S("0x592b23a8882162ea48606e40c9ee00b2166ddae092c691d7f1b1758ec13647d9") }, { 430, uint256S("0x0bcefaa33fec56cd84d05d0e76cd6a78badcc20f627d91903646de6a07930a14") },
/* TestChainDIP3Setup */ /* TestChainDIP3Setup */
{ 431, uint256S("0x49db248651517f3fc3725fbbc7087db90552d487d11e0962b0148fc4788aeb77") }, { 431, uint256S("0x5fd3aa5ef29464839499d7f847edd9362e3e73392b79d3bd88b1591f5fb17d4e") },
/* TestChainBRRBeforeActivationSetup */ /* TestChainBRRBeforeActivationSetup */
{ 497, uint256S("0x626036f6adff51fbbdd0c609e827ef6a3730ce2498a3eb33edeb27092d006170") }, { 497, uint256S("0x23c31820ec5160b7181bfdf328e2b76cd12c9fa4544d892b7f01e74dd6220849") },
/* TestChainV19BeforeActivationSetup */ /* TestChainV19BeforeActivationSetup */
{ 894, uint256S("0x03cbf1871d7d915cda10aded00ced45f71a4e2acf6a3c7a77a1ff488267dd1cd") }, { 894, uint256S("0x2885cf0fe8fdf29803b6c65002ba2570ff011531d8ea92be312a85d655e00c51") },
/* TestChainV19Setup */ /* TestChainV19Setup */
{ 899, uint256S("0x405a630e16d0ca0efe3abb0e24c9a157a69ec2e07b04333cc5d004efa634ac89") }, { 899, uint256S("0x7df3c857ce647b3ecd0d4b389b6b0f16e2bdc60b20a8d01c4ad946fe5f15dbc2") },
} }
}; };

View File

@ -88,9 +88,9 @@ class BIP65Test(BitcoinTestFramework):
f'-testactivationheight=cltv@{CLTV_HEIGHT}', f'-testactivationheight=cltv@{CLTV_HEIGHT}',
'-whitelist=noban@127.0.0.1', '-whitelist=noban@127.0.0.1',
'-dip3params=9000:9000', '-dip3params=9000:9000',
'-testactivationheight=v20@9000', # disabled for this test
'-par=1', # Use only one script thread to get the exact reject reason for testing '-par=1', # Use only one script thread to get the exact reject reason for testing
'-acceptnonstdtxn=1', # cltv_invalidate is nonstandard '-acceptnonstdtxn=1', # cltv_invalidate is nonstandard
'-vbparams=v20:0:999999999999:0:480:384:288:5:0' # Delay v20 for this test as we don't need it
]] ]]
self.setup_clean_chain = True self.setup_clean_chain = True
self.rpc_timeout = 480 self.rpc_timeout = 480

View File

@ -50,10 +50,11 @@ class BIP66Test(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [[ self.extra_args = [[
f'-testactivationheight=dersig@{DERSIG_HEIGHT}', f'-testactivationheight=dersig@{DERSIG_HEIGHT}',
'-testactivationheight=v20@9000', # due to changes in CbTx
'-whitelist=noban@127.0.0.1', '-whitelist=noban@127.0.0.1',
'-dip3params=9000:9000', '-dip3params=9000:9000',
'-par=1', # Use only one script thread to get the exact log msg for testing '-par=1', # Use only one script thread to get the exact log msg for testing
'-vbparams=v20:0:999999999999:0:480:384:288:5:0']] ]]
self.setup_clean_chain = True self.setup_clean_chain = True
self.rpc_timeout = 240 self.rpc_timeout = 240

View File

@ -9,27 +9,22 @@ import json
from test_framework.messages import uint256_to_string from test_framework.messages import uint256_to_string
from test_framework.test_framework import DashTestFramework from test_framework.test_framework import DashTestFramework
from test_framework.governance import have_trigger_for_height, prepare_object from test_framework.governance import have_trigger_for_height, prepare_object
from test_framework.util import assert_equal, satoshi_round, set_node_times, wait_until_helper from test_framework.util import assert_equal, satoshi_round, wait_until_helper
class DashGovernanceTest (DashTestFramework): class DashGovernanceTest (DashTestFramework):
def set_test_params(self): def set_test_params(self):
self.v20_start_time = 1417713500 + 80 self.set_dash_test_params(6, 5, [[
# using adjusted v20 deployment params to test an edge case where superblock maturity window is equal to deployment window size "-budgetparams=10:10:10",
self.set_dash_test_params(6, 5, [["-budgetparams=10:10:10", f"-vbparams=v20:{self.v20_start_time}:999999999999:0:10:8:6:5:0"]] * 6, fast_dip3_enforcement=True) '-testactivationheight=v20@240',
]] * 6, fast_dip3_enforcement=True)
def check_superblockbudget(self, v20_active): def check_superblockbudget(self, v20_active):
v20_state = self.nodes[0].getblockchaininfo()["softforks"]["v20"] v20_state = self.nodes[0].getblockchaininfo()["softforks"]["v20"]
assert_equal(v20_state["active"], v20_active) assert_equal(v20_state["active"], v20_active)
assert_equal(self.nodes[0].getsuperblockbudget(200), self.expected_old_budget) assert_equal(self.nodes[0].getsuperblockbudget(200), self.expected_old_budget)
assert_equal(self.nodes[0].getsuperblockbudget(220), self.expected_old_budget) assert_equal(self.nodes[0].getsuperblockbudget(220), self.expected_old_budget)
if v20_state["bip9"]["status"] == "locked_in" or v20_state["bip9"]["status"] == "active": assert_equal(self.nodes[0].getsuperblockbudget(240), self.expected_v20_budget)
assert_equal(self.nodes[0].getsuperblockbudget(240), self.expected_v20_budget) assert_equal(self.nodes[0].getsuperblockbudget(260), self.expected_v20_budget)
assert_equal(self.nodes[0].getsuperblockbudget(260), self.expected_v20_budget)
assert_equal(self.nodes[0].getsuperblockbudget(280), self.expected_v20_budget)
else:
assert_equal(self.nodes[0].getsuperblockbudget(240), self.expected_old_budget)
assert_equal(self.nodes[0].getsuperblockbudget(260), self.expected_old_budget)
assert_equal(self.nodes[0].getsuperblockbudget(280), self.expected_old_budget)
def check_superblock(self): def check_superblock(self):
# Make sure Superblock has only payments that fit into the budget # Make sure Superblock has only payments that fit into the budget
@ -98,18 +93,14 @@ class DashGovernanceTest (DashTestFramework):
self.bump_mocktime(3) self.bump_mocktime(3)
self.sync_blocks() self.sync_blocks()
assert_equal(self.nodes[0].getblockcount(), 210) assert_equal(self.nodes[0].getblockcount(), 210)
assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["bip9"]["status"], "defined") assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["active"], False)
self.check_superblockbudget(False) self.check_superblockbudget(False)
assert self.mocktime < self.v20_start_time
self.mocktime = self.v20_start_time
set_node_times(self.nodes, self.mocktime)
self.nodes[0].generate(10) self.nodes[0].generate(10)
self.bump_mocktime(10) self.bump_mocktime(10)
self.sync_blocks() self.sync_blocks()
assert_equal(self.nodes[0].getblockcount(), 220) assert_equal(self.nodes[0].getblockcount(), 220)
assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["bip9"]["status"], "started") assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["active"], False)
self.check_superblockbudget(False) self.check_superblockbudget(False)
proposal_time = self.mocktime proposal_time = self.mocktime
@ -213,7 +204,7 @@ class DashGovernanceTest (DashTestFramework):
self.nodes[0].generate(1) self.nodes[0].generate(1)
self.bump_mocktime(1) self.bump_mocktime(1)
assert_equal(self.nodes[0].getblockcount(), 230) assert_equal(self.nodes[0].getblockcount(), 230)
assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["bip9"]["status"], "locked_in") assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["active"], False)
self.check_superblockbudget(False) self.check_superblockbudget(False)
# The "winner" should submit new trigger and vote for it, but it's isolated so no triggers should be found # The "winner" should submit new trigger and vote for it, but it's isolated so no triggers should be found
@ -322,7 +313,7 @@ class DashGovernanceTest (DashTestFramework):
self.bump_mocktime(1) self.bump_mocktime(1)
self.sync_blocks() self.sync_blocks()
assert_equal(self.nodes[0].getblockcount(), 260) assert_equal(self.nodes[0].getblockcount(), 260)
assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["bip9"]["status"], "active") assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["active"], True)
# Mine and check a couple more superblocks # Mine and check a couple more superblocks
for i in range(2): for i in range(2):
@ -338,7 +329,7 @@ class DashGovernanceTest (DashTestFramework):
self.bump_mocktime(1) self.bump_mocktime(1)
self.sync_blocks() self.sync_blocks()
assert_equal(self.nodes[0].getblockcount(), sb_block_height) assert_equal(self.nodes[0].getblockcount(), sb_block_height)
assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["bip9"]["status"], "active") assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["active"], True)
self.check_superblockbudget(True) self.check_superblockbudget(True)
self.check_superblock() self.check_superblock()

View File

@ -131,8 +131,8 @@ class MnehfTest(DashTestFramework):
node = self.nodes[0] node = self.nodes[0]
self.set_sporks() self.set_sporks()
self.activate_v19() self.activate_v20()
self.log.info(f"After v19 activation should be plenty of blocks: {node.getblockcount()}") self.log.info(f"After v20 activation should be plenty of blocks: {node.getblockcount()}")
assert_greater_than(node.getblockcount(), 900) assert_greater_than(node.getblockcount(), 900)
assert_equal(get_bip9_details(node, 'testdummy')['status'], 'defined') assert_equal(get_bip9_details(node, 'testdummy')['status'], 'defined')
@ -154,10 +154,6 @@ class MnehfTest(DashTestFramework):
self.log.info("Checking correctness of requestId and quorumHash") self.log.info("Checking correctness of requestId and quorumHash")
assert_equal(mnehf_payload.quorumHash, int(self.mninfo[0].node.quorum("selectquorum", 100, 'a0eee872d7d3170dd20d5c5e8380c92b3aa887da5f63d8033289fafa35a90691')["quorumHash"], 16)) assert_equal(mnehf_payload.quorumHash, int(self.mninfo[0].node.quorum("selectquorum", 100, 'a0eee872d7d3170dd20d5c5e8380c92b3aa887da5f63d8033289fafa35a90691')["quorumHash"], 16))
self.send_tx(ehf_tx, expected_error='mnhf-before-v20')
assert_equal(get_bip9_details(node, 'testdummy')['status'], 'defined')
self.activate_v20()
assert_equal(get_bip9_details(node, 'testdummy')['status'], 'defined') assert_equal(get_bip9_details(node, 'testdummy')['status'], 'defined')
assert_equal(get_bip9_details(node, 'mn_rr')['status'], 'defined') assert_equal(get_bip9_details(node, 'mn_rr')['status'], 'defined')

View File

@ -154,16 +154,7 @@ class BlockchainTest(BitcoinTestFramework):
'dip0024': { 'type': 'buried', 'active': False, 'height': 900}, 'dip0024': { 'type': 'buried', 'active': False, 'height': 900},
'realloc': { 'type': 'buried', 'active': True, 'height': 1}, 'realloc': { 'type': 'buried', 'active': True, 'height': 1},
'v19': { 'type': 'buried', 'active': False, 'height': 900}, 'v19': { 'type': 'buried', 'active': False, 'height': 900},
'v20': { 'v20': { 'type': 'buried', 'active': False, 'height': 1200},
'type': 'bip9',
'bip9': {
'status': 'defined',
'start_time': 0,
'timeout': 9223372036854775807,
'since': 0,
'min_activation_height': 0,
'ehf': False,
}, 'active': False},
'mn_rr': { 'mn_rr': {
'type': 'bip9', 'type': 'bip9',
'bip9': { 'bip9': {