Skip to content

Commit 9b21aef

Browse files
Merge #6269: feat: improvements for v19, v20 and dip3 - fire up test chains by first block 5/n
6030611 style: apply clang format for new changes (Konstantin Akimov) f01338f feat: drop requirement of v20 for Asset Unlock transactions (Konstantin Akimov) b3e9e5c feat: drop v20 requirement for special EHF transaction (Konstantin Akimov) 8639298 refactor: drop fast_dip3_enforcement=True from functional tests. (Konstantin Akimov) 0add6bc feat: removed 2 checkpoints: TestChainDIP3Setup and TestChainV19Setup from unit tests (Konstantin Akimov) 3fffb0c refactor: moves evo-deterministicmns_tests specific code from header (Konstantin Akimov) 1d96fbf feat: let asset-unlock transactions be available since v20 on all networks (Konstantin Akimov) 4b4001b perf: activate v20 on the same block as v19 for Reg Test (Konstantin Akimov) e0d97cf feat: let asset locks be mined before v20 (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented This PR is 5th in the achieving ultimate goal to activate old forks from block 1. It helps to run unit and functional tests faster; it helps for platform's dev-environment to start faster. ## What was done? - v20 on RegTest is activated from same block as v19 (height 1200 changed to 900) - relaxed condition for special transactions Asset Lock (can be mined any block so far as v20 is activated long time ago). - unify code for regtest, mainnet, testnet for Asset Unlock validation - removed 2 checkpoints: TestChainDIP3Setup and TestChainV19Setup from unit tests which make further changes for forks easier - enforced flag `fast_dip3_enforcement=True` from functional tests which is always true ## How Has This Been Tested? Run unit and functional tests `tsan` job runs 500 seconds faster of real time and 2000seconds faster for "accumulated time" https://gitlab.com/dashpay/dash/-/jobs/7817453421 - this PR https://gitlab.com/dashpay/dash/-/jobs/7805625816 - some old PR for reference No breakdown per tests here, because they affect each other and runs in parallel. ## Breaking Changes Regtest has v20 activated on same block as v19 if otherwise is not specified with `-testactivationheight=v20@1200` ## 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: utACK 6030611 PastaPastaPasta: utACK 6030611 Tree-SHA512: 5a1e15a32931682240ecd8e5bab8a0bba67eebf0409ea7b7556018240c48d59ec8daab8859a2fb883154aac95813553c2835a0527269fcf4e81f1edb1b2ed0ac
2 parents d8da094 + 6030611 commit 9b21aef

37 files changed

+87
-100
lines changed

src/chainparams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ class CRegTestParams : public CChainParams {
789789
consensus.DIP0024Height = 900;
790790
consensus.DIP0024QuorumsHeight = 900;
791791
consensus.V19Height = 900;
792-
consensus.V20Height = 1200;
792+
consensus.V20Height = 900;
793793
consensus.MinBIP9WarningHeight = 0;
794794
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
795795
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day

src/evo/specialtxman.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,10 @@ static bool CheckSpecialTxInner(CDeterministicMNManager& dmnman, const Chainstat
4848
case TRANSACTION_QUORUM_COMMITMENT:
4949
return llmq::CheckLLMQCommitment(dmnman, chainman, tx, pindexPrev, state);
5050
case TRANSACTION_MNHF_SIGNAL:
51-
if (!DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) {
52-
return state.Invalid(TxValidationResult::TX_CONSENSUS, "mnhf-before-v20");
53-
}
5451
return CheckMNHFTx(chainman, qman, tx, pindexPrev, state);
5552
case TRANSACTION_ASSET_LOCK:
56-
if (!DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) {
57-
return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetlocks-before-v20");
58-
}
5953
return CheckAssetLockUnlockTx(chainman.m_blockman, qman, tx, pindexPrev, indexes, state);
6054
case TRANSACTION_ASSET_UNLOCK:
61-
if (Params().NetworkIDString() == CBaseChainParams::REGTEST && !DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) {
62-
// TODO: adjust functional tests to make it activated by MN_RR on regtest too
63-
return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetunlocks-before-v20");
64-
}
65-
if (Params().NetworkIDString() != CBaseChainParams::REGTEST && !DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_MN_RR)) {
66-
return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetunlocks-before-mn_rr");
67-
}
6855
return CheckAssetLockUnlockTx(chainman.m_blockman, qman, tx, pindexPrev, indexes, state);
6956
}
7057
} catch (const std::exception& e) {

src/test/block_reward_reallocation_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct TestChainBRRBeforeActivationSetup : public TestChainSetup
3636
{
3737
// Force fast DIP3 activation
3838
TestChainBRRBeforeActivationSetup() :
39-
TestChainSetup(497, {"-dip3params=30:50", "-testactivationheight=brr@1000",
39+
TestChainSetup(497, {"-dip3params=30:50", "-testactivationheight=brr@1000", "-testactivationheight=v20@1200",
4040
"-vbparams=mn_rr:0:999999999999:0:20:16:12:5:1"})
4141
{
4242
}

src/test/evo_deterministicmns_tests.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,49 @@ void FuncVerifyDB(TestChainSetup& setup)
814814

815815
BOOST_AUTO_TEST_SUITE(evo_dip3_activation_tests)
816816

817+
struct TestChainDIP3BeforeActivationSetup : public TestChainSetup {
818+
TestChainDIP3BeforeActivationSetup() :
819+
TestChainSetup(430)
820+
{
821+
}
822+
};
823+
824+
struct TestChainDIP3Setup : public TestChainDIP3BeforeActivationSetup {
825+
TestChainDIP3Setup()
826+
{
827+
// Activate DIP3 here
828+
CreateAndProcessBlock({}, coinbaseKey);
829+
}
830+
};
831+
832+
struct TestChainV19BeforeActivationSetup : public TestChainSetup {
833+
TestChainV19BeforeActivationSetup();
834+
};
835+
836+
struct TestChainV19Setup : public TestChainV19BeforeActivationSetup {
837+
TestChainV19Setup()
838+
{
839+
// Activate V19
840+
for (int i = 0; i < 5; ++i) {
841+
CreateAndProcessBlock({}, coinbaseKey);
842+
}
843+
bool v19_just_activated{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(),
844+
Consensus::DEPLOYMENT_V19) &&
845+
!DeploymentActiveAt(*m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(),
846+
Consensus::DEPLOYMENT_V19)};
847+
assert(v19_just_activated);
848+
}
849+
};
850+
851+
// 5 blocks earlier
852+
TestChainV19BeforeActivationSetup::TestChainV19BeforeActivationSetup() :
853+
TestChainSetup(894)
854+
{
855+
bool v19_active{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(),
856+
Consensus::DEPLOYMENT_V19)};
857+
assert(!v19_active);
858+
}
859+
817860
// DIP3 can only be activated with legacy scheme (v19 is activated later)
818861
BOOST_AUTO_TEST_CASE(dip3_activation_legacy)
819862
{

src/test/util/setup_common.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,10 @@ TestChainSetup::TestChainSetup(int num_blocks, const std::vector<const char*>& e
358358
{ 100, uint256S("0x6ffb83129c19ebdf1ae3771be6a67fe34b35f4c956326b9ba152fac1649f65ae") },
359359
/* TestChainDIP3BeforeActivationSetup */
360360
{ 430, uint256S("0x0bcefaa33fec56cd84d05d0e76cd6a78badcc20f627d91903646de6a07930a14") },
361-
/* TestChainDIP3Setup */
362-
{ 431, uint256S("0x5fd3aa5ef29464839499d7f847edd9362e3e73392b79d3bd88b1591f5fb17d4e") },
363361
/* TestChainBRRBeforeActivationSetup */
364362
{ 497, uint256S("0x23c31820ec5160b7181bfdf328e2b76cd12c9fa4544d892b7f01e74dd6220849") },
365363
/* TestChainV19BeforeActivationSetup */
366364
{ 894, uint256S("0x2885cf0fe8fdf29803b6c65002ba2570ff011531d8ea92be312a85d655e00c51") },
367-
/* TestChainV19Setup */
368-
{ 899, uint256S("0x7df3c857ce647b3ecd0d4b389b6b0f16e2bdc60b20a8d01c4ad946fe5f15dbc2") },
369365
}
370366
};
371367

@@ -571,16 +567,3 @@ CBlock getBlock13b8a()
571567
return block;
572568
}
573569

574-
TestChainV19Setup::TestChainV19Setup() : TestChainSetup(899)
575-
{
576-
bool v19_just_activated{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19) &&
577-
!DeploymentActiveAt(*m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)};
578-
assert(v19_just_activated);
579-
}
580-
581-
// 5 blocks earlier
582-
TestChainV19BeforeActivationSetup::TestChainV19BeforeActivationSetup() : TestChainSetup(894)
583-
{
584-
bool v19_active{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)};
585-
assert(!v19_active);
586-
}

