Skip to content

Commit 63f509d

Browse files
committed
fix: intermittent error in feature_dip3_v19.py
It can happen on Regtest or Devnet if v20 is just activated but the best chainlock is still in legacy (pre-v19) scheme. It causes errors on CI similar to this one: 2025-05-31T10:28:49.821000Z TestFramework (INFO): Checking that protxs with duplicate EvoNodes fields are rejected 2025-05-31T10:29:50.653000Z TestFramework (INFO): dynamically_prepare_masternode failed 2025-05-31T10:30:50.784000Z TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "DASH/test/functional/test_framework/test_framework.py", line 162, in main self.run_test() File "DASH/test/functional/feature_dip3_v19.py", line 87, in run_test self.dynamically_evo_update_service(evo_info_0, 8) File "DASH/test/functional/test_framework/test_framework.py", line 1384, in dynamically_evo_update_service tip = self.generate(self.nodes[0], 1)[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "DASH/test/functional/test_framework/test_framework.py", line 805, in generate sync_fun() if sync_fun else self.sync_all() ^^^^^^^^^^^^^^^ File "DASH/test/functional/test_framework/test_framework.py", line 874, in sync_all self.sync_blocks(nodes) File "DASH/test/functional/test_framework/test_framework.py", line 840, in sync_blocks raise AssertionError("Block sync timed out after {}s:{}".format( AssertionError: Block sync timed out after 60s: '4227eea732e686fcf608bcbc5525a02336bb69c2eed70e8a59d6439b2122190f' '4227eea732e686fcf608bcbc5525a02336bb69c2eed70e8a59d6439b2122190f' '4227eea732e686fcf608bcbc5525a02336bb69c2eed70e8a59d6439b2122190f' '4227eea732e686fcf608bcbc5525a02336bb69c2eed70e8a59d6439b2122190f' '4227eea732e686fcf608bcbc5525a02336bb69c2eed70e8a59d6439b2122190f' '4227eea732e686fcf608bcbc5525a02336bb69c2eed70e8a59d6439b2122190f' '0ade04ee0ae89d1168792a65c28956557c9f2991d141180b9faf7a9ae986cf24' 2025-05-31T10:30:50.837000Z TestFramework (INFO): Stopping nodes While underlying error is `bad-cbtx-invalid-clsig`: 2025-05-31T10:28:49.932591Z [util/system.h:57] [error] ERROR: ConnectBlock(DASH): ProcessSpecialTxsInBlock for block 4f8767d0ad2e7c8882ba4b2819a1d8eb29fbc608ff8201ed1c857d6d3ec51cc9 failed with bad-cbtx-invalid-clsig 2025-05-31T10:28:49.932632Z [validationinterface.cpp:254] [BlockChecked] [validation] BlockChecked: block hash=4f8767d0ad2e7c8882ba4b2819a1d8eb29fbc608ff8201ed1c857d6d3ec51cc9 state=bad-cbtx-invalid-clsig 2025-05-31T10:28:49.932660Z [validation.cpp:1634] [InvalidChainFound] InvalidChainFound: invalid block=4f8767d0ad2e7c8882ba4b2819a1d8eb29fbc608ff8201ed1c857d6d3ec51cc9 height=202 log2_work=8.665336 date=2014-12-04T17:46:38Z 2025-05-31T10:28:49.932667Z [validation.cpp:1639] [InvalidChainFound] InvalidChainFound: current best=0ade04ee0ae89d1168792a65c28956557c9f2991d141180b9faf7a9ae986cf24 height=201 log2_work=8.658211 date=2014-12-04T17:36:30Z
1 parent 7325e06 commit 63f509d

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

src/chainparams.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,11 @@ class CRegTestParams : public CChainParams {
925925
UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST_INSTANTSEND);
926926
UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST_PLATFORM);
927927
UpdateLLMQInstantSendDIP0024FromArgs(args);
928+
// V20 adds CL signature to CbTx; V19 switches BLS scheme from legacy to Basic.
929+
assert(consensus.V20Height >= consensus.V19Height);
930+
// V20 features for CbTx (credit pool, CL) have no meaning without masternodes
928931
assert(consensus.V20Height >= consensus.DIP0003Height);
932+
// MN_RR reallocate part of reward to CreditPool which exits since V20
929933
assert(consensus.MN_RRHeight >= consensus.V20Height);
930934
}
931935

src/evo/cbtx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class CCbTx
5151
READWRITE(obj.merkleRootQuorums);
5252
if (obj.nVersion >= Version::CLSIG_AND_BALANCE) {
5353
READWRITE(COMPACTSIZE(obj.bestCLHeightDiff));
54+
// TODO: BLS scheme here should be enforced to BASIC
55+
// on devnet / regtest with late v19 activation an old CL with
56+
// legacy scheme could get to CbTx and cause Invalid Block errors
5457
READWRITE(obj.bestCLSignature);
5558
READWRITE(obj.creditPoolBalance);
5659
}

src/test/evo_deterministicmns_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ struct TestChainV19Setup : public TestChainV19BeforeActivationSetup {
866866

867867
// 5 blocks earlier
868868
TestChainV19BeforeActivationSetup::TestChainV19BeforeActivationSetup() :
869-
TestChainSetup(494, {"-testactivationheight=v19@500"})
869+
TestChainSetup(494, {"-testactivationheight=v19@500", "-testactivationheight=v20@500", "-testactivationheight=mn_rr@500"})
870870
{
871871
bool v19_active{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(),
872872
Consensus::DEPLOYMENT_V19)};

src/test/util/setup_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ TestChainSetup::TestChainSetup(int num_blocks, const std::vector<const char*>& e
399399
/*TestChainBRRBeforeActivationSetup=*/
400400
{ 497, uint256S("0x0857a9b5db51835b1c828f019f4c664b5fe6c28ac44a6d868436930f832d31e5") },
401401
/*TestChainV19BeforeActivationSetup=*/
402-
{ 494, uint256S("0x06ec12cb5419daf83e04455a24ff8f27fef76cfdbd3e8723ca4946fab91a2f11") },
402+
{ 494, uint256S("0x44ee5c8a5e5cbd4437d63c54ddc1d40329be811b25c492fa901e11cdf408f905") },
403403
}
404404
};
405405

test/functional/feature_dip3_v19.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def set_test_params(self):
4747
'-testactivationheight=v19@200',
4848
]] * 6
4949
self.set_dash_test_params(6, 5, evo_count=2, extra_args=self.extra_args)
50+
self.delay_v20_and_mn_rr(height=260)
5051

5152

5253
def run_test(self):
@@ -104,6 +105,11 @@ def run_test(self):
104105
new_mn = self.dynamically_add_masternode(evo=False, rnd=(10 + i))
105106
assert new_mn is not None
106107

108+
self.log.info("Chainlocks in CbTx can be only in Basic scheme. Wait one...")
109+
self.wait_until(lambda: self.nodes[0].getbestchainlock()['height'] > 200)
110+
self.log.info(f"block {self.nodes[0].getbestchainlock()['height']} is chainlocked after v19 activation")
111+
112+
self.activate_by_name('v20', expected_activation_height=260)
107113
# mine more quorums and make sure everything still works
108114
prev_quorum = None
109115
for _ in range(5):

0 commit comments

Comments
 (0)