From 45bf3530c6756c60fe5430d13ae923d56e4145d1 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Thu, 21 Nov 2024 22:12:34 +0700 Subject: [PATCH] fix: add real-time delay 1 second to ensure other quorum validity --- .../test_framework/test_framework.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 9c84236369fbb7..87b0ba8b589b79 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -1843,6 +1843,12 @@ def mine_quorum(self, llmq_type_name="llmq_test", llmq_type=100, expected_connec q = self.nodes[0].getbestblockhash() self.log.info("Expected quorum_hash:"+str(q)) self.log.info("Waiting for phase 1 (init)") + # extra sleep is needed to be sure that we have *all* quorum mined, not only this one + # is is important in case of spork23 is active, because otherwise node can get a ban unexpectable + # that's a silly workaround but it increase stability of functional tests on both localhost and CI + # TODO: replace it to proper validation for each quorum instead just one + if spork23_active: + time.sleep(1) self.wait_for_quorum_phase(q, 1, expected_members, None, 0, mninfos_online, llmq_type_name=llmq_type_name) self.wait_for_quorum_connections(q, expected_connections, mninfos_online, wait_proc=lambda: self.bump_mocktime(1), llmq_type_name=llmq_type_name) if spork23_active: @@ -1851,32 +1857,46 @@ def mine_quorum(self, llmq_type_name="llmq_test", llmq_type=100, expected_connec self.move_blocks(nodes, 2) self.log.info("Waiting for phase 2 (contribute)") + if spork23_active: + time.sleep(1) # see comment above self.wait_for_quorum_phase(q, 2, expected_members, "receivedContributions", expected_contributions, mninfos_online, llmq_type_name=llmq_type_name) self.move_blocks(nodes, 2) self.log.info("Waiting for phase 3 (complain)") + if spork23_active: + time.sleep(1) # see comment above self.wait_for_quorum_phase(q, 3, expected_members, "receivedComplaints", expected_complaints, mninfos_online, llmq_type_name=llmq_type_name) self.move_blocks(nodes, 2) self.log.info("Waiting for phase 4 (justify)") + if spork23_active: + time.sleep(1) # see comment above self.wait_for_quorum_phase(q, 4, expected_members, "receivedJustifications", expected_justifications, mninfos_online, llmq_type_name=llmq_type_name) self.move_blocks(nodes, 2) self.log.info("Waiting for phase 5 (commit)") + if spork23_active: + time.sleep(1) # see comment above self.wait_for_quorum_phase(q, 5, expected_members, "receivedPrematureCommitments", expected_commitments, mninfos_online, llmq_type_name=llmq_type_name) self.move_blocks(nodes, 2) self.log.info("Waiting for phase 6 (mining)") + if spork23_active: + time.sleep(1) # see comment above self.wait_for_quorum_phase(q, 6, expected_members, None, 0, mninfos_online, llmq_type_name=llmq_type_name) self.log.info("Waiting final commitment") + if spork23_active: + time.sleep(1) # see comment above self.wait_for_quorum_commitment(q, nodes, llmq_type=llmq_type) self.log.info("Mining final commitment") + if spork23_active: + time.sleep(1) # see comment above self.bump_mocktime(1) self.nodes[0].getblocktemplate() # this calls CreateNewBlock self.generate(self.nodes[0], 1, sync_fun=lambda: self.sync_blocks(nodes)) @@ -1926,6 +1946,12 @@ def mine_cycle_quorum(self, is_first=True): self.log.info("Expected quorum_0 at:" + str(self.nodes[0].getblockcount())) self.log.info("Expected quorum_0 hash:" + str(q_0)) self.log.info("quorumIndex 0: Waiting for phase 1 (init)") + # extra sleep is needed to be sure that we have *all* quorum mined, not only this one + # is is important in case of spork23 is active, because otherwise node can get a ban unexpectable + # that's a silly workaround but it increase stability of functional tests on both localhost and CI + # TODO: replace it to proper validation for each quorum instead just one + if spork23_active: + time.sleep(1) self.wait_for_quorum_phase(q_0, 1, expected_members, None, 0, mninfos_online, llmq_type_name) self.log.info("quorumIndex 0: Waiting for quorum connections (init)") self.wait_for_quorum_connections(q_0, expected_connections, mninfos_online, llmq_type_name, wait_proc=lambda: self.bump_mocktime(1)) @@ -1938,6 +1964,8 @@ def mine_cycle_quorum(self, is_first=True): self.log.info("Expected quorum_1 at:" + str(self.nodes[0].getblockcount())) self.log.info("Expected quorum_1 hash:" + str(q_1)) self.log.info("quorumIndex 1: Waiting for phase 1 (init)") + if spork23_active: + time.sleep(1) # see comment above self.wait_for_quorum_phase(q_1, 1, expected_members, None, 0, mninfos_online, llmq_type_name) self.log.info("quorumIndex 1: Waiting for quorum connections (init)") self.wait_for_quorum_connections(q_1, expected_connections, mninfos_online, llmq_type_name, wait_proc=lambda: self.bump_mocktime(1))