src/test/util/setup_common.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -183,26 +183,6 @@ struct TestChain100Setup : public TestChainSetup {
183183
TestChain100Setup(const std::vector<const char*>& extra_args = {});
184184
};
185185

186-
struct TestChainDIP3Setup : public TestChainSetup
187-
{
188-
TestChainDIP3Setup() : TestChainSetup(431) {}
189-
};
190-
191-
struct TestChainV19Setup : public TestChainSetup
192-
{
193-
TestChainV19Setup();
194-
};
195-
196-
struct TestChainDIP3BeforeActivationSetup : public TestChainSetup
197-
{
198-
TestChainDIP3BeforeActivationSetup() : TestChainSetup(430) {}
199-
};
200-
201-
struct TestChainV19BeforeActivationSetup : public TestChainSetup
202-
{
203-
TestChainV19BeforeActivationSetup();
204-
};
205-
206186
/**
207187
* Make a test setup that has disk access to the debug.log file disabled. Can
208188
* be used in "hot loops", for example fuzzing or benchmarking.

test/functional/feature_asset_locks.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ def run_test(self):
242242

243243
self.set_sporks()
244244

245-
self.activate_v19(expected_activation_height=900)
246-
self.log.info("Activated v19 at height:" + str(node.getblockcount()))
245+
self.activate_v20(expected_activation_height=900)
246+
self.log.info("Activated v20 at height:" + str(node.getblockcount()))
247247

248248
self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 0)
249249
self.wait_for_sporks_same()
@@ -256,7 +256,6 @@ def run_test(self):
256256
self.sync_blocks()
257257

258258
self.set_sporks()
259-
self.activate_v20()
260259
node.generate(1)
261260
self.sync_all()
262261
self.mempool_size = 0
@@ -640,7 +639,7 @@ def test_mn_rr(self, node_wallet, node, pubkey):
640639
all_mn_rewards = platform_reward + owner_reward + operator_reward
641640
assert_equal(all_mn_rewards, bt['coinbasevalue'] * 3 // 4) # 75/25 mn/miner reward split
642641
assert_equal(platform_reward, all_mn_rewards * 375 // 1000) # 0.375 platform share
643-
assert_equal(platform_reward, 31916328)
642+
assert_equal(platform_reward, 37015386)
644643
assert_equal(locked, self.get_credit_pool_balance())
645644
node.generate(1)
646645
self.sync_all()

test/functional/feature_block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ def set_test_params(self):
8585
# Very large reorgs cause cs_main to be held for a very long time in ActivateBestChainStep,
8686
# which causes RPC to hang, so we need to increase RPC timeouts
8787
self.rpc_timeout = 180
88-
# Must set '-dip3params=2000:2000' to create pre-dip3 blocks only
8988
self.extra_args = [[
90-
'-dip3params=2000:2000',
89+
'-dip3params=2000:2000', # Must set '-dip3params=2000:2000' to create pre-dip3 blocks only
9190
'-acceptnonstdtxn=1', # This is a consensus block test, we don't care about tx policy
9291
'-testactivationheight=bip34@2',
9392
'-testactivationheight=dip0001@2000',
93+
'-testactivationheight=v20@2000',
9494
]]
9595

9696
def setup_nodes(self):

test/functional/feature_blockfilterindex_prune.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def run_test(self):
4343
assert_greater_than(len(self.nodes[0].getblockfilter(self.nodes[0].getblockhash(2))['filter']), 0)
4444

4545
self.log.info("start node without blockfilterindex")
46-
self.restart_node(0, extra_args=["-fastprune", "-prune=1"], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
46+
self.restart_node(0, extra_args=["-fastprune", "-prune=1", '-testactivationheight=v20@2000'], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
4747

4848
self.log.info("make sure accessing the blockfilters throws an error")
4949
assert_raises_rpc_error(-1, "Index is not enabled for filtertype basic", self.nodes[0].getblockfilter, self.nodes[0].getblockhash(2))

test/functional/feature_dip3_v19.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def getmnlistdiff(self, base_block_hash, block_hash):
4343

4444
class DIP3V19Test(DashTestFramework):
4545
def set_test_params(self):
46-
self.set_dash_test_params(6, 5, fast_dip3_enforcement=True, evo_count=2)
46+
self.extra_args = [[
47+
'-testactivationheight=v20@1200', # required otherwise mine_quorum("llmq_test [100]") fails
48+
]] * 6
49+
self.set_dash_test_params(6, 5, evo_count=2, extra_args=self.extra_args)
4750

4851
def run_test(self):
4952
# Connect all nodes to node1 so that we always have the whole network connected

0 commit comments

Comments
 (0)