Page MenuHomePhabricator

use existing chainstate reference in various places
ClosedPublic

Authored by PiRK on Jul 12 2022, 15:41.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCc416c48044ef: use existing chainstate reference in various places
Summary

This removes calls to the global chainstate in Bitcoin ABC specific code that was missed by previous core backports.

Also fix a few linting/autoformatting errors that were somehow introduced and not picked up by arc lint in D11686

Depends on D11737

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jul 12 2022, 15:41

Tail of the build log:

[406/479] Running utility command for check-bitcoin-validation_flush_tests
[407/479] Running utility command for check-bitcoin-compilerbug_tests
[408/479] bitcoin: testing cuckoocache_tests
[409/479] bitcoin: testing script_standard_tests
[410/479] Running utility command for check-bitcoin-cuckoocache_tests
[411/479] Running utility command for check-bitcoin-script_standard_tests
[412/479] bitcoin: testing op_reversebytes_tests
[413/479] Running utility command for check-bitcoin-op_reversebytes_tests
[414/479] bitcoin: testing blockstatus_tests
[415/479] bitcoin: testing schnorr_tests
[416/479] Running utility command for check-bitcoin-blockstatus_tests
[417/479] bitcoin: testing intmath_tests
[418/479] Running utility command for check-bitcoin-schnorr_tests
[419/479] bitcoin: testing versionbits_tests
[420/479] Running utility command for check-bitcoin-intmath_tests
[421/479] Running utility command for check-bitcoin-versionbits_tests
[422/479] Running utility command for check-pow-grasberg_tests
[423/479] bitcoin: testing radix_tests
[424/479] bitcoin: testing shortidprocessor_tests
[425/479] Running utility command for check-pow-aserti32d_tests
[426/479] Running utility command for check-bitcoin-radix_tests
[427/479] bitcoin: testing ismine_tests
[428/479] Running pow test suite
PASSED: pow test suite
[429/479] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/util.cpp.o
[430/479] Running utility command for check-bitcoin-shortidprocessor_tests
[431/479] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/uritests.cpp.o
[432/479] Running utility command for check-bitcoin-ismine_tests
[433/479] bitcoin: testing cashaddr_tests
[434/479] secp256k1: testing secp256k1-exhaustive_tests
[435/479] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/addressbooktests.cpp.o
[436/479] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/wallettests.cpp.o
[437/479] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/__/__/wallet/test/wallet_test_fixture.cpp.o
[438/479] bitcoin: testing checkqueue_tests
[439/479] Running utility command for check-bitcoin-cashaddr_tests
[440/479] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/paymentservertests.cpp.o
[441/479] Running utility command for check-bitcoin-checkqueue_tests
[442/479] bitcoin: testing validation_block_tests
[443/479] bitcoin: testing blockcheck_tests
[444/479] Running utility command for check-bitcoin-validation_block_tests
[445/479] Running utility command for check-bitcoin-blockcheck_tests
[446/479] bitcoin: testing crypto_tests
[447/479] Running utility command for check-bitcoin-crypto_tests
[448/479] Linking CXX executable src/qt/test/test_bitcoin-qt
[449/479] bitcoin-qt: testing test_bitcoin-qt
[450/479] Running bitcoin-qt test suite
PASSED: bitcoin-qt test suite
[451/479] bitcoin: testing transaction_tests
[452/479] Running utility command for check-bitcoin-transaction_tests
[453/479] bitcoin: testing coinselector_tests
[454/479] Running utility command for check-bitcoin-coinselector_tests
[455/479] bitcoin: testing coins_tests
[456/479] Running utility command for check-bitcoin-coins_tests
[457/479] Running bitcoin test suite
PASSED: bitcoin test suite
[458/479] secp256k1: testing secp256k1-tests
[459/479] Running secp256k1 test suite
PASSED: secp256k1 test suite
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

