Page MenuHomePhabricator

Properly check the node polls for contenders upon restart with no prior block being mined
ClosedPublic

Authored by Fabien on Wed, Apr 30, 12:43.

Details

Summary

The abc_p2p_avalanche_contender_voting.py test incorrectly assumes that no block is mined after the node restarted. But blocks are mined to generate the coinbase transactions required for staking when building the quorum.

Instead we can prepare the proofs before the restart and assign them to the peers in order to build the quorum with no block being mined.

Loosely depends on D18027 (another fix for this test).

Test Plan
./test/functional/test_runner.py abc_p2p_avalanche_contender_voting

Diff Detail

Repository
rABC Bitcoin ABC
Branch
fix_contenders_2
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33173
Build 65829: Build Diffbuild-without-wallet · build-diff · build-debug · build-clang-tidy · build-clang
Build 65828: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Wed, Apr 30, 12:43

Failed tests logs:

====== Bitcoin ABC extended functional tests: abc_p2p_avalanche_contender_voting.py ======

------- Stdout: -------
2025-04-30T12:54:07.681000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250430_125405_7633/abc_p2p_avalanche_contender_voting_10
2025-04-30T12:54:23.253000Z TestFramework (INFO): Check votes after contender promotion
2025-04-30T12:54:35.598000Z TestFramework (INFO): Check votes after staking rewards have been computed
2025-04-30T12:54:35.765000Z TestFramework (INFO): Vote on contenders: manual winner + local winner
2025-04-30T12:54:40.835000Z TestFramework (INFO): Vote on contenders: local winner only
2025-04-30T12:54:45.943000Z TestFramework (INFO): Vote on contenders: 1 winner(s) other than local winner
2025-04-30T12:54:51.348000Z TestFramework (INFO): Vote on contenders: 2 winner(s) other than local winner
2025-04-30T12:54:56.086000Z TestFramework (INFO): Vote on contenders: 3 winner(s) other than local winner
2025-04-30T12:55:06.582000Z TestFramework (INFO): Vote on contenders: zero winners
2025-04-30T12:55:11.621000Z TestFramework (INFO): Vote on contenders: stale contenders
2025-04-30T12:55:18.270000Z TestFramework (INFO): Check votes after node restart
2025-04-30T12:56:43.109000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
        self.wait_until(lambda: find_polled_contenders())
'''
2025-04-30T12:56:43.109000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 152, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 142, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_contender_voting.py", line 565, in run_test
    self.wait_until(lambda: find_polled_contenders())
  File "/work/test/functional/test_framework/test_framework.py", line 890, in wait_until
    return wait_until_helper(
           ^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/util.py", line 309, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
        self.wait_until(lambda: find_polled_contenders())
''' not true after 60.0 seconds
2025-04-30T12:56:43.161000Z TestFramework (INFO): Stopping nodes
2025-04-30T12:56:43.212000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250430_125405_7633/abc_p2p_avalanche_contender_voting_10
2025-04-30T12:56:43.212000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250430_125405_7633/abc_p2p_avalanche_contender_voting_10/test_framework.log
2025-04-30T12:56:43.212000Z TestFramework (ERROR): 
2025-04-30T12:56:43.212000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250430_125405_7633/abc_p2p_avalanche_contender_voting_10' to consolidate all logs
2025-04-30T12:56:43.212000Z TestFramework (ERROR): 
2025-04-30T12:56:43.212000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2025-04-30T12:56:43.212000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2025-04-30T12:56:43.212000Z TestFramework (ERROR):
====== Bitcoin ABC extended functional tests with the next upgrade activated: abc_p2p_avalanche_contender_voting.py ======

------- Stdout: -------
2025-04-30T13:18:12.452000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250430_131811_26801/abc_p2p_avalanche_contender_voting_10
2025-04-30T13:18:17.908000Z TestFramework (INFO): Check votes after contender promotion
2025-04-30T13:18:26.141000Z TestFramework (INFO): Check votes after staking rewards have been computed
2025-04-30T13:18:26.278000Z TestFramework (INFO): Vote on contenders: manual winner + local winner
2025-04-30T13:18:28.876000Z TestFramework (INFO): Vote on contenders: local winner only
2025-04-30T13:18:31.454000Z TestFramework (INFO): Vote on contenders: 1 winner(s) other than local winner
2025-04-30T13:18:33.994000Z TestFramework (INFO): Vote on contenders: 2 winner(s) other than local winner
2025-04-30T13:18:36.329000Z TestFramework (INFO): Vote on contenders: 3 winner(s) other than local winner
2025-04-30T13:18:39.144000Z TestFramework (INFO): Vote on contenders: zero winners
2025-04-30T13:18:41.883000Z TestFramework (INFO): Vote on contenders: stale contenders
2025-04-30T13:18:44.990000Z TestFramework (INFO): Check votes after node restart
2025-04-30T13:19:54.792000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
        self.wait_until(lambda: find_polled_contenders())
'''
2025-04-30T13:19:54.792000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 152, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 142, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_contender_voting.py", line 565, in run_test
    self.wait_until(lambda: find_polled_contenders())
  File "/work/test/functional/test_framework/test_framework.py", line 890, in wait_until
    return wait_until_helper(
           ^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/util.py", line 309, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
        self.wait_until(lambda: find_polled_contenders())
''' not true after 60.0 seconds
2025-04-30T13:19:54.844000Z TestFramework (INFO): Stopping nodes
2025-04-30T13:19:54.945000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250430_131811_26801/abc_p2p_avalanche_contender_voting_10
2025-04-30T13:19:54.945000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250430_131811_26801/abc_p2p_avalanche_contender_voting_10/test_framework.log
2025-04-30T13:19:54.945000Z TestFramework (ERROR): 
2025-04-30T13:19:54.945000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250430_131811_26801/abc_p2p_avalanche_contender_voting_10' to consolidate all logs
2025-04-30T13:19:54.945000Z TestFramework (ERROR): 
2025-04-30T13:19:54.945000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2025-04-30T13:19:54.945000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2025-04-30T13:19:54.945000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC extended functional tests: abc_p2p_avalanche_contender_voting.py
Bitcoin ABC extended functional tests with the next upgrade activated: abc_p2p_avalanche_contender_voting.py

roqqit requested changes to this revision.Wed, Apr 30, 15:59
roqqit added a subscriber: roqqit.
roqqit added inline comments.
test/functional/abc_p2p_avalanche_contender_voting.py
567–568

cleanup. it is now redundant

This revision now requires changes to proceed.Wed, Apr 30, 15:59
test/functional/abc_p2p_avalanche_contender_voting.py
567–568

actually does it make sense to put the check after find_polled_contenders instead of before? although unlikely considering there are 16 proofs to finalize, it is possible that a contender would be finalized and then you would fail the check for 12 polled contenders

Fabien requested review of this revision.Wed, Apr 30, 16:47
Fabien added inline comments.
test/functional/abc_p2p_avalanche_contender_voting.py
567–568

Yes you could miss the contenders polls if you swap these lines

Remove redundant finalization check

This revision is now accepted and ready to land.Wed, Apr 30, 18:56
This revision was landed with ongoing or failed builds.Wed, Apr 30, 19:02
This revision was automatically updated to reflect the committed changes.