Page MenuHomePhabricator

refactor: Introduce GetFirstStoredBlock helper function
ClosedPublic

Authored by PiRK on Feb 2 2023, 14:49.

Details

Reviewers
sdulfari
Group Reviewers
Restricted Project
Commits
rABC093c9f219282: refactor: Introduce GetFirstStoredBlock helper function
Summary
Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Feb 2 2023, 14:49

Failed tests logs:

====== Bitcoin ABC functional tests: abc_p2p_compactproofs.py ======

------- Stdout: -------
2023-02-02T15:02:04.524000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230202_150131/abc_p2p_compactproofs_9
2023-02-02T15:02:09.666000Z TestFramework (INFO): Check we send a getavaproofs message to our avalanche outbound peers
2023-02-02T15:02:11.682000Z TestFramework (INFO): Check we send periodic getavaproofs message to some of our peers
2023-02-02T15:02:11.733000Z TestFramework (INFO): After the first avaproofs has been received, all the peers are requested periodically
2023-02-02T15:02:11.976000Z TestFramework (INFO): Empty avaproofs will not trigger any request
2023-02-02T15:02:11.978000Z TestFramework (INFO): Check we send a getavaproofs message to our manually connected peers that support avalanche
2023-02-02T15:02:12.878000Z TestFramework (INFO): Check the node responds to getavaproofs messages
2023-02-02T15:02:20.215000Z TestFramework (INFO): Check the node requests the missing proofs after receiving an avaproofs message
2023-02-02T15:02:20.594000Z TestFramework (INFO): The node ignores unsollicited avaproofs
2023-02-02T15:02:23.756000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
    def avapeer_connected():
        node_list = []
        try:
            node_list = node.getavalanchepeerinfo(proofid_hex)[0]['node_list']
        except BaseException:
            pass

        return n.nodeid in node_list
'''
2023-02-02T15:02:23.851000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 135, in main
    self.run_test()
  File "/work/test/functional/abc_p2p_compactproofs.py", line 676, in run_test
    self.test_request_missing_proofs()
  File "/work/test/functional/abc_p2p_compactproofs.py", line 300, in test_request_missing_proofs
    spam_peer = get_ava_p2p_interface(self, node)
  File "/work/test/functional/test_framework/avatools.py", line 393, in get_ava_p2p_interface
    wait_until_helper(avapeer_connected, timeout=3)
  File "/work/test/functional/test_framework/util.py", line 285, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
    def avapeer_connected():
        node_list = []
        try:
            node_list = node.getavalanchepeerinfo(proofid_hex)[0]['node_list']
        except BaseException:
            pass

        return n.nodeid in node_list
''' not true after 3.0 seconds
2023-02-02T15:02:23.902000Z TestFramework (INFO): Stopping nodes
2023-02-02T15:02:24.003000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230202_150131/abc_p2p_compactproofs_9
2023-02-02T15:02:24.003000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230202_150131/abc_p2p_compactproofs_9/test_framework.log
2023-02-02T15:02:24.003000Z TestFramework (ERROR): 
2023-02-02T15:02:24.003000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230202_150131/abc_p2p_compactproofs_9' to consolidate all logs
2023-02-02T15:02:24.003000Z TestFramework (ERROR): 
2023-02-02T15:02:24.003000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2023-02-02T15:02:24.003000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2023-02-02T15:02:24.003000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_p2p_compactproofs.py

This (unrelated failure) is an issue of timeout slightly too short.
The P2P interface was created before 15:02:20.6:

test  2023-02-02T15:02:20.600000Z TestFramework.p2p (DEBUG): Connecting to Bitcoin ABC Node: 127.0.0.1:20577

More than 3 seconds (the timeout for receiving the proof) in the log I see that a proof was sent:

test  2023-02-02T15:02:23.850000Z TestFramework.p2p (DEBUG): Send message to 127.0.0.1:20577: msg_avaproof(proof=AvalancheProof(sequence=42, expiration=2000000000, master=03d3e6025ccdfac83c04ec4a8646af734a6475a26692928cfc17eac25607a91927, payout_script=76a914000000000000000000000000000000000000000088ac, signature=b'VxMYp/3J1kyU/yFiK/TZdHsh/1s4p6F69f9n3e+zf1FtDN1wVkgWd95XZvaNDW0gbJiKKa5P6OjnGbcBWY0ACA==', stakes=[<test_framework.messages.AvalancheSignedStake object at 0x7f2ae997b850>])) 
 test  2023-02-02T15:02:23.851000Z TestFramework (ERROR): Assertion failed 
                                   Traceback (most recent call last):
                                     File "/work/test/functional/test_framework/test_framework.py", line 135, in main
                                       self.run_test()
                                     File "/work/test/functional/abc_p2p_compactproofs.py", line 676, in run_test
                                       self.test_request_missing_proofs()
                                     File "/work/test/functional/abc_p2p_compactproofs.py", line 300, in test_request_missing_proofs
                                       spam_peer = get_ava_p2p_interface(self, node)
                                     File "/work/test/functional/test_framework/avatools.py", line 393, in get_ava_p2p_interface
                                       wait_until_helper(avapeer_connected, timeout=3)
                                     File "/work/test/functional/test_framework/util.py", line 285, in wait_until_helper
                                       raise AssertionError(
                                   AssertionError: Predicate ''''
                                       def avapeer_connected():
                                           node_list = []
                                           try:
                                               node_list = node.getavalanchepeerinfo(proofid_hex)[0]['node_list']
                                           except BaseException:
                                               pass
                                           return n.nodeid in node_list
                                   ''' not true after 3.0 seconds
 test  2023-02-02T15:02:23.851000Z TestFramework (DEBUG): Closing down network thread 
 node0 2023-02-02T15:02:23.851337Z [../../src/net_processing.cpp:3530] [ProcessMessage] received: avaproof (287 bytes) peer=0 
 node0 2023-02-02T15:02:23.851506Z [../../src/net_processing.cpp:7253] [ReceivedAvalancheProof] New avalanche proof: peer=0, proofid 0cd32c11c7180a6965931f316c64fa15da9d4030c8097f85c22aeeda508e07c0
This revision is now accepted and ready to land.Feb 2 2023, 19:38