Page MenuHomePhabricator

[validation] package validation for test accepts
ClosedPublic

Authored by PiRK on Oct 3 2022, 16:31.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCebd491037f8c: [validation] package validation for test accepts
Summary

Only allow test accepts for now. Use the CoinsViewTemporary to keep
track of coins created by each transaction so that subsequent
transactions can spend them. Uncache all coins since we only
ever do test accepts (Note this is different from ATMP which doesn't
uncache for valid test_accepts) to minimize impact on the coins cache.

Require that the input txns have no conflicts and be ordered
topologically. This commit isn't able to detect unsorted packages.

Introduce a unit test helper to create a valid mempool transaction.
This allows us to easily create transaction chains for package validation.
We don't test_accept if submit=false because we want to be able to make transactions that wouldn't pass ATMP (i.e. a child transaction in a package would fail due to missing inputs).

Add unit tests for ProcessNewPackage.
Key functionality = a transaction with UTXOs not present in UTXO set or mempool can be fully validated instead of being considered an orphan.

Note:

  • PolicyScriptChecks does not exist and is part of PreChecks in ABC (see D8203). Thus we cannot use the two separate loops over workspaces. We do all pre-checks on the transaction and add the good transactions to the results immediately.
  • Workspace takes a second argument in ABC (D8203)

This is a backport of core#21121 [1/4] and core#20833 [2, 5, 6 & 7 / 13]
https://github.com/bitcoin/bitcoin/pull/21121/commits/9a3bbe8fc57d88919acd4eadbc96124711f17ec2
https://github.com/bitcoin/bitcoin/pull/20833/commits/897e348f5987eadd8559981a973c045c471b3ad8
https://github.com/bitcoin/bitcoin/pull/20833/commits/2ef187941db439c5b3e529f08b6ab153ff061fc5
https://github.com/bitcoin/bitcoin/pull/20833/commits/cd9a11ac96c01e200d0086b2f011f4a614f5a705
https://github.com/bitcoin/bitcoin/pull/20833/commits/363e3d916cc036488783bb4bdcfdd3665aecf711

https://github.com/bitcoin/bitcoin/pull/22084/commits/e8ecc621be6afd3252c0f8147e42c3b4918f7f46 (partial, minor documentation changes to validation.[h|cpp])

Depends on D12122

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.Oct 3 2022, 16:31
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
src/validation.cpp
738 ↗(On Diff #35391)

size_t

Fabien requested changes to this revision.Oct 4 2022, 12:32
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/validation.cpp
358 ↗(On Diff #35391)

Should be static ?

738 ↗(On Diff #35391)

definitely

801 ↗(On Diff #35391)

Why is it ok to not run the CheckInputScripts() loop like the source material ?

This revision now requires changes to proceed.Oct 4 2022, 12:32
src/validation.cpp
801 ↗(On Diff #35391)

CheckInputScripts() is already part of PreChecks in our codebase. After D5128, we require the number of sigchecks to do some other operations (virtual size, CTxMemPoolEntry).
So when we reach this point, CheckInputScripts() has already processed the transaction.

src/validation.cpp
358 ↗(On Diff #35391)

nvm

PiRK edited the summary of this revision. (Show Details)
PiRK removed a reviewer: Fabien.

rebase, fix types (uint32_t and size_t)

Tail of the build log:

rpc_users.py                              | ✓ Passed  | 5 s
rpc_whitelist.py                          | ✓ Passed  | 1 s
tool_wallet.py                            | ✓ Passed  | 4 s
tool_wallet.py --descriptors              | ✓ Passed  | 2 s
wallet_abandonconflict.py                 | ✓ Passed  | 5 s
wallet_address_types.py                   | ✓ Passed  | 13 s
wallet_address_types.py --descriptors     | ✓ Passed  | 8 s
wallet_avoidreuse.py                      | ✓ Passed  | 4 s
wallet_avoidreuse.py --descriptors        | ✓ Passed  | 5 s
wallet_backup.py                          | ✓ Passed  | 35 s
wallet_balance.py                         | ✓ Passed  | 6 s
wallet_balance.py --descriptors           | ✓ Passed  | 6 s
wallet_basic.py                           | ✓ Passed  | 19 s
wallet_coinbase_category.py               | ✓ Passed  | 1 s
wallet_create_tx.py                       | ✓ Passed  | 5 s
wallet_createwallet.py                    | ✓ Passed  | 2 s
wallet_createwallet.py --descriptors      | ✓ Passed  | 3 s
wallet_createwallet.py --usecli           | ✓ Passed  | 3 s
wallet_descriptor.py                      | ✓ Passed  | 6 s
wallet_disable.py                         | ✓ Passed  | 1 s
wallet_dump.py                            | ✓ Passed  | 5 s
wallet_encryption.py                      | ✓ Passed  | 5 s
wallet_encryption.py --descriptors        | ✓ Passed  | 5 s
wallet_groups.py                          | ✓ Passed  | 7 s
wallet_hd.py                              | ✓ Passed  | 7 s
wallet_hd.py --descriptors                | ✓ Passed  | 4 s
wallet_import_rescan.py                   | ✓ Passed  | 5 s
wallet_import_with_label.py               | ✓ Passed  | 1 s
wallet_importdescriptors.py               | ✓ Passed  | 3 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  | 2 s
wallet_keypool_topup.py --descriptors     | ✓ Passed  | 3 s
wallet_labels.py                          | ✓ Passed  | 2 s
wallet_labels.py --descriptors            | ✓ Passed  | 2 s
wallet_listreceivedby.py                  | ✓ Passed  | 5 s
wallet_listsinceblock.py                  | ✓ Passed  | 5 s
wallet_listsinceblock.py --descriptors    | ✓ Passed  | 6 s
wallet_listtransactions.py                | ✓ Passed  | 4 s
wallet_listtransactions.py --descriptors  | ✓ Passed  | 3 s
wallet_multiwallet.py                     | ✓ Passed  | 45 s
wallet_multiwallet.py --usecli            | ✓ Passed  | 10 s
wallet_reorgsrestore.py                   | ✓ Passed  | 3 s
wallet_resendwallettransactions.py        | ✓ Passed  | 13 s
wallet_send.py                            | ✓ Passed  | 7 s
wallet_startup.py                         | ✓ Passed  | 2 s
wallet_txn_clone.py                       | ✓ Passed  | 2 s
wallet_txn_clone.py --mineblock           | ✓ Passed  | 4 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  | 1253 s (accumulated) 
Runtime: 251 s

ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1
This revision is now accepted and ready to land.Oct 4 2022, 18:30