Page MenuHomePhabricator

[avalanche] Return unconclusive status for the mempool txs that are not pollable
ClosedPublic

Authored by Fabien on Jun 10 2025, 13:39.

Details

Summary

This handles the edge case of txs that are accepted into the mempool but are not pollable yet because the radix tree is full. This transaction should be removable from the mempool (e.g. because of low fee) in order to prevent from from filling the mempool with finalized dust. With this solution the txs that don't fit the radix tree still participate to the fee eviction, and the most valuable txs will be polled after the current radix tree has been mined.

All the housekeeping is already done by the avalanche core, and the rwlock is very efficient for read accesses so performance is not an issue.

Test Plan
ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Branch
avalanche_preconsensus_store_pollable_items
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33591
Build 66661: Build Difflint-circular-dependencies · build-without-wallet · build-diff · build-debug · build-clang-tidy · build-clang
Build 66660: arc lint + arc unit

Event Timeline

Tail of the build log:

[405/584] Linking C executable src/secp256k1/sign-bench
[406/584] Linking C executable src/secp256k1/internal-bench
[407/584] Installing component secp256k1
-- Install configuration: "RelWithDebInfo"
-- Install component: "secp256k1"
-- Installing: /results/artifacts/lib/libsecp256k1.a
-- Installing: /results/artifacts/include/secp256k1.h
-- Installing: /results/artifacts/include/secp256k1_preallocated.h
-- Installing: /results/artifacts/include/secp256k1_recovery.h
-- Installing: /results/artifacts/include/secp256k1_schnorr.h
[408/584] Linking C executable src/secp256k1/ecmult-bench
[409/584] Linking CXX executable src/bitcoin-cli
[410/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[411/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[412/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[413/584] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[414/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[415/584] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[416/584] Linking CXX executable src/bitcoin-tx
[417/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[418/584] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[419/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[420/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[421/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[422/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[423/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[424/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[425/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[426/584] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[427/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[428/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[429/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[430/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[431/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[432/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[433/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[434/584] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[435/584] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[436/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[437/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[438/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[439/584] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[440/584] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[441/584] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[442/584] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[443/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[444/584] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[445/584] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[446/584] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[447/584] Linking CXX executable src/iguana/iguana
[448/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[449/584] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[450/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[451/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[452/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[453/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[454/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[455/584] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1
Fabien planned changes to this revision.Jun 10 2025, 13:44

Tail of the build log:

[397/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[398/582] Building CXX object src/CMakeFiles/bitcoind.dir/bitcoind.cpp.o
[399/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[400/582] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[401/582] Linking CXX executable src/bitcoin-cli
[402/582] Building CXX object src/CMakeFiles/server.dir/rpc/server.cpp.o
[403/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[404/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[405/582] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[406/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[407/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[408/582] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[409/582] Linking CXX executable src/bitcoin-tx
[410/582] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[411/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[412/582] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o
[413/582] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[414/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[415/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[416/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[417/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[418/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[419/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[420/582] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[421/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[422/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[423/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[424/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[425/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[426/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[427/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[428/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[429/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[430/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[431/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[432/582] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[433/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[434/582] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[435/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[436/582] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[437/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[438/582] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[439/582] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[440/582] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[441/582] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[442/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[443/582] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[444/582] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[445/582] Linking CXX executable src/iguana/iguana
[446/582] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[447/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[448/582] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[449/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[450/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[451/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[452/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[453/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[454/582] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1

Failed tests logs:

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

------- Stdout: -------
2025-06-10T13:50:51.862000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250610_134759_15720/abc_p2p_avalanche_cooldown_56
2025-06-10T13:50:55.960000Z TestFramework (INFO): First poll is legit
2025-06-10T13:50:56.015000Z TestFramework (INFO): Subsequent polls are spams for type {CInv().typemap[inv[1]]}
2025-06-10T13:50:56.023000Z TestFramework (INFO): Subsequent polls are spams for type {CInv().typemap[inv[1]]}
2025-06-10T13:50:56.078000Z TestFramework (INFO): Subsequent polls are spams for type {CInv().typemap[inv[1]]}
2025-06-10T13:50:56.230000Z TestFramework (INFO): Subsequent polls are spams for unknown type
2025-06-10T13:51:00.526000Z TestFramework (INFO): First poll is legit for type Block
2025-06-10T13:51:00.582000Z TestFramework (INFO): Subsequent polls are legit
2025-06-10T13:51:01.156000Z TestFramework (INFO): First poll is legit for type avalanche proof
2025-06-10T13:51:01.212000Z TestFramework (INFO): Subsequent polls are legit
2025-06-10T13:51:01.778000Z TestFramework (INFO): First poll is legit for type TX
2025-06-10T13:51:01.878000Z 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_cooldown.py", line 139, in run_test
    check_poll(inv=inv, expect_response=True)
  File "/work/test/functional/abc_p2p_avalanche_cooldown.py", line 80, in check_poll
    response = poll_node.wait_for_avaresponse()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/avatools.py", line 239, in wait_for_avaresponse
    self.wait_until(lambda: len(self.avaresponses) > 0, timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 582, in wait_until
    wait_until_helper(
  File "/work/test/functional/test_framework/util.py", line 302, in wait_until_helper
    if predicate():
       ^^^^^^^^^^^
  File "/work/test/functional/test_framework/p2p.py", line 579, in test_function
    assert self.is_connected
AssertionError
2025-06-10T13:51:01.929000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_p2p_avalanche_cooldown.py", line 167, in <module>
    AvalancheCooldownTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 175, in main
    exit_code = self.shutdown()
                ^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/test_framework.py", line 404, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 659, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 537, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/coverage.py", line 46, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 146, in __call__
    response, status = self._request(
                       ^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 114, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.11/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1076, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.11/http/client.py", line 998, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe
====== Bitcoin ABC functional tests: abc_p2p_avalanche_transaction_voting.py ======

------- Stdout: -------
2025-06-10T13:48:02.970000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250610_134759_15720/abc_p2p_avalanche_transaction_voting_4
2025-06-10T13:48:06.528000Z TestFramework (INFO): Check the votes are unknown while the quorum is not established
2025-06-10T13:48:06.587000Z TestFramework (INFO): Check the votes on valid mempool transactions
2025-06-10T13:48:09.472000Z 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_transaction_voting.py", line 101, in run_test
    assert_response(
  File "/work/test/functional/test_framework/avatools.py", line 526, in assert_response
    response = poll_node.wait_for_avaresponse()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/avatools.py", line 239, in wait_for_avaresponse
    self.wait_until(lambda: len(self.avaresponses) > 0, timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 582, in wait_until
    wait_until_helper(
  File "/work/test/functional/test_framework/util.py", line 302, in wait_until_helper
    if predicate():
       ^^^^^^^^^^^
  File "/work/test/functional/test_framework/p2p.py", line 579, in test_function
    assert self.is_connected
AssertionError
2025-06-10T13:48:09.524000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_p2p_avalanche_transaction_voting.py", line 616, in <module>
    AvalancheTransactionVotingTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 175, in main
    exit_code = self.shutdown()
                ^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/test_framework.py", line 404, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 659, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 537, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/coverage.py", line 46, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 146, in __call__
    response, status = self._request(
                       ^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 114, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.11/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1076, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.11/http/client.py", line 998, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe

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

This revision is now accepted and ready to land.Jun 11 2025, 07:31