Skip to content

Commit 63a0b20

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 63a0b20

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
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
}

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)