mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge #6415: refactor: use self.wait_until in all the dash specific "wait_until_x" logic in order to actually apply the timeout scaling settings
3ba602672c
refactor: use self.wait_until in all the dash specific "wait_until_x" logic in order to actually apply the timeout scaling settings (pasta) Pull request description: ## Issue being fixed or feature implemented Currently we use the raw helper, but that means that timeout scaling isn't applying.. I think this may be a cause of a lot of the functional test failures that we see in tsan / ubsan. ## What was done? ## How Has This Been Tested? hasn't; wait for CI ## Breaking Changes ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] 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)_ ACKs for top commit: knst: utACK3ba602672c
UdjinM6: utACK3ba602672c
Tree-SHA512: 935498f4b296b1abcac8be686cce396b61b654ef62da46de9a23a0f24ad31254f4938a581a6a4e2533576db0e0120861fd690bd9019e893b30990f21d1e48168
This commit is contained in:
commit
f526937790
@ -9,7 +9,7 @@ import json
|
||||
from test_framework.messages import uint256_to_string
|
||||
from test_framework.test_framework import DashTestFramework
|
||||
from test_framework.governance import have_trigger_for_height, prepare_object
|
||||
from test_framework.util import assert_equal, satoshi_round, wait_until_helper
|
||||
from test_framework.util import assert_equal, satoshi_round
|
||||
|
||||
GOVERNANCE_UPDATE_MIN = 60 * 60 # src/governance/object.h
|
||||
|
||||
@ -195,7 +195,7 @@ class DashGovernanceTest (DashTestFramework):
|
||||
self.wait_until(lambda: len(isolated.gobject("list", "valid", "triggers")) == 1, timeout=5)
|
||||
isolated_trigger_hash = list(isolated.gobject("list", "valid", "triggers").keys())[0]
|
||||
self.wait_until(lambda: list(isolated.gobject("list", "valid", "triggers").values())[0]['YesCount'] == 1, timeout=5)
|
||||
more_votes = wait_until_helper(lambda: list(isolated.gobject("list", "valid", "triggers").values())[0]['YesCount'] > 1, timeout=5, do_assert=False)
|
||||
more_votes = self.wait_until(lambda: list(isolated.gobject("list", "valid", "triggers").values())[0]['YesCount'] > 1, timeout=5, do_assert=False)
|
||||
assert_equal(more_votes, False)
|
||||
|
||||
self.log.info("Move 1 block enabling the Superblock maturity window on non-isolated nodes")
|
||||
@ -206,7 +206,7 @@ class DashGovernanceTest (DashTestFramework):
|
||||
self.check_superblockbudget(False)
|
||||
|
||||
self.log.info("The 'winner' should submit new trigger and vote for it, but it's isolated so no triggers should be found")
|
||||
has_trigger = wait_until_helper(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) >= 1, timeout=5, do_assert=False)
|
||||
has_trigger = self.wait_until(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) >= 1, timeout=5, do_assert=False)
|
||||
assert_equal(has_trigger, False)
|
||||
|
||||
self.log.info("Move 1 block inside the Superblock maturity window on non-isolated nodes")
|
||||
@ -217,7 +217,7 @@ class DashGovernanceTest (DashTestFramework):
|
||||
self.wait_until(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) == 1, timeout=5)
|
||||
winning_trigger_hash = list(self.nodes[0].gobject("list", "valid", "triggers").keys())[0]
|
||||
self.wait_until(lambda: list(self.nodes[0].gobject("list", "valid", "triggers").values())[0]['YesCount'] == 1, timeout=5)
|
||||
more_votes = wait_until_helper(lambda: list(self.nodes[0].gobject("list", "valid", "triggers").values())[0]['YesCount'] > 1, timeout=5, do_assert=False)
|
||||
more_votes = self.wait_until(lambda: list(self.nodes[0].gobject("list", "valid", "triggers").values())[0]['YesCount'] > 1, timeout=5, do_assert=False)
|
||||
assert_equal(more_votes, False)
|
||||
|
||||
self.log.info("Make sure amounts aren't trimmed")
|
||||
@ -233,7 +233,7 @@ class DashGovernanceTest (DashTestFramework):
|
||||
|
||||
self.log.info("Every non-isolated MN should vote for the same trigger now, no new triggers should be created")
|
||||
self.wait_until(lambda: list(self.nodes[0].gobject("list", "valid", "triggers").values())[0]['YesCount'] == self.mn_count - 1, timeout=5)
|
||||
more_triggers = wait_until_helper(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) > 1, timeout=5, do_assert=False)
|
||||
more_triggers = self.wait_until(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) > 1, timeout=5, do_assert=False)
|
||||
assert_equal(more_triggers, False)
|
||||
|
||||
self.reconnect_isolated_node(payee_idx, 0)
|
||||
@ -260,7 +260,7 @@ class DashGovernanceTest (DashTestFramework):
|
||||
self.log.info("Should see two triggers now")
|
||||
self.wait_until(lambda: len(isolated.gobject("list", "valid", "triggers")) == 2, timeout=5)
|
||||
self.wait_until(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) == 2, timeout=5)
|
||||
more_triggers = wait_until_helper(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) > 2, timeout=5, do_assert=False)
|
||||
more_triggers = self.wait_until(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) > 2, timeout=5, do_assert=False)
|
||||
assert_equal(more_triggers, False)
|
||||
|
||||
self.log.info("Move another block inside the Superblock maturity window")
|
||||
|
@ -13,7 +13,7 @@ Checks LLMQs signing sessions
|
||||
from test_framework.messages import CSigShare, msg_qsigshare, uint256_to_string
|
||||
from test_framework.p2p import P2PInterface
|
||||
from test_framework.test_framework import DashTestFramework
|
||||
from test_framework.util import assert_equal, assert_raises_rpc_error, force_finish_mnsync, wait_until_helper
|
||||
from test_framework.util import assert_equal, assert_raises_rpc_error, force_finish_mnsync
|
||||
|
||||
|
||||
class LLMQSigningTest(DashTestFramework):
|
||||
@ -55,7 +55,7 @@ class LLMQSigningTest(DashTestFramework):
|
||||
self.wait_until(lambda: check_sigs(hasrecsigs, isconflicting1, isconflicting2), timeout = timeout)
|
||||
|
||||
def assert_sigs_nochange(hasrecsigs, isconflicting1, isconflicting2, timeout):
|
||||
assert not wait_until_helper(lambda: not check_sigs(hasrecsigs, isconflicting1, isconflicting2), timeout = timeout, do_assert = False)
|
||||
assert not self.wait_until(lambda: not check_sigs(hasrecsigs, isconflicting1, isconflicting2), timeout = timeout, do_assert = False)
|
||||
|
||||
# Initial state
|
||||
wait_for_sigs(False, False, False, 1)
|
||||
|
@ -768,7 +768,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
|
||||
def isolate_node(self, node_num, timeout=5):
|
||||
self.nodes[node_num].setnetworkactive(False)
|
||||
wait_until_helper(lambda: self.nodes[node_num].getconnectioncount() == 0, timeout=timeout)
|
||||
self.wait_until(lambda: self.nodes[node_num].getconnectioncount() == 0, timeout=timeout)
|
||||
|
||||
def reconnect_isolated_node(self, a, b):
|
||||
self.nodes[a].setnetworkactive(True)
|
||||
@ -893,8 +893,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
for node in self.nodes:
|
||||
node.mocktime = self.mocktime
|
||||
|
||||
def wait_until(self, test_function, timeout=60, lock=None):
|
||||
return wait_until_helper(test_function, timeout=timeout, lock=lock, timeout_factor=self.options.timeout_factor)
|
||||
def wait_until(self, test_function, timeout=60, lock=None, sleep=0.5, do_assert=True):
|
||||
return wait_until_helper(test_function, timeout=timeout, lock=lock, timeout_factor=self.options.timeout_factor, sleep=sleep, do_assert=do_assert)
|
||||
|
||||
# Private helper methods. These should not be accessed by the subclass test scripts.
|
||||
|
||||
@ -1606,7 +1606,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
return node.getrawtransaction(txid)
|
||||
except:
|
||||
return False
|
||||
if wait_until_helper(check_tx, timeout=timeout, sleep=1, do_assert=expected) and not expected:
|
||||
if self.wait_until(check_tx, timeout=timeout, sleep=1, do_assert=expected) and not expected:
|
||||
raise AssertionError("waiting unexpectedly succeeded")
|
||||
|
||||
def create_isdlock(self, hextx):
|
||||
@ -1638,7 +1638,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
return node.getrawtransaction(txid, True)["instantlock"]
|
||||
except:
|
||||
return False
|
||||
if wait_until_helper(check_instantlock, timeout=timeout, sleep=1, do_assert=expected) and not expected:
|
||||
if self.wait_until(check_instantlock, timeout=timeout, sleep=1, do_assert=expected) and not expected:
|
||||
raise AssertionError("waiting unexpectedly succeeded")
|
||||
|
||||
def wait_for_chainlocked_block(self, node, block_hash, expected=True, timeout=15):
|
||||
@ -1648,7 +1648,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
return block["confirmations"] > 0 and block["chainlock"]
|
||||
except:
|
||||
return False
|
||||
if wait_until_helper(check_chainlocked_block, timeout=timeout, sleep=0.1, do_assert=expected) and not expected:
|
||||
if self.wait_until(check_chainlocked_block, timeout=timeout, sleep=0.1, do_assert=expected) and not expected:
|
||||
raise AssertionError("waiting unexpectedly succeeded")
|
||||
|
||||
def wait_for_chainlocked_block_all_nodes(self, block_hash, timeout=15, expected=True):
|
||||
@ -1656,14 +1656,14 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
self.wait_for_chainlocked_block(node, block_hash, expected=expected, timeout=timeout)
|
||||
|
||||
def wait_for_best_chainlock(self, node, block_hash, timeout=15):
|
||||
wait_until_helper(lambda: node.getbestchainlock()["blockhash"] == block_hash, timeout=timeout, sleep=0.1)
|
||||
self.wait_until(lambda: node.getbestchainlock()["blockhash"] == block_hash, timeout=timeout, sleep=0.1)
|
||||
|
||||
def wait_for_sporks_same(self, timeout=30):
|
||||
def check_sporks_same():
|
||||
self.bump_mocktime(1)
|
||||
sporks = self.nodes[0].spork('show')
|
||||
return all(node.spork('show') == sporks for node in self.nodes[1:])
|
||||
wait_until_helper(check_sporks_same, timeout=timeout, sleep=0.5)
|
||||
self.wait_until(check_sporks_same, timeout=timeout, sleep=0.5)
|
||||
|
||||
def wait_for_quorum_connections(self, quorum_hash, expected_connections, mninfos, llmq_type_name="llmq_test", timeout = 60, wait_proc=None):
|
||||
def check_quorum_connections():
|
||||
@ -1702,7 +1702,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
# no sessions at all - not ok
|
||||
return ret()
|
||||
|
||||
wait_until_helper(check_quorum_connections, timeout=timeout, sleep=1)
|
||||
self.wait_until(check_quorum_connections, timeout=timeout, sleep=1)
|
||||
|
||||
def wait_for_masternode_probes(self, quorum_hash, mninfos, timeout = 30, wait_proc=None, llmq_type_name="llmq_test"):
|
||||
def check_probes():
|
||||
@ -1740,7 +1740,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
return ret()
|
||||
return True
|
||||
|
||||
wait_until_helper(check_probes, timeout=timeout, sleep=1)
|
||||
self.wait_until(check_probes, timeout=timeout, sleep=1)
|
||||
|
||||
def wait_for_quorum_phase(self, quorum_hash, phase, expected_member_count, check_received_messages, check_received_messages_count, mninfos, llmq_type_name="llmq_test", timeout=30, sleep=0.5):
|
||||
def check_dkg_session():
|
||||
@ -1762,7 +1762,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
break
|
||||
return member_count >= expected_member_count
|
||||
|
||||
wait_until_helper(check_dkg_session, timeout=timeout, sleep=sleep)
|
||||
self.wait_until(check_dkg_session, timeout=timeout, sleep=sleep)
|
||||
|
||||
def wait_for_quorum_commitment(self, quorum_hash, nodes, llmq_type=100, timeout=15):
|
||||
def check_dkg_comitments():
|
||||
@ -1783,7 +1783,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
return False
|
||||
return True
|
||||
|
||||
wait_until_helper(check_dkg_comitments, timeout=timeout, sleep=1)
|
||||
self.wait_until(check_dkg_comitments, timeout=timeout, sleep=1)
|
||||
|
||||
def wait_for_quorum_list(self, quorum_hash, nodes, timeout=15, sleep=2, llmq_type_name="llmq_test"):
|
||||
def wait_func():
|
||||
@ -1793,7 +1793,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
self.bump_mocktime(sleep, nodes=nodes)
|
||||
self.generate(self.nodes[0], 1, sync_fun=lambda: self.sync_blocks(nodes))
|
||||
return False
|
||||
wait_until_helper(wait_func, timeout=timeout, sleep=sleep)
|
||||
self.wait_until(wait_func, timeout=timeout, sleep=sleep)
|
||||
|
||||
def wait_for_quorums_list(self, quorum_hash_0, quorum_hash_1, nodes, llmq_type_name="llmq_test", timeout=15, sleep=2):
|
||||
def wait_func():
|
||||
@ -1804,7 +1804,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
self.bump_mocktime(sleep, nodes=nodes)
|
||||
self.generate(self.nodes[0], 1, sync_fun=lambda: self.sync_blocks(nodes))
|
||||
return False
|
||||
wait_until_helper(wait_func, timeout=timeout, sleep=sleep)
|
||||
self.wait_until(wait_func, timeout=timeout, sleep=sleep)
|
||||
|
||||
def move_blocks(self, nodes, num_blocks):
|
||||
self.bump_mocktime(1, nodes=nodes)
|
||||
@ -2039,7 +2039,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
if not mn.node.quorum("hasrecsig", llmq_type, rec_sig_id, rec_sig_msg_hash):
|
||||
return False
|
||||
return True
|
||||
wait_until_helper(check_recovered_sig, timeout=timeout, sleep=1)
|
||||
self.wait_until(check_recovered_sig, timeout=timeout, sleep=1)
|
||||
|
||||
def get_recovered_sig(self, rec_sig_id, rec_sig_msg_hash, llmq_type=100, use_platformsign=False):
|
||||
# Note: recsigs aren't relayed to regular nodes by default,
|
||||
@ -2100,7 +2100,7 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
(valid, len(mns), quorum_type_in, quorum_hash_in))
|
||||
return valid == len(mns)
|
||||
|
||||
wait_until_helper(test_mns, timeout=timeout, sleep=0.5)
|
||||
self.wait_until(test_mns, timeout=timeout, sleep=0.5)
|
||||
|
||||
def wait_for_mnauth(self, node, count, timeout=10):
|
||||
def test():
|
||||
@ -2110,4 +2110,4 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
if "verified_proregtx_hash" in p and p["verified_proregtx_hash"] != "":
|
||||
c += 1
|
||||
return c >= count
|
||||
wait_until_helper(test, timeout=timeout)
|
||||
self.wait_until(test, timeout=timeout)
|
||||
|
Loading…
Reference in New Issue
Block a user