Merge #6275: feat: bury mn_rr fork - fire up test chains by first block - 6/n

9a9d0d5b79 feat: drop SPORK 24 (EHF) so far as this feature works on testnet / mainnet (Konstantin Akimov)
da0dc06eea perf: optimize feature_mnehf.py by generating less blocks (Konstantin Akimov)
0de3923b06 feat: bury fork mn_rr (masternode reward reallocation) (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  MN_RR is activated on mainnet: time to bury it!

  ## What was done?
  Hard-fork mn_rr is buried. Prior fixes are done here: https://github.com/dashpay/dash/pull/6270 and https://github.com/dashpay/dash/pull/6269

  ## How Has This Been Tested?
  Run unit and functional tests

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  UdjinM6:
    light ACK 9a9d0d5b79
  PastaPastaPasta:
    utACK 9a9d0d5b79

Tree-SHA512: 73ea0ca1270f15f6f1193efbaf402d476c84e9a843af85b7eae3e40199f4c943ad40f58e062b8db20e1c5c69c1a85579ebaf0722f1044ee2e1a4e7f96c58e645
This commit is contained in:
pasta 2024-10-01 10:11:41 -05:00
commit 5a0479fe53
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
18 changed files with 61 additions and 141 deletions

View File

@ -193,7 +193,8 @@ public:
consensus.DIP0024QuorumsHeight = 1738698; // 000000000000001aa25181e4c466e593992c98f9eb21c69ee757b8bb0af50244 consensus.DIP0024QuorumsHeight = 1738698; // 000000000000001aa25181e4c466e593992c98f9eb21c69ee757b8bb0af50244
consensus.V19Height = 1899072; // 0000000000000015e32e73052d663626327004c81c5c22cb8b42c361015c0eae consensus.V19Height = 1899072; // 0000000000000015e32e73052d663626327004c81c5c22cb8b42c361015c0eae
consensus.V20Height = 1987776; // 000000000000001bf41cff06b76780050682ca29e61a91c391893d4745579777 consensus.V20Height = 1987776; // 000000000000001bf41cff06b76780050682ca29e61a91c391893d4745579777
consensus.MinBIP9WarningHeight = 1987776 + 2016; // V20 activation height + miner confirmation window consensus.MN_RRHeight = 2128896; // 0000000000000009a9696da93d3807eb14eb00a4ff449206d689156a21b27f26
consensus.MinBIP9WarningHeight = 2128896 + 2016; // mn_rr 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
@ -208,16 +209,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_MN_RR].bit = 10;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1704067200; // January 1, 2024
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = 1767225600; // January 1, 2026
// NOTE: nWindowSize for MN_RR __MUST__ be greater than or equal to nSuperblockMaturityWindow for CSuperblock::GetPaymentsLimit() to work correctly
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 4032;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 3226; // 80% of 4032
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 2420; // 60% of 4032
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nFalloffCoeff = 5; // this corresponds to 10 periods
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].useEHF = true;
// The best chain should have at least this much work. // The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000988117deadb0db9cd5b8"); // 2109672 consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000988117deadb0db9cd5b8"); // 2109672
@ -388,7 +379,8 @@ public:
consensus.DIP0024QuorumsHeight = 770730; // 0000003c43b3ae7fffe61278ca5537a0e256ebf4d709d45f0ab040271074d51e consensus.DIP0024QuorumsHeight = 770730; // 0000003c43b3ae7fffe61278ca5537a0e256ebf4d709d45f0ab040271074d51e
consensus.V19Height = 850100; // 000004728b8ff2a16b9d4eebb0fd61eeffadc9c7fe4b0ec0b5a739869401ab5b consensus.V19Height = 850100; // 000004728b8ff2a16b9d4eebb0fd61eeffadc9c7fe4b0ec0b5a739869401ab5b
consensus.V20Height = 905100; // 0000020c5e0f86f385cbf8e90210de9a9fd63633f01433bf47a6b3227a2851fd consensus.V20Height = 905100; // 0000020c5e0f86f385cbf8e90210de9a9fd63633f01433bf47a6b3227a2851fd
consensus.MinBIP9WarningHeight = 905100 + 2016; // v19 activation height + miner confirmation window consensus.MN_RRHeight = 1066900; // 000000d05d445958a9a4ad6bdc0f4bfb25af124b2326060703373ff2d3b397e9
consensus.MinBIP9WarningHeight = 1066900 + 2016; // mn_rr 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
@ -403,15 +395,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_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].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 80; // 80% of 100
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 60; // 60% of 100
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nFalloffCoeff = 5; // this corresponds to 10 periods
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].useEHF = true;
// The best chain should have at least this much work. // The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000031779704a0f54b4"); // 1069875 consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000031779704a0f54b4"); // 1069875
@ -557,7 +540,8 @@ public:
consensus.DIP0024QuorumsHeight = 300; consensus.DIP0024QuorumsHeight = 300;
consensus.V19Height = 300; consensus.V19Height = 300;
consensus.V20Height = 300; consensus.V20Height = 300;
consensus.MinBIP9WarningHeight = 300 + 2016; // v20 activation height + miner confirmation window consensus.MN_RRHeight = 300;
consensus.MinBIP9WarningHeight = 300 + 2016; // mn_rr 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
@ -572,15 +556,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_MN_RR].bit = 10;
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].nWindowSize = 120;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 80; // 80% of 100
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 60; // 60% of 100
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nFalloffCoeff = 5; // this corresponds to 10 periods
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].useEHF = true;
// The best chain should have at least this much work. // The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000000000000000"); consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000000000000000");
@ -790,6 +765,7 @@ public:
consensus.DIP0024QuorumsHeight = 900; consensus.DIP0024QuorumsHeight = 900;
consensus.V19Height = 900; consensus.V19Height = 900;
consensus.V20Height = 900; consensus.V20Height = 900;
consensus.MN_RRHeight = 900;
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
@ -806,15 +782,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_MN_RR].bit = 10;
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].nWindowSize = 12;
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 9; // 80% of 12
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 7; // 60% of 7
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nFalloffCoeff = 5; // this corresponds to 10 periods
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].useEHF = true;
// The best chain should have at least this much work. // The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x00"); consensus.nMinimumChainWork = uint256S("0x00");
@ -1036,6 +1003,8 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
consensus.DIP0020Height = int{height}; consensus.DIP0020Height = int{height};
} else if (name == "v20") { } else if (name == "v20") {
consensus.V20Height = int{height}; consensus.V20Height = int{height};
} else if (name == "mn_rr") {
consensus.MN_RRHeight = 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, v20). (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, mn_rr). (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

@ -33,12 +33,12 @@ enum BuriedDeployment : int16_t {
DEPLOYMENT_BRR, DEPLOYMENT_BRR,
DEPLOYMENT_V19, DEPLOYMENT_V19,
DEPLOYMENT_V20, DEPLOYMENT_V20,
DEPLOYMENT_MN_RR,
}; };
constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_V20; } constexpr bool ValidDeployment(BuriedDeployment dep) { return dep <= DEPLOYMENT_MN_RR; }
enum DeploymentPos : uint16_t { enum DeploymentPos : uint16_t {
DEPLOYMENT_TESTDUMMY, DEPLOYMENT_TESTDUMMY,
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
}; };
@ -144,6 +144,8 @@ struct Params {
int V19Height; int V19Height;
/** Block height at which V20 (Deployment of EHF, LLMQ Randomness Beacon) becomes active */ /** Block height at which V20 (Deployment of EHF, LLMQ Randomness Beacon) becomes active */
int V20Height; int V20Height;
/** Block height at which MN_RR (Deployment of Masternode Reward Location Reallocation) becomes active */
int MN_RRHeight;
/** 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;
@ -209,6 +211,8 @@ struct Params {
return V19Height; return V19Height;
case DEPLOYMENT_V20: case DEPLOYMENT_V20:
return V20Height; return V20Height;
case DEPLOYMENT_MN_RR:
return MN_RRHeight;
} // 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 =*/"mn_rr",
/*.gbt_force =*/true,
},
}; };
std::string DeploymentName(Consensus::BuriedDeployment dep) std::string DeploymentName(Consensus::BuriedDeployment dep)
@ -47,6 +43,8 @@ std::string DeploymentName(Consensus::BuriedDeployment dep)
return "v19"; return "v19";
case Consensus::DEPLOYMENT_V20: case Consensus::DEPLOYMENT_V20:
return "v20"; return "v20";
case Consensus::DEPLOYMENT_MN_RR:
return "mn_rr";
} // 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

