HomePhabricator

[validation] package validation for test accepts

Description

[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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12123

Details

Provenance
glozow <gzhao408@berkeley.edu>Authored on May 10 2021, 16:30
PiRKCommitted on Oct 5 2022, 06:15
PiRKPushed on Oct 5 2022, 06:15
Reviewer
Restricted Project
Differential Revision
D12123: [validation] package validation for test accepts
Parents
rABC74054628d1a9: [policy] Define packages
Branches
Unknown
Tags
Unknown