[398/472] bitcoin: testing compilerbug_tests
[399/472] Running utility command for check-bitcoin-timedata_tests
[400/472] Running utility command for check-bitcoin-compilerbug_tests
[401/472] bitcoin: testing script_standard_tests
[402/472] Running utility command for check-bitcoin-script_standard_tests
[403/472] bitcoin: testing blockstatus_tests
[404/472] Running utility command for check-bitcoin-blockstatus_tests
[405/472] bitcoin: testing ismine_tests
[406/472] Running utility command for check-bitcoin-ismine_tests
[407/472] bitcoin: testing versionbits_tests
[408/472] Running utility command for check-bitcoin-versionbits_tests
[409/472] bitcoin: testing op_reversebytes_tests
[410/472] bitcoin: testing blockcheck_tests
[411/472] Running utility command for check-bitcoin-blockcheck_tests
[412/472] bitcoin: testing shortidprocessor_tests
[413/472] bitcoin: testing validation_block_tests
[414/472] bitcoin: testing schnorr_tests
[415/472] bitcoin: testing cashaddr_tests
[416/472] bitcoin: testing cuckoocache_tests
[417/472] Running utility command for check-bitcoin-op_reversebytes_tests
[418/472] Running utility command for check-bitcoin-shortidprocessor_tests
[419/472] Running utility command for check-bitcoin-validation_block_tests
[420/472] Running utility command for check-bitcoin-schnorr_tests
[421/472] Running utility command for check-bitcoin-cuckoocache_tests
[422/472] Running utility command for check-bitcoin-cashaddr_tests
[423/472] bitcoin: testing radix_tests
[424/472] Running utility command for check-bitcoin-radix_tests
[425/472] pow: testing daa_tests
[426/472] Running utility command for check-pow-daa_tests
[427/472] pow: testing eda_tests
[428/472] Running utility command for check-pow-eda_tests
[429/472] pow: testing grasberg_tests
[430/472] Running utility command for check-pow-grasberg_tests
[431/472] bitcoin: testing intmath_tests
[432/472] bitcoin: testing checkqueue_tests
[433/472] Running utility command for check-bitcoin-intmath_tests
[434/472] Running utility command for check-bitcoin-checkqueue_tests
[435/472] bitcoin: testing crypto_tests
[436/472] Running utility command for check-bitcoin-crypto_tests
[437/472] bitcoin: testing transaction_tests
[438/472] Running utility command for check-bitcoin-transaction_tests
[439/472] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/__/__/wallet/test/wallet_test_fixture.cpp.o
[440/472] bitcoin: testing coinselector_tests
[441/472] Running utility command for check-bitcoin-coinselector_tests
[442/472] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/paymentservertests.cpp.o
[443/472] pow: testing aserti32d_tests
[444/472] Running utility command for check-pow-aserti32d_tests
[445/472] Running pow test suite
PASSED: pow test suite
[446/472] Building CXX object src/qt/test/CMakeFiles/test_bitcoin-qt.dir/wallettests.cpp.o
[447/472] Linking CXX executable src/qt/test/test_bitcoin-qt
[448/472] bitcoin-qt: testing test_bitcoin-qt
[449/472] Running bitcoin-qt test suite
PASSED: bitcoin-qt test suite
[450/472] bitcoin: testing coins_tests
[451/472] Running utility command for check-bitcoin-coins_tests
[452/472] Running bitcoin test suite
PASSED: bitcoin test suite
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1

Tail of the build log:

wallet_listtransactions.py                             | ✓ Passed  | 5 s
wallet_listtransactions.py --descriptors               | ✓ Passed  | 4 s
wallet_multiwallet.py                                  | ✓ Passed  | 20 s
wallet_multiwallet.py --usecli                         | ✓ Passed  | 16 s
wallet_reorgsrestore.py                                | ✓ Passed  | 4 s
wallet_resendwallettransactions.py                     | ✓ Passed  | 14 s
wallet_send.py                                         | ✓ Passed  | 9 s
wallet_startup.py                                      | ✓ Passed  | 3 s
wallet_txn_clone.py                                    | ✓ Passed  | 3 s
wallet_txn_clone.py --mineblock                        | ✓ Passed  | 4 s
wallet_txn_doublespend.py                              | ✓ Passed  | 3 s
wallet_txn_doublespend.py --mineblock                  | ✓ Passed  | 4 s
wallet_watchonly.py                                    | ✓ Passed  | 1 s
wallet_watchonly.py --usecli                           | ✓ Passed  | 2 s

