zcashd/qa/rpc-tests
Homu fd462fd8c4 Auto merge of #5269 - str4d:zip-239-prep-2, r=str4d
ZIP 239 preparations 2

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#6722
  - Only the ancillary commits, not the mempool limiting commits (we have our own).
- bitcoin/bitcoin#6898
  - Only the first three commits (we'll cherry-pick the main content later).
- bitcoin/bitcoin#7840
2021-08-13 01:13:18 +00:00
..
golden Update golden test for heartwood network upgrade. 2020-05-07 19:12:24 -06:00
test_framework test: Cleanups to ZIP 221 Python test code 2021-06-20 21:25:59 +01:00
.gitignore Python-based regression tests 2014-02-28 15:24:31 -05:00
README.md [qa] Split README.md to /qa and /qa/rpc-tests 2020-11-21 02:33:27 +00:00
addressindex.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
bip65-cltv-p2p.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
bipdersig-p2p.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
blockchain.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
coinbase_funding_streams.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
create_cache.py Update links 2020-12-13 11:24:44 +02:00
decodescript.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
disablewallet.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
feature_logging.py Update links 2020-12-13 11:24:44 +02:00
feature_walletfile.py Update links 2020-12-13 11:24:44 +02:00
feature_zip221.py test: Cleanups to ZIP 221 Python test code 2021-06-20 21:25:59 +01:00
feature_zip244_blockcommitments.py test: Check hashBlockCommitments before, at, and after NU5 activation 2021-06-18 01:05:04 +01:00
finalsaplingroot.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
forknotify.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
framework.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
fundrawtransaction.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
getblocktemplate.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
getblocktemplate_longpoll.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
getblocktemplate_proposals.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
getchaintips.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
getrawtransaction_insight.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
hardforkdetection.py python: Explicitly set encoding to utf8 when opening text files 2020-11-09 23:06:21 +00:00
httpbasics.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
invalidateblock.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
invalidblockrequest.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
key_import_export.py test: Adjust some Zcash RPC tests to work with parallel runner 2020-11-21 03:03:58 +00:00
keypool.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
listtransactions.py [wallet] Remove wallet account RPCs 2021-08-12 08:07:12 -06:00
maxblocksinflight.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
maxuploadtarget.py Update the maxuploadtarget.py tests to accommodate zcash. 2021-02-17 17:00:18 -07:00
mempool_limit.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
mempool_nu_activation.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
mempool_reorg.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
mempool_resurrect_test.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
mempool_spendcoinbase.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
mempool_tx_expiry.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
mergetoaddress_helper.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
mergetoaddress_mixednotes.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mergetoaddress_sapling.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mergetoaddress_sprout.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
merkle_blocks.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
mining_shielded_coinbase.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
multi_rpc.py Update links 2020-12-13 11:24:44 +02:00
nodehandling.py [QA] fix netbase tests because of new CSubNet::ToString() output 2021-02-16 18:02:25 +00:00
p2p-acceptblock.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
p2p-fullblocktest.py Update links 2020-12-13 11:24:44 +02:00
p2p_node_bloom.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
p2p_nu_peer_management.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
p2p_txexpiringsoon.py test: Fix race condition in p2p_txexpiringsoon 2021-08-09 17:43:48 +01:00
p2p_txexpiry_dos.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
paymentdisclosure.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
post_heartwood_rollback.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
prioritisetransaction.py qa: Bump `sync_mempool` timeout for `prioritisetransaction.py` 2021-08-13 02:12:35 +01:00
proxy_test.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
pruning.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
rawtransactions.py Include transaction hex in verbose getblock output 2020-12-03 14:18:17 -10:00
receivedby.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
regtest_signrawtransaction.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
reindex.py Report reindexing progress in GUI 2021-08-09 20:58:49 +01:00
remove_sprout_shielding.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
reorg_limit.py test: Adjust some Zcash RPC tests to work with parallel runner 2020-11-21 03:03:58 +00:00
rest.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
rewind_index.py Tests: add timeout to sync_blocks() and sync_mempools() 2020-11-21 02:34:47 +00:00
rpcbind_test.py [qa] Remove unused code 2020-11-21 03:02:41 +00:00
sapling_rewind_check.py test: Adjust some Zcash RPC tests to work with parallel runner 2020-11-21 03:03:58 +00:00
shorter_block_times.py test: Wait for transaction propagation in shorter_block_times RPC test 2021-08-05 20:54:47 +01:00
signrawtransaction_offline.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
signrawtransactions.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
smartfees.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
spentindex.py Update to py3 conventions, update filter to return list 2020-02-09 08:14:21 -08:00
sprout_sapling_migration.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
timestampindex.py update to py3 conventions, update range to return list for py3 2020-02-09 08:14:21 -08:00
turnstile.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
tx_expiry_helper.py test: Fix race condition in p2p_txexpiringsoon 2021-08-09 17:43:48 +01:00
txn_doublespend.py [wallet] Remove wallet account RPCs 2021-08-12 08:07:12 -06:00
upgrade_golden.py Rename golden/nu4.tar.gz to canopy.tar.gz. 2020-05-29 01:30:30 +01:00
wallet.py split wallet.py tests 2020-12-29 14:42:46 -03:00
wallet_1941.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_addresses.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
wallet_anchorfork.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_broadcast.py Fix pyflakes complaints 2021-01-14 07:34:40 -07:00
wallet_changeaddresses.py Update links 2020-12-13 11:24:44 +02:00
wallet_changeindicator.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
wallet_db_flush.py fix pyflakes CI errors 2020-07-02 14:32:48 -06:00
wallet_import_export.py python: Explicitly set encoding to utf8 when opening text files 2020-11-09 23:06:21 +00:00
wallet_listnotes.py Revert changes in #4916 that assumed arguments represent fees, when they are actually number of confirmations. 2020-12-21 16:08:58 +00:00
wallet_listreceived.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_nullifiers.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_overwintertx.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_parsing_amounts.py split wallet.py tests 2020-12-29 14:42:46 -03:00
wallet_persistence.py Store imported Sapling ExtFVKs in wallet database 2020-02-21 01:32:15 +00:00
wallet_sapling.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_sendmany_any_taddr.py wallet: Ignore coinbase UTXOs with z_sendmany ANY_TADDR 2020-09-22 17:45:09 +01:00
wallet_shieldcoinbase.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_shieldcoinbase_sapling.py fix pyflakes errors 2020-02-09 08:18:00 -08:00
wallet_shieldcoinbase_sprout.py fix pyflakes errors 2020-02-09 08:18:00 -08:00
wallet_shieldingcoinbase.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_treestate.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_z_sendmany.py split wallet.py tests 2020-12-29 14:42:46 -03:00
wallet_zero_value.py Fix pyflakes complaints 2021-01-14 07:34:40 -07:00
walletbackup.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
zapwallettxes.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
zcjoinsplit.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
zcjoinsplitdoublespend.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
zkey_import_export.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
zmq_test.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00

README.md

Regression tests

test_framework/test_framework.py

Base class for RPC regression tests.

test_framework/util.py

Generally useful functions.

test_framework/mininode.py

Basic code to support p2p connectivity to a bitcoind.

test_framework/comptool.py

Framework for comparison-tool style, p2p tests.

test_framework/script.py

Utilities for manipulating transaction scripts (originally from python-bitcoinlib)

test_framework/blockstore.py

Implements disk-backed block and tx storage.

test_framework/key.py

Wrapper around OpenSSL EC_Key (originally from python-bitcoinlib)

test_framework/bignum.py

Helpers for script.py

test_framework/blocktools.py

Helper functions for creating blocks and transactions.

P2P test design notes

Mininode

  • mininode.py contains all the definitions for objects that pass over the network (CBlock, CTransaction, etc, along with the network-level wrappers for them, msg_block, msg_tx, etc).

  • P2P tests have two threads. One thread handles all network communication with the bitcoind(s) being tested (using python's asyncore package); the other implements the test logic.

  • NodeConn is the class used to connect to a bitcoind. If you implement a callback class that derives from NodeConnCB and pass that to the NodeConn object, your code will receive the appropriate callbacks when events of interest arrive. NOTE: be sure to call self.create_callback_map() in your derived classes' __init__ function, so that the correct mappings are set up between p2p messages and your callback functions.

  • You can pass the same handler to multiple NodeConn's if you like, or pass different ones to each -- whatever makes the most sense for your test.

  • Call NetworkThread.start() after all NodeConn objects are created to start the networking thread. (Continue with the test logic in your existing thread.)

  • RPC calls are available in p2p tests.

  • Can be used to write free-form tests, where specific p2p-protocol behavior is tested. Examples: p2p-accept-block.py, maxblocksinflight.py.

Comptool

  • Testing framework for writing tests that compare the block/tx acceptance behavior of a bitcoind against 1 or more other bitcoind instances, or against known outcomes, or both.

  • Set the num_nodes variable (defined in ComparisonTestFramework) to start up 1 or more nodes. If using 1 node, then --testbinary can be used as a command line option to change the bitcoind binary used by the test. If using 2 or more nodes, then --refbinary can be optionally used to change the bitcoind that will be used on nodes 2 and up.

  • Implement a (generator) function called get_tests() which yields TestInstances. Each TestInstance consists of:

    • a list of [object, outcome, hash] entries
      • object is a CBlock, CTransaction, or CBlockHeader. CBlock's and CTransaction's are tested for acceptance. CBlockHeaders can be used so that the test runner can deliver complete headers-chains when requested from the bitcoind, to allow writing tests where blocks can be delivered out of order but still processed by headers-first bitcoind's.
      • outcome is True, False, or None. If True or False, the tip is compared with the expected tip -- either the block passed in, or the hash specified as the optional 3rd entry. If None is specified, then the test will compare all the bitcoind's being tested to see if they all agree on what the best tip is.
      • hash is the block hash of the tip to compare against. Optional to specify; if left out then the hash of the block passed in will be used as the expected tip. This allows for specifying an expected tip while testing the handling of either invalid blocks or blocks delivered out of order, which complete a longer chain.
    • sync_every_block: True/False. If False, then all blocks are inv'ed together, and the test runner waits until the node receives the last one, and tests only the last block for tip acceptance using the outcome and specified tip. If True, then each block is tested in sequence and synced (this is slower when processing many blocks).
    • sync_every_transaction: True/False. Analogous to sync_every_block, except if the outcome on the last tx is "None", then the contents of the entire mempool are compared across all bitcoind connections. If True or False, then only the last tx's acceptance is tested against the given outcome.
  • For examples of tests written in this framework, see invalidblockrequest.py and p2p-fullblocktest.py.