Page MenuHomePhabricator

[avalanche] Reject transactions that conflict with a finalized one
ClosedPublic

Authored by Fabien on Aug 15 2024, 14:43.

Details

Summary

Treat these transaction separately from "regular" conflicting transactions, because they are plain invalid and don't need to be stored in the conflict pool.

After this diff we have 2 kind of conflicting txs:

  • conflicting with a non finalized transaction: at this stage the node has no idea which transaction is legit and it needs to be reconciled via avalanche (in a later diff)
  • conflicting with a finalized transaction: at this stage the node knows that this transaction is not the selected one and it should be treated as invalid.

The avalanche reconsiderable status could be later used to vote on transactions for other reason, e.g. for transactions that spend a proof coin.

Depends on D16649.

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

Diff Detail

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

Event Timeline

Fabien requested review of this revision.Aug 15 2024, 14:43
bytesofman added inline comments.
src/consensus/validation.h
49 ↗(On Diff #49232)

what else could this include in addition to txs conflicting with another mempool tx?

src/consensus/validation.h
49 ↗(On Diff #49232)

For now nothing else but we can imagine fees for example, or deployment of some new features with no consensus change (not planning to do so but imagine enforcing schnorr signatures only for example)

src/consensus/validation.h
49 ↗(On Diff #49232)

Oh and also reject the txs that spend coins from an avalanche proof

src/consensus/validation.h
49 ↗(On Diff #49232)

would this be the sort of thing that could be appropriate to include in comments?

seems like there is no way for a developer without your individual insight here to know what this bucket would be, at least not without consulting this diff

roqqit added inline comments.
src/consensus/validation.h
49 ↗(On Diff #49232)

I think the right way to do this is document these examples in the summary so they will appear as part of the commit. No need to include speculative features in code/comments.

Relatedly, the distinction in the summary between "regular" conflicts, plain invalid, and policy failures (maybe reconsiderable?) is not clear. It would help to describe the interplay between TX_CONFLICT and TX_AVALANCHE_RECONSIDERABLE

Fix a typo and update the summary to better explain the rationale

Failed tests logs:

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

------- Stdout: -------
2024-08-16T08:57:17.457000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20240816_085517/abc_p2p_avalanche_transaction_voting_15
2024-08-16T08:57:19.262000Z TestFramework (INFO): Check the votes are unknown while the quorum is not established
2024-08-16T08:57:19.316000Z TestFramework (INFO): Check the votes on valid mempool transactions
2024-08-16T08:57:21.559000Z TestFramework (INFO): Check the votes on recently mined transactions
2024-08-16T08:57:22.242000Z TestFramework (INFO): Check the votes on unknown transactions
2024-08-16T08:57:22.296000Z TestFramework (INFO): Check the votes on invalid transactions
2024-08-16T08:57:22.401000Z TestFramework (INFO): Check the votes on orphan transactions
2024-08-16T08:57:22.507000Z TestFramework (INFO): Check the votes on conflicting transactions
2024-08-16T08:57:22.667000Z TestFramework (INFO): Check the node polls for transactions added to the mempool
2024-08-16T08:57:29.095000Z TestFramework (INFO): Check the node rejects txs that conflict with a finalized tx
2024-08-16T08:57:29.148000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_transaction_voting.py", line 224, in run_test
    node.gettransactionpool(another_conflicting_tx["txid"])["pool"], "none"
  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 180, in __call__
    raise JSONRPCException(response["error"], status)
test_framework.authproxy.JSONRPCException: Method not found (-32601)
2024-08-16T08:57:29.199000Z TestFramework (INFO): Stopping nodes
2024-08-16T08:57:29.500000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20240816_085517/abc_p2p_avalanche_transaction_voting_15
2024-08-16T08:57:29.500000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20240816_085517/abc_p2p_avalanche_transaction_voting_15/test_framework.log
2024-08-16T08:57:29.501000Z TestFramework (ERROR): 
2024-08-16T08:57:29.501000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20240816_085517/abc_p2p_avalanche_transaction_voting_15' to consolidate all logs
2024-08-16T08:57:29.501000Z TestFramework (ERROR): 
2024-08-16T08:57:29.501000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2024-08-16T08:57:29.501000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2024-08-16T08:57:29.501000Z TestFramework (ERROR):

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

Failed tests logs:

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

------- Stdout: -------
2024-08-16T09:02:57.222000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20240816_090159/abc_p2p_avalanche_transaction_voting_15
2024-08-16T09:02:57.884000Z TestFramework (INFO): Check the votes are unknown while the quorum is not established
2024-08-16T09:02:57.938000Z TestFramework (INFO): Check the votes on valid mempool transactions
2024-08-16T09:02:59.975000Z TestFramework (INFO): Check the votes on recently mined transactions
2024-08-16T09:03:00.604000Z TestFramework (INFO): Check the votes on unknown transactions
2024-08-16T09:03:00.658000Z TestFramework (INFO): Check the votes on invalid transactions
2024-08-16T09:03:00.763000Z TestFramework (INFO): Check the votes on orphan transactions
2024-08-16T09:03:00.869000Z TestFramework (INFO): Check the votes on conflicting transactions
2024-08-16T09:03:01.026000Z TestFramework (INFO): Check the node polls for transactions added to the mempool
2024-08-16T09:03:07.103000Z TestFramework (INFO): Check the node rejects txs that conflict with a finalized tx
2024-08-16T09:03:07.155000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_transaction_voting.py", line 224, in run_test
    node.gettransactionpool(another_conflicting_tx["txid"])["pool"], "none"
  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 180, in __call__
    raise JSONRPCException(response["error"], status)
test_framework.authproxy.JSONRPCException: Method not found (-32601)
2024-08-16T09:03:07.206000Z TestFramework (INFO): Stopping nodes
2024-08-16T09:03:07.357000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20240816_090159/abc_p2p_avalanche_transaction_voting_15
2024-08-16T09:03:07.357000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20240816_090159/abc_p2p_avalanche_transaction_voting_15/test_framework.log
2024-08-16T09:03:07.357000Z TestFramework (ERROR): 
2024-08-16T09:03:07.357000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20240816_090159/abc_p2p_avalanche_transaction_voting_15' to consolidate all logs
2024-08-16T09:03:07.357000Z TestFramework (ERROR): 
2024-08-16T09:03:07.357000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2024-08-16T09:03:07.357000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2024-08-16T09:03:07.357000Z TestFramework (ERROR):

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

Failed tests logs:

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

------- Stdout: -------
2024-08-16T08:58:45.405000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_🏃_20240816_085723/abc_p2p_avalanche_transaction_voting_15
2024-08-16T08:58:46.693000Z TestFramework (INFO): Check the votes are unknown while the quorum is not established
2024-08-16T08:58:46.747000Z TestFramework (INFO): Check the votes on valid mempool transactions
2024-08-16T08:58:48.842000Z TestFramework (INFO): Check the votes on recently mined transactions
2024-08-16T08:58:49.585000Z TestFramework (INFO): Check the votes on unknown transactions
2024-08-16T08:58:49.641000Z TestFramework (INFO): Check the votes on invalid transactions
2024-08-16T08:58:49.747000Z TestFramework (INFO): Check the votes on orphan transactions
2024-08-16T08:58:49.857000Z TestFramework (INFO): Check the votes on conflicting transactions
2024-08-16T08:58:50.022000Z TestFramework (INFO): Check the node polls for transactions added to the mempool
2024-08-16T08:58:56.852000Z TestFramework (INFO): Check the node rejects txs that conflict with a finalized tx
2024-08-16T08:58:56.904000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_transaction_voting.py", line 224, in run_test
    node.gettransactionpool(another_conflicting_tx["txid"])["pool"], "none"
  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 180, in __call__
    raise JSONRPCException(response["error"], status)
test_framework.authproxy.JSONRPCException: Method not found (-32601)
2024-08-16T08:58:56.955000Z TestFramework (INFO): Stopping nodes
2024-08-16T08:58:57.306000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_🏃_20240816_085723/abc_p2p_avalanche_transaction_voting_15
2024-08-16T08:58:57.306000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_🏃_20240816_085723/abc_p2p_avalanche_transaction_voting_15/test_framework.log
2024-08-16T08:58:57.307000Z TestFramework (ERROR): 
2024-08-16T08:58:57.307000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_🏃_20240816_085723/abc_p2p_avalanche_transaction_voting_15' to consolidate all logs
2024-08-16T08:58:57.307000Z TestFramework (ERROR): 
2024-08-16T08:58:57.307000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2024-08-16T08:58:57.307000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2024-08-16T08:58:57.307000Z TestFramework (ERROR):
====== Bitcoin ABC functional tests with the next upgrade activated: abc_p2p_avalanche_transaction_voting.py ======

------- Stdout: -------
2024-08-16T09:03:27.130000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_🏃_20240816_090212/abc_p2p_avalanche_transaction_voting_15
2024-08-16T09:03:27.793000Z TestFramework (INFO): Check the votes are unknown while the quorum is not established
2024-08-16T09:03:27.848000Z TestFramework (INFO): Check the votes on valid mempool transactions
2024-08-16T09:03:29.978000Z TestFramework (INFO): Check the votes on recently mined transactions
2024-08-16T09:03:30.616000Z TestFramework (INFO): Check the votes on unknown transactions
2024-08-16T09:03:30.671000Z TestFramework (INFO): Check the votes on invalid transactions
2024-08-16T09:03:30.776000Z TestFramework (INFO): Check the votes on orphan transactions
2024-08-16T09:03:30.881000Z TestFramework (INFO): Check the votes on conflicting transactions
2024-08-16T09:03:31.038000Z TestFramework (INFO): Check the node polls for transactions added to the mempool
2024-08-16T09:03:37.124000Z TestFramework (INFO): Check the node rejects txs that conflict with a finalized tx
2024-08-16T09:03:37.176000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_transaction_voting.py", line 224, in run_test
    node.gettransactionpool(another_conflicting_tx["txid"])["pool"], "none"
  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 180, in __call__
    raise JSONRPCException(response["error"], status)
test_framework.authproxy.JSONRPCException: Method not found (-32601)
2024-08-16T09:03:37.227000Z TestFramework (INFO): Stopping nodes
2024-08-16T09:03:37.379000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_🏃_20240816_090212/abc_p2p_avalanche_transaction_voting_15
2024-08-16T09:03:37.379000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_🏃_20240816_090212/abc_p2p_avalanche_transaction_voting_15/test_framework.log
2024-08-16T09:03:37.379000Z TestFramework (ERROR): 
2024-08-16T09:03:37.379000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_🏃_20240816_090212/abc_p2p_avalanche_transaction_voting_15' to consolidate all logs
2024-08-16T09:03:37.379000Z TestFramework (ERROR): 
2024-08-16T09:03:37.379000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2024-08-16T09:03:37.379000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2024-08-16T09:03:37.379000Z TestFramework (ERROR):

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

Rebase and rename gettransactionpool -> gettransactionstatus

PiRK added a subscriber: PiRK.

Looks good.
As discussed above, there is some ambiguity about TX_AVALANCHE_RECONSIDERABLE currently only being used for non-finalized conflicting txs (tx added to the TxConflicting pool). The pool will need to be renamed if/when we start adding other type of transactions to it, but that can be done if/when needed.

This revision is now accepted and ready to land.Aug 19 2024, 07:33