ALL                                                    | ✓ Passed  | 1910 s (accumulated) 
Runtime: 383 s

----------------------------------------------------------------------
Ran 10 tests in 0.133s

OK

[34/480] Test Bitcoin RPC authentication...
...
----------------------------------------------------------------------
Ran 3 tests in 0.004s

OK
[36/480] cd /work/contrib/devtools/chainparams && /usr/bin/python3.7 ./test_make_chainparams.py
.....
----------------------------------------------------------------------
Ran 5 tests in 0.001s

OK
[194/480] Running seeder test suite
PASSED: seeder test suite
[200/480] Building CXX object src/avalanche/test/CMakeFiles/test-avalanche.dir/processor_tests.cpp.o
FAILED: src/avalanche/test/CMakeFiles/test-avalanche.dir/processor_tests.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBOOST_TEST_DYN_LINK -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIE -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/avalanche/test/CMakeFiles/test-avalanche.dir/processor_tests.cpp.o -MF src/avalanche/test/CMakeFiles/test-avalanche.dir/processor_tests.cpp.o.d -o src/avalanche/test/CMakeFiles/test-avalanche.dir/processor_tests.cpp.o -c ../../src/avalanche/test/processor_tests.cpp
../../src/avalanche/test/processor_tests.cpp: In lambda function:
../../src/avalanche/test/processor_tests.cpp:1310:38: error: ‘chainman’ is not captured
             CCoinsViewCache &coins = chainman.ActiveChainstate().CoinsTip();
                                      ^~~~~~~~
