Skip to content

Commit c293593

Browse files
authored
test: v20 earlier activation for regtest (#5668)
## Issue being fixed or feature implemented Currently, on functional tests v20 activates at height 1440 which is later than needed. ## What was done? Reduced the window size of v20 from 480 to 400 which activates v20 at 1200. Adjusted tests to this change. Note regarding the window analysis for MN payments in `feature_llmq_evo.py` (reduced from 256 to 48 blocks): 48 window is enough to analyse 4 MNs and 5 EvoNodes (Weighted count=24) On my machine using develop: `python3 feature_llmq_rotation.py 145.45s user 30.00s system 68% cpu 4:16.93 total` With this PR: `python3 feature_llmq_rotation.py 119.26s user 24.61s system 62% cpu 3:50.89 total` ## How Has This Been Tested? all tests ## Breaking Changes no ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
1 parent 7bae092 commit c293593

8 files changed

+15
-14
lines changed

src/chainparams.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ class CRegTestParams : public CChainParams {
833833
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
834834
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 0;
835835
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
836-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 480;
836+
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 400;
837837
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 384; // 80% of 480
838838
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 288; // 60% of 480
839839
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods

src/test/util/setup_common.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,15 @@ TestChainSetup::TestChainSetup(int num_blocks, const std::vector<const char*>& e
308308
/* TestChain100Setup */
309309
{ 100, uint256S("0x6ffb83129c19ebdf1ae3771be6a67fe34b35f4c956326b9ba152fac1649f65ae") },
310310
/* TestChainDIP3BeforeActivationSetup */
311-
{ 430, uint256S("0x0bcefaa33fec56cd84d05d0e76cd6a78badcc20f627d91903646de6a07930a14") },
311+
{ 430, uint256S("0x592b23a8882162ea48606e40c9ee00b2166ddae092c691d7f1b1758ec13647d9") },
312312
/* TestChainDIP3Setup */
313-
{ 431, uint256S("0x5fd3aa5ef29464839499d7f847edd9362e3e73392b79d3bd88b1591f5fb17d4e") },
313+
{ 431, uint256S("0x49db248651517f3fc3725fbbc7087db90552d487d11e0962b0148fc4788aeb77") },
314314
/* TestChainBRRBeforeActivationSetup */
315-
{ 497, uint256S("0x5d3a646bb53416543e409d2aa99b93ba619c8394ac68868e1b65a57cb8d0ce7d") },
315+
{ 497, uint256S("0x15445246f9f9fd4fdb1021dd8278ace7246b3e3cb545e1632a277d3a02eb011f") },
316316
/* TestChainV19BeforeActivationSetup */
317-
{ 894, uint256S("0x4e01ffea7482da6bbc581f16a62e04d7a20c8789b6bfe581c60016bb79d8d267") },
317+
{ 894, uint256S("0x03cbf1871d7d915cda10aded00ced45f71a4e2acf6a3c7a77a1ff488267dd1cd") },
318318
/* TestChainV19Setup */
319-
{ 899, uint256S("0x539da638600839a24c7a7ac408d22d85f20b3ab913176c80a37a1793eb32e0d9") },
319+
{ 899, uint256S("0x405a630e16d0ca0efe3abb0e24c9a157a69ec2e07b04333cc5d004efa634ac89") },
320320
}
321321
};
322322

test/functional/feature_asset_locks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def run_test(self):
521521
all_mn_rewards = platform_reward + owner_reward + operator_reward
522522
assert_equal(all_mn_rewards, bt['coinbasevalue'] * 3 // 4) # 75/25 mn/miner reward split
523523
assert_equal(platform_reward, all_mn_rewards * 375 // 1000) # 0.375 platform share
524-
assert_equal(platform_reward, 29636590)
524+
assert_equal(platform_reward, 31916328)
525525
assert_equal(new_total, self.get_credit_pool_balance())
526526
node.generate(1)
527527
self.sync_all()

test/functional/feature_cltv.py

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def set_test_params(self):
6060
'-dip3params=9000:9000',
6161
'-par=1', # Use only one script thread to get the exact reject reason for testing
6262
'-acceptnonstdtxn=1', # cltv_invalidate is nonstandard
63+
'-vbparams=v20:0:999999999999:480:384:288:5:-1' # Delay v20 for this test as we don't need it
6364
]]
6465
self.setup_clean_chain = True
6566
self.rpc_timeout = 480

test/functional/feature_dersig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def unDERify(tx):
4040
class BIP66Test(BitcoinTestFramework):
4141
def set_test_params(self):
4242
self.num_nodes = 1
43-
self.extra_args = [['[email protected]', '-dip3params=9000:9000', '-par=1']] # Use only one script thread to get the exact reject reason for testing
43+
self.extra_args = [['[email protected]', '-dip3params=9000:9000', '-par=1', '-vbparams=v20:0:999999999999:480:384:288:5:-1']] # Use only one script thread to get the exact reject reason for testing
4444
self.setup_clean_chain = True
4545
self.rpc_timeout = 240
4646

test/functional/feature_llmq_chainlocks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def run_test(self):
3333

3434
self.test_coinbase_best_cl(self.nodes[0], expected_cl_in_cb=False)
3535

36-
self.activate_v20(expected_activation_height=1440)
36+
self.activate_v20(expected_activation_height=1200)
3737
self.log.info("Activated v20 at height:" + str(self.nodes[0].getblockcount()))
3838

3939
# v20 is active for the next block, not for the tip

test/functional/feature_llmq_evo.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def run_test(self):
112112
self.test_evo_protx_are_in_mnlist(evo_protxhash_list)
113113

114114
self.log.info("Test that EvoNodes are paid 4x blocks in a row")
115-
self.test_evo_payments(window_analysis=256)
115+
self.test_evo_payments(window_analysis=48)
116116

117117
self.activate_v20()
118118
self.activate_mn_rr()
@@ -124,7 +124,7 @@ def run_test(self):
124124
self.sync_blocks()
125125

126126
self.log.info("Test that EvoNodes are paid 1 block in a row after MN RewardReallocation activation")
127-
self.test_evo_payments(window_analysis=256, v20active=True)
127+
self.test_evo_payments(window_analysis=48, v20active=True)
128128

129129
self.log.info(self.nodes[0].masternodelist())
130130

test/functional/feature_llmq_rotation.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ def run_test(self):
9898
quorumList = self.test_getmnlistdiff_quorums(b_h_0, b_h_1, {}, expectedDeleted, expectedNew, testQuorumsCLSigs=False)
9999

100100
self.log.info(f"Wait for v20 locked_in phase")
101-
# Expected locked_in phase starts at 1440 - 480 (window size in regtest)
102-
projected_activation_height = self.advance_to_locked_in_for_v20(expected_locked_in_height=960)
101+
# Expected locked_in phase starts at 1200 - 400 (window size in regtest)
102+
projected_activation_height = self.advance_to_locked_in_for_v20(expected_locked_in_height=800)
103103

104-
self.activate_v20(expected_activation_height=1440)
104+
self.activate_v20(expected_activation_height=1200)
105105
self.log.info("Activated v20 at height:" + str(self.nodes[0].getblockcount()))
106106

107107
softfork_info = get_bip9_details(self.nodes[0], 'v20')

0 commit comments

Comments
 (0)