@ -44,8 +44,8 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterminis
llmq::quorumInstantSendManager = std::make_unique<llmq::CInstantSendManager>(*llmq::chainLocksHandler, chainstate, connman, *qman, *sigman, *shareman, sporkman, mempool, mn_sync, peerman, is_masternode, unit_tests, wipe); llmq::quorumInstantSendManager = std::make_unique<llmq::CInstantSendManager>(*llmq::chainLocksHandler, chainstate, connman, *qman, *sigman, *shareman, sporkman, mempool, mn_sync, peerman, is_masternode, unit_tests, wipe);
return llmq::quorumInstantSendManager.get(); return llmq::quorumInstantSendManager.get();
}()}, }()},
ehfSignalsHandler{std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool, ehfSignalsHandler{
*qman, sporkman, peerman)} std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool, *qman, peerman)}
{ {
} }

View File

@ -16,7 +16,6 @@
#include <index/txindex.h> // g_txindex #include <index/txindex.h> // g_txindex
#include <net_processing.h> #include <net_processing.h>
#include <primitives/transaction.h> #include <primitives/transaction.h>
#include <spork.h>
#include <txmempool.h> #include <txmempool.h>
#include <validation.h> #include <validation.h>
@ -25,14 +24,13 @@ namespace llmq {
CEHFSignalsHandler::CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman, CEHFSignalsHandler::CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman,
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman, CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman,
const CSporkManager& sporkman, const std::unique_ptr<PeerManager>& peerman) : const std::unique_ptr<PeerManager>& peerman) :
chainstate(chainstate), chainstate(chainstate),
mnhfman(mnhfman), mnhfman(mnhfman),
sigman(sigman), sigman(sigman),
shareman(shareman), shareman(shareman),
mempool(mempool), mempool(mempool),
qman(qman), qman(qman),
sporkman(sporkman),
m_peerman(peerman) m_peerman(peerman)
{ {
sigman.RegisterRecoveredSigsListener(this); sigman.RegisterRecoveredSigsListener(this);
@ -48,7 +46,7 @@ void CEHFSignalsHandler::UpdatedBlockTip(const CBlockIndex* const pindexNew, boo
{ {
if (!DeploymentActiveAfter(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) return; if (!DeploymentActiveAfter(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) return;
if (!is_masternode || (Params().IsTestChain() && !sporkman.IsSporkActive(SPORK_24_TEST_EHF))) { if (!is_masternode) {
return; return;
} }

View File

@ -12,7 +12,6 @@
class CBlockIndex; class CBlockIndex;
class CChainState; class CChainState;
class CMNHFManager; class CMNHFManager;
class CSporkManager;
class CTxMemPool; class CTxMemPool;
class PeerManager; class PeerManager;
@ -31,7 +30,6 @@ private:
CSigSharesManager& shareman; CSigSharesManager& shareman;
CTxMemPool& mempool; CTxMemPool& mempool;
const CQuorumManager& qman; const CQuorumManager& qman;
const CSporkManager& sporkman;
const std::unique_ptr<PeerManager>& m_peerman; const std::unique_ptr<PeerManager>& m_peerman;
/** /**
@ -42,7 +40,7 @@ private:
public: public:
explicit CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman, explicit CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman,
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman, CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman,
const CSporkManager& sporkman, const std::unique_ptr<PeerManager>& peerman); const std::unique_ptr<PeerManager>& peerman);
~CEHFSignalsHandler(); ~CEHFSignalsHandler();

View File

@ -1840,7 +1840,7 @@ RPCHelpMan getblockchaininfo()
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, softforks, consensusParams, Consensus::DEPLOYMENT_V20); SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_V20);
SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_MN_RR); SoftForkDescPushBack(tip, softforks, consensusParams, Consensus::DEPLOYMENT_MN_RR);
SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY); SoftForkDescPushBack(tip, ehfSignals, softforks, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY);
obj.pushKV("softforks", softforks); obj.pushKV("softforks", softforks);

View File

@ -42,7 +42,7 @@ enum SporkId : int32_t {
SPORK_19_CHAINLOCKS_ENABLED = 10018, SPORK_19_CHAINLOCKS_ENABLED = 10018,
SPORK_21_QUORUM_ALL_CONNECTED = 10020, SPORK_21_QUORUM_ALL_CONNECTED = 10020,
SPORK_23_QUORUM_POSE = 10022, SPORK_23_QUORUM_POSE = 10022,
SPORK_24_TEST_EHF = 10023, // SPORK_24_DEPRECATED = 10023,
SPORK_INVALID = -1, SPORK_INVALID = -1,
}; };
@ -76,7 +76,6 @@ struct CSporkDef
MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_21_QUORUM_ALL_CONNECTED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_21_QUORUM_ALL_CONNECTED, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_23_QUORUM_POSE, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_23_QUORUM_POSE, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_24_TEST_EHF, 4070908800ULL), // OFF
}; };
#undef MAKE_SPORK_DEF #undef MAKE_SPORK_DEF

View File

@ -18,7 +18,6 @@
#include <validation.h> #include <validation.h>
#include <evo/deterministicmns.h> #include <evo/deterministicmns.h>
#include <evo/mnhftx.h>
#include <evo/providertx.h> #include <evo/providertx.h>
#include <evo/specialtx.h> #include <evo/specialtx.h>
#include <masternode/payments.h> #include <masternode/payments.h>
@ -37,7 +36,7 @@ struct TestChainBRRBeforeActivationSetup : public TestChainSetup
// Force fast DIP3 activation // Force fast DIP3 activation
TestChainBRRBeforeActivationSetup() : TestChainBRRBeforeActivationSetup() :
TestChainSetup(497, {"-dip3params=30:50", "-testactivationheight=brr@1000", "-testactivationheight=v20@1200", TestChainSetup(497, {"-dip3params=30:50", "-testactivationheight=brr@1000", "-testactivationheight=v20@1200",
"-vbparams=mn_rr:0:999999999999:0:20:16:12:5:1"}) "-testactivationheight=mn_rr@2200"})
{ {
} }
}; };
@ -230,8 +229,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
BOOST_CHECK_EQUAL(pblocktemplate->voutMasternodePayments[0].nValue, 14423624841); // 0.4999999999 BOOST_CHECK_EQUAL(pblocktemplate->voutMasternodePayments[0].nValue, 14423624841); // 0.4999999999
} }
// Reallocation should kick-in with the superblock mined at height = 2010, // Reallocation should kick-in with the superblock after 19 adjustments, 3 superblocks long each
// there will be 19 adjustments, 3 superblocks long each
for ([[maybe_unused]] auto i : irange::range(19)) { for ([[maybe_unused]] auto i : irange::range(19)) {
for ([[maybe_unused]] auto j : irange::range(3)) { for ([[maybe_unused]] auto j : irange::range(3)) {
for ([[maybe_unused]] auto k : irange::range(consensus_params.nSuperblockCycle)) { for ([[maybe_unused]] auto k : irange::range(consensus_params.nSuperblockCycle)) {
@ -268,12 +266,6 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
} }
BOOST_CHECK(!DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), consensus_params, Consensus::DEPLOYMENT_MN_RR)); BOOST_CHECK(!DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), consensus_params, Consensus::DEPLOYMENT_MN_RR));
// Activate EHF "MN_RR"
{
LOCK(cs_main);
m_node.mnhf_manager->AddSignal(m_node.chainman->ActiveChain().Tip(), 10);
}
// Reward split should stay ~75/25 after reallocation is done, // Reward split should stay ~75/25 after reallocation is done,
// check 10 next superblocks // check 10 next superblocks
for ([[maybe_unused]] auto i : irange::range(10)) { for ([[maybe_unused]] auto i : irange::range(10)) {

View File

@ -47,7 +47,11 @@ blocks_in_one_day = 576
class AssetLocksTest(DashTestFramework): class AssetLocksTest(DashTestFramework):
def set_test_params(self): def set_test_params(self):
self.set_dash_test_params(4, 2, [["-whitelist=127.0.0.1", "-llmqtestinstantsenddip0024=llmq_test_instantsend"]] * 4, evo_count=2) self.set_dash_test_params(4, 2, [[
"-whitelist=127.0.0.1",
"-llmqtestinstantsenddip0024=llmq_test_instantsend",
"-testactivationheight=mn_rr@2500",
]] * 4, evo_count=2)
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
@ -626,8 +630,7 @@ class AssetLocksTest(DashTestFramework):
def test_mn_rr(self, node_wallet, node, pubkey): def test_mn_rr(self, node_wallet, node, pubkey):
self.log.info("Activate mn_rr...") self.log.info("Activate mn_rr...")
locked = self.get_credit_pool_balance() locked = self.get_credit_pool_balance()
node.generate(12 - node.getblockcount() % 12) self.activate_mn_rr(expected_activation_height=2500)
self.activate_mn_rr(expected_activation_height=node.getblockcount() + 12 * 3)
self.log.info(f'height: {node.getblockcount()} credit: {self.get_credit_pool_balance()}') self.log.info(f'height: {node.getblockcount()} credit: {self.get_credit_pool_balance()}')
assert_equal(locked, self.get_credit_pool_balance()) assert_equal(locked, self.get_credit_pool_balance())
@ -639,7 +642,7 @@ class AssetLocksTest(DashTestFramework):
all_mn_rewards = platform_reward + owner_reward + operator_reward all_mn_rewards = platform_reward + owner_reward + operator_reward
assert_equal(all_mn_rewards, bt['coinbasevalue'] * 3 // 4) # 75/25 mn/miner reward split assert_equal(all_mn_rewards, bt['coinbasevalue'] * 3 // 4) # 75/25 mn/miner reward split
assert_equal(platform_reward, all_mn_rewards * 375 // 1000) # 0.375 platform share assert_equal(platform_reward, all_mn_rewards * 375 // 1000) # 0.375 platform share
assert_equal(platform_reward, 37015386) assert_equal(platform_reward, 34371430)
assert_equal(locked, self.get_credit_pool_balance()) assert_equal(locked, self.get_credit_pool_balance())
node.generate(1) node.generate(1)
self.sync_all() self.sync_all()

View File

@ -20,7 +20,7 @@ from test_framework.util import assert_equal, assert_raises_rpc_error, force_fin
class LLMQChainLocksTest(DashTestFramework): class LLMQChainLocksTest(DashTestFramework):
def set_test_params(self): def set_test_params(self):
self.set_dash_test_params(5, 4) self.set_dash_test_params(5, 4, [["-testactivationheight=mn_rr@1100"]] * 5)
def run_test(self): def run_test(self):
# Connect all nodes to node1 so that we always have the whole network connected # Connect all nodes to node1 so that we always have the whole network connected
@ -247,7 +247,7 @@ class LLMQChainLocksTest(DashTestFramework):
self.log.info("Test that bestCLHeightDiff conditions are relaxed before mn_rr") self.log.info("Test that bestCLHeightDiff conditions are relaxed before mn_rr")
self.test_bestCLHeightDiff(False) self.test_bestCLHeightDiff(False)
self.activate_mn_rr() self.activate_mn_rr(expected_activation_height=1100)
self.log.info("Activated mn_rr at height:" + str(self.nodes[0].getblockcount())) self.log.info("Activated mn_rr at height:" + str(self.nodes[0].getblockcount()))
self.log.info("Test that bestCLHeightDiff conditions are stricter after mn_rr") self.log.info("Test that bestCLHeightDiff conditions are stricter after mn_rr")

View File

@ -46,7 +46,7 @@ class TestP2PConn(P2PInterface):
class LLMQEvoNodesTest(DashTestFramework): class LLMQEvoNodesTest(DashTestFramework):
def set_test_params(self): def set_test_params(self):
self.set_dash_test_params(5, 4, evo_count=5) self.set_dash_test_params(5, 4, [["-testactivationheight=mn_rr@1200"]] * 5, evo_count=5)
self.set_dash_llmq_test_params(4, 4) self.set_dash_llmq_test_params(4, 4)
def run_test(self): def run_test(self):
@ -108,11 +108,11 @@ class LLMQEvoNodesTest(DashTestFramework):
self.test_evo_protx_are_in_mnlist(evo_protxhash_list) self.test_evo_protx_are_in_mnlist(evo_protxhash_list)
self.log.info("Test that EvoNodes are paid 4x blocks in a row") self.log.info("Test that EvoNodes are paid 4x blocks in a row")
self.test_evo_payments(window_analysis=48) self.test_evo_payments(window_analysis=48, mnrr_active=False)
self.test_masternode_winners() self.test_masternode_winners()
self.activate_mn_rr() self.activate_mn_rr()
self.log.info("Activated MN RewardReallocation at height:" + str(self.nodes[0].getblockcount())) self.log.info("Activated MN RewardReallocation, current height:" + str(self.nodes[0].getblockcount()))
# Generate a few blocks to make EvoNode/MN analysis on a pure MN RewardReallocation window # Generate a few blocks to make EvoNode/MN analysis on a pure MN RewardReallocation window
self.bump_mocktime(1) self.bump_mocktime(1)
@ -127,7 +127,7 @@ class LLMQEvoNodesTest(DashTestFramework):
return return
def test_evo_payments(self, window_analysis, mnrr_active=False): def test_evo_payments(self, window_analysis, mnrr_active):
current_evo = None current_evo = None
consecutive_payments = 0 consecutive_payments = 0
n_payments = 0 if mnrr_active else 4 n_payments = 0 if mnrr_active else 4

View File

@ -49,7 +49,7 @@ class TestP2PConn(P2PInterface):
class LLMQ_IS_CL_Conflicts(DashTestFramework): class LLMQ_IS_CL_Conflicts(DashTestFramework):
def set_test_params(self): def set_test_params(self):
self.set_dash_test_params(5, 4) self.set_dash_test_params(5, 4, [["-testactivationheight=mn_rr@2000"]] * 5)
self.set_dash_llmq_test_params(4, 4) self.set_dash_llmq_test_params(4, 4)
self.supports_cli = False self.supports_cli = False

View File

@ -5,6 +5,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
import struct import struct
import time
from io import BytesIO from io import BytesIO
from test_framework.authproxy import JSONRPCException from test_framework.authproxy import JSONRPCException
@ -24,7 +25,7 @@ from test_framework.util import (
class MnehfTest(DashTestFramework): class MnehfTest(DashTestFramework):
def set_test_params(self): def set_test_params(self):
extra_args = [["-vbparams=testdummy:0:999999999999:0:12:12:12:5:1", "-persistmempool=0"] for _ in range(4)] extra_args = [["-vbparams=testdummy:0:999999999999:0:4:4:4:5:1", "-persistmempool=0"] for _ in range(4)]
self.set_dash_test_params(4, 3, extra_args=extra_args) self.set_dash_test_params(4, 3, extra_args=extra_args)
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
@ -34,7 +35,7 @@ class MnehfTest(DashTestFramework):
for inode in range(self.num_nodes): for inode in range(self.num_nodes):
self.log.info(f"Restart node {inode} with {self.extra_args[inode]}") self.log.info(f"Restart node {inode} with {self.extra_args[inode]}")
if params is not None: if params is not None:
self.extra_args[inode][0] = f"-vbparams=testdummy:{params[0]}:{params[1]}:0:12:12:12:5:1" self.extra_args[inode][0] = f"-vbparams=testdummy:{params[0]}:{params[1]}:0:4:4:4:5:1"
self.log.info(f"Actual restart options: {self.extra_args[inode]}") self.log.info(f"Actual restart options: {self.extra_args[inode]}")
self.restart_node(0) self.restart_node(0)
@ -45,15 +46,6 @@ class MnehfTest(DashTestFramework):
for i in range(1, self.num_nodes): for i in range(1, self.num_nodes):
self.connect_nodes(i, 0) self.connect_nodes(i, 0)
def slowly_generate_batch(self, amount):
self.log.info(f"Slowly generate {amount} blocks")
while amount > 0:
self.log.info(f"Generating batch of blocks {amount} left")
next = min(10, amount)
amount -= next
self.bump_mocktime(next)
self.nodes[1].generate(next)
self.sync_all()
def create_mnehf(self, versionBit, pubkey=None): def create_mnehf(self, versionBit, pubkey=None):
# request ID = sha256("mnhf", versionBit) # request ID = sha256("mnhf", versionBit)
@ -169,7 +161,7 @@ class MnehfTest(DashTestFramework):
self.log.info(f"mempool: {node.getmempoolinfo()}") self.log.info(f"mempool: {node.getmempoolinfo()}")
assert_equal(node.getmempoolinfo()['size'], 0) assert_equal(node.getmempoolinfo()['size'], 0)
while (node.getblockcount() + 1) % 12 != 0: while (node.getblockcount() + 1) % 4 != 0:
self.check_fork('defined') self.check_fork('defined')
node.generate(1) node.generate(1)
self.sync_all() self.sync_all()
@ -177,13 +169,13 @@ class MnehfTest(DashTestFramework):
self.restart_all_nodes() self.restart_all_nodes()
for _ in range(12): for _ in range(4):
self.check_fork('started') self.check_fork('started')
node.generate(1) node.generate(1)
self.sync_all() self.sync_all()
for i in range(12): for i in range(4):
self.check_fork('locked_in') self.check_fork('locked_in')
node.generate(1) node.generate(1)
self.sync_all() self.sync_all()
@ -198,7 +190,7 @@ class MnehfTest(DashTestFramework):
inode.invalidateblock(ehf_blockhash) inode.invalidateblock(ehf_blockhash)
self.log.info("Expecting for fork to be defined in next blocks because no MnEHF tx here") self.log.info("Expecting for fork to be defined in next blocks because no MnEHF tx here")
for _ in range(12): for _ in range(4):
self.check_fork('defined') self.check_fork('defined')
node.generate(1) node.generate(1)
self.sync_all() self.sync_all()
@ -213,7 +205,7 @@ class MnehfTest(DashTestFramework):
assert tx_sent_2 in node.getblock(ehf_blockhash_2)['tx'] assert tx_sent_2 in node.getblock(ehf_blockhash_2)['tx']
self.log.info(f"Generate some more block to jump to `started` status") self.log.info(f"Generate some more block to jump to `started` status")
for _ in range(12): for _ in range(4):
node.generate(1) node.generate(1)
self.check_fork('started') self.check_fork('started')
self.restart_all_nodes() self.restart_all_nodes()
@ -241,26 +233,18 @@ class MnehfTest(DashTestFramework):
node.generate(1) node.generate(1)
self.sync_blocks() self.sync_blocks()
self.restart_all_nodes(params=[self.mocktime, self.mocktime + 1000000]) self.restart_all_nodes(params=[self.mocktime, self.mocktime + 1000000])
self.check_fork('defined')
self.mine_quorum() self.mine_quorum()
ehf_tx_new_start = self.create_mnehf(28, pubkey)
self.log.info("Test spork 24 (EHF)")
self.check_fork('defined')
self.nodes[0].sporkupdate("SPORK_24_TEST_EHF", 0)
self.wait_for_sporks_same()
self.check_fork('defined') self.check_fork('defined')
self.log.info("Mine one block and ensure EHF tx for the new deployment is mined") self.log.info("Waiting a bit to make EHF activating...")
ehf_tx_sent = self.send_tx(ehf_tx_new_start) self.mine_quorum()
tip_blockhash = node.generate(1)[0] for _ in range(4 * 4):
self.sync_all() time.sleep(1)
block = node.getblock(tip_blockhash) self.bump_mocktime(1)
assert ehf_tx_sent in block['tx'] self.nodes[1].generate(1)
self.sync_all()
self.check_fork('defined')
self.slowly_generate_batch(12 * 4)
self.check_fork('active') self.check_fork('active')

View File

@ -156,17 +156,7 @@ class BlockchainTest(BitcoinTestFramework):
'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': { 'type': 'buried', 'active': False, 'height': 900}, 'v20': { 'type': 'buried', 'active': False, 'height': 900},
'mn_rr': { 'mn_rr': { 'type': 'buried', 'active': False, 'height': 900},
'type': 'bip9',
'bip9': {
'status': 'defined',
'start_time': 0,
'timeout': 9223372036854775807,
'since': 0,
'min_activation_height': 0,
'ehf': True,
},
'active': False},
'testdummy': { 'testdummy': {
'type': 'bip9', 'type': 'bip9',
'bip9': { 'bip9': {

View File

@ -64,6 +64,7 @@ def create_block(hashprev=None, coinbase=None, ntime=None, *, version=None, tmpl
block.calc_sha256() block.calc_sha256()
return block return block
# TODO: imlement MN_RR support here or remove it
def create_block_with_mnpayments(mninfo, node, vtx=None, mn_payee=None, mn_amount=None): def create_block_with_mnpayments(mninfo, node, vtx=None, mn_payee=None, mn_amount=None):
if vtx is None: if vtx is None:
vtx = [] vtx = []

View File

@ -47,7 +47,6 @@ from .util import (
check_json_precision, check_json_precision,
copy_datadir, copy_datadir,
force_finish_mnsync, force_finish_mnsync,
get_bip9_details,
get_datadir_path, get_datadir_path,
initialize_datadir, initialize_datadir,
p2p_port, p2p_port,
@ -1193,23 +1192,8 @@ class DashTestFramework(BitcoinTestFramework):
def activate_v20(self, expected_activation_height=None): def activate_v20(self, expected_activation_height=None):
self.activate_by_name('v20', expected_activation_height) self.activate_by_name('v20', expected_activation_height)
def activate_ehf_by_name(self, name, expected_activation_height=None):
self.nodes[0].sporkupdate("SPORK_24_TEST_EHF", 0)
self.wait_for_sporks_same()
assert get_bip9_details(self.nodes[0], name)['ehf']
ehf_height = 0
while ehf_height == 0:
time.sleep(1)
try:
ehf_height = get_bip9_details(self.nodes[0], name)['ehf_height']
except KeyError:
pass
self.nodes[0].generate(1)
self.sync_all()
self.activate_by_name(name, expected_activation_height)
def activate_mn_rr(self, expected_activation_height=None): def activate_mn_rr(self, expected_activation_height=None):
self.activate_ehf_by_name('mn_rr', expected_activation_height) self.activate_by_name('mn_rr', expected_activation_height)
def set_dash_llmq_test_params(self, llmq_size, llmq_threshold): def set_dash_llmq_test_params(self, llmq_size, llmq_threshold):
self.llmq_size = llmq_size self.llmq_size = llmq_size