../../src/avalanche/test/processor_tests.cpp:1307:38: note: the lambda has no capture-default
     auto spendProofUtxo = [&processor](ProofRef proof) {
                                      ^
../../src/avalanche/test/processor_tests.cpp:1239:24: note: ‘ChainstateManager& chainman’ declared here
     ChainstateManager &chainman = *Assert(m_node.chainman);
                        ^~~~~~~~
[432/480] Running pow test suite
PASSED: pow test suite
[438/480] Running bitcoin-qt test suite
PASSED: bitcoin-qt test suite
[454/480] Running secp256k1 test suite
PASSED: secp256k1 test suite
[459/480] Running bitcoin test suite
PASSED: bitcoin test suite
ninja: build stopped: cannot make progress due to previous errors.
Build build-debug failed with exit code 1

Tail of the build log:

wallet_keypool.py                                      | ○ Skipped | 0 s
wallet_keypool_topup.py                                | ○ Skipped | 0 s
wallet_keypool_topup.py --descriptors                  | ○ Skipped | 0 s
wallet_labels.py                                       | ○ Skipped | 0 s
wallet_labels.py --descriptors                         | ○ Skipped | 0 s
wallet_listreceivedby.py                               | ○ Skipped | 0 s
wallet_listsinceblock.py                               | ○ Skipped | 0 s
wallet_listsinceblock.py --descriptors                 | ○ Skipped | 0 s
wallet_listtransactions.py                             | ○ Skipped | 0 s
wallet_listtransactions.py --descriptors               | ○ Skipped | 0 s
wallet_multiwallet.py                                  | ○ Skipped | 0 s
wallet_multiwallet.py --usecli                         | ○ Skipped | 0 s
wallet_reorgsrestore.py                                | ○ Skipped | 0 s
wallet_resendwallettransactions.py                     | ○ Skipped | 0 s
wallet_send.py                                         | ○ Skipped | 0 s
wallet_startup.py                                      | ○ Skipped | 0 s
wallet_txn_clone.py                                    | ○ Skipped | 0 s
wallet_txn_clone.py --mineblock                        | ○ Skipped | 0 s
wallet_txn_doublespend.py                              | ○ Skipped | 0 s
wallet_txn_doublespend.py --mineblock                  | ○ Skipped | 0 s
wallet_watchonly.py                                    | ○ Skipped | 0 s
wallet_watchonly.py --usecli                           | ○ Skipped | 0 s

ALL                                                    | ✓ Passed  | 748 s (accumulated) 
Runtime: 150 s

----------------------------------------------------------------------
Ran 10 tests in 0.170s

OK

[152/440] Test Bitcoin RPC authentication...
...
----------------------------------------------------------------------
Ran 3 tests in 0.005s

OK
[153/440] cd /work/contrib/devtools/chainparams && /usr/bin/python3.7 ./test_make_chainparams.py
.....
----------------------------------------------------------------------
Ran 5 tests in 0.001s

OK
[180/440] Running seeder test suite
PASSED: seeder test suite
[183/440] Running pow test suite
PASSED: pow test suite
[187/440] Running bitcoin-qt test suite
PASSED: bitcoin-qt test suite
[188/440] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_tests.cpp.o
In file included from /usr/include/boost/test/unit_test.hpp:19,
                 from ../../src/test/script_tests.cpp:30:
../../src/test/script_tests.cpp: In member function ‘void script_tests::script_build::test_method()’:
../../src/test/script_tests.cpp:540:22: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
 BOOST_AUTO_TEST_CASE(script_build) {
                      ^~~~~~~~~~~~
[419/440] Running bitcoin test suite
PASSED: bitcoin test suite
ninja: build stopped: cannot make progress due to previous errors.
Build build-without-wallet failed with exit code 1

don't forget to capture chainman for use in lambda function

Tail of the build log:

wallet_abandonconflict.py                              | ✓ Passed  | 9 s
wallet_address_types.py                                | ✓ Passed  | 14 s
wallet_address_types.py --descriptors                  | ✓ Passed  | 8 s
wallet_avoidreuse.py                                   | ✓ Passed  | 4 s
wallet_avoidreuse.py --descriptors                     | ✓ Passed  | 4 s
wallet_backup.py                                       | ✓ Passed  | 29 s
wallet_balance.py                                      | ✓ Passed  | 17 s
wallet_balance.py --descriptors                        | ✓ Passed  | 12 s
wallet_basic.py                                        | ✓ Passed  | 27 s
wallet_coinbase_category.py                            | ✓ Passed  | 1 s
wallet_create_tx.py                                    | ✓ Passed  | 6 s
wallet_createwallet.py                                 | ✓ Passed  | 2 s
wallet_createwallet.py --descriptors                   | ✓ Passed  | 2 s
wallet_createwallet.py --usecli                        | ✓ Passed  | 3 s
wallet_descriptor.py                                   | ✓ Passed  | 6 s
wallet_disable.py                                      | ✓ Passed  | 0 s
wallet_dump.py                                         | ✓ Passed  | 4 s
wallet_encryption.py                                   | ✓ Passed  | 5 s
wallet_encryption.py --descriptors                     | ✓ Passed  | 5 s
wallet_hd.py                                           | ✓ Passed  | 6 s
wallet_hd.py --descriptors                             | ✓ Passed  | 5 s
wallet_import_rescan.py                                | ✓ Passed  | 5 s
wallet_import_with_label.py                            | ✓ Passed  | 1 s
wallet_importdescriptors.py                            | ✓ Passed  | 6 s
wallet_importmulti.py                                  | ✓ Passed  | 3 s
wallet_importprunedfunds.py                            | ✓ Passed  | 2 s
wallet_importprunedfunds.py --descriptors              | ✓ Passed  | 2 s
wallet_keypool.py                                      | ✓ Passed  | 3 s
wallet_keypool_topup.py                                | ✓ Passed  | 3 s
wallet_keypool_topup.py --descriptors                  | ✓ Passed  | 3 s
wallet_labels.py                                       | ✓ Passed  | 1 s
wallet_labels.py --descriptors                         | ✓ Passed  | 1 s
wallet_listreceivedby.py                               | ✓ Passed  | 14 s
wallet_listsinceblock.py                               | ✓ Passed  | 4 s
wallet_listsinceblock.py --descriptors                 | ✓ Passed  | 7 s
wallet_listtransactions.py                             | ✓ Passed  | 4 s
wallet_listtransactions.py --descriptors               | ✓ Passed  | 3 s
wallet_multiwallet.py                                  | ✓ Passed  | 39 s
wallet_multiwallet.py --usecli                         | ✓ Passed  | 10 s
wallet_reorgsrestore.py                                | ✓ Passed  | 3 s
wallet_resendwallettransactions.py                     | ✓ Passed  | 3 s
wallet_send.py                                         | ✓ Passed  | 8 s
wallet_startup.py                                      | ✓ Passed  | 2 s
wallet_txn_clone.py                                    | ✓ Passed  | 2 s
wallet_txn_clone.py --mineblock                        | ✓ Passed  | 3 s
wallet_txn_doublespend.py                              | ✓ Passed  | 1 s
wallet_txn_doublespend.py --mineblock                  | ✓ Passed  | 3 s
wallet_watchonly.py                                    | ✓ Passed  | 1 s
wallet_watchonly.py --usecli                           | ✓ Passed  | 1 s

ALL                                                    | ✓ Passed  | 1338 s (accumulated) 
Runtime: 268 s

----------------------------------------------------------------------
Ran 10 tests in 0.092s

OK

ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1

Failed tests logs:

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

------- Stdout: -------
2022-07-12T15:56:54.628000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20220712_155604/abc_p2p_compactproofs_18
2022-07-12T15:56:55.241000Z TestFramework (INFO): Check we send a getavaproofs message to our avalanche outbound peers
2022-07-12T15:56:56.711000Z TestFramework (INFO): Check we send periodic getavaproofs message to some of our peers
2022-07-12T15:57:57.374000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
            self.wait_until(lambda: count_outbounds_getavaproofs()
                            == outbounds_getavaproofs + 3)
'''
2022-07-12T15:57:57.374000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.run_test()
  File "/work/test/functional/abc_p2p_compactproofs.py", line 604, in run_test
    self.test_send_outbound_getavaproofs()
  File "/work/test/functional/abc_p2p_compactproofs.py", line 128, in test_send_outbound_getavaproofs
    self.wait_until(lambda: count_outbounds_getavaproofs()
  File "/work/test/functional/test_framework/test_framework.py", line 677, in wait_until
    timeout_factor=self.options.timeout_factor)
  File "/work/test/functional/test_framework/util.py", line 284, in wait_until_helper
    "Predicate {} not true after {} seconds".format(predicate_source, timeout))
AssertionError: Predicate ''''
            self.wait_until(lambda: count_outbounds_getavaproofs()
                            == outbounds_getavaproofs + 3)
''' not true after 60.0 seconds
2022-07-12T15:57:57.424000Z TestFramework (INFO): Stopping nodes
2022-07-12T15:57:57.626000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20220712_155604/abc_p2p_compactproofs_18
2022-07-12T15:57:57.626000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20220712_155604/abc_p2p_compactproofs_18/test_framework.log
2022-07-12T15:57:57.626000Z TestFramework (ERROR): 
2022-07-12T15:57:57.626000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20220712_155604/abc_p2p_compactproofs_18' to consolidate all logs
2022-07-12T15:57:57.626000Z TestFramework (ERROR): 
2022-07-12T15:57:57.626000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2022-07-12T15:57:57.626000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2022-07-12T15:57:57.626000Z TestFramework (ERROR):

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

Fabien requested changes to this revision.Jul 12 2022, 18:36
Fabien added a subscriber: Fabien.

Tests are still failing, back on your queue

This revision now requires changes to proceed.Jul 12 2022, 18:36

rebase to clear the outdated CI test failures

PiRK planned changes to this revision.Jul 13 2022, 06:28

waiting for the CI tests to finish to assess. It is not clear to me whether the latest failure in a functional test is related to the most recent code change or not.

PiRK requested review of this revision.Jul 13 2022, 08:47

CI tests are passing.

This revision is now accepted and ready to land.Jul 13 2022, 11:38

rebase to remove unwanted dependency on D11704