Commit Graph
100 Commits
Author SHA1 Message Date
Greg Sanders 9b43428c96 TxGraph: change m_excluded_clusters
Change BlockBuilderImpl's m_excluded_clusters to unordered
set since ordering is not used.

Change the set to a set of sequence numbers for a modest
stability increase under fuzz testing.
2025-10-14 12:44:57 -04:00
Greg Sanders 06df14ba75 test: add more TRUC reorg coverge 2025-09-29 16:25:54 -04:00
Greg Sanders 26e71c237d Mempool: Do not enforce TRUC checks on reorg
Not enforcing TRUC topology on reorg was the intended
behavior, but the appropriate bypass argument was not
checked.

This mistake means we could potentially invalidate a long
chain of perfectly incentive-compatible transactions that
were made historically, including subsequent non-TRUC
transactions, all of which may have been very high feerate.

Lastly, it wastes CPU cycles doing topology checks since
this behavior cannot actually enforce the topology in
general for the reorg setting.
2025-09-29 16:25:54 -04:00
Greg Sanders bbe8e9063c fuzz: don't bypass_limits for most mempool harnesses
Using bypass_limits=true is essentially fuzzing part of a
reorg only, and results in TRUC invariants unable to be
checked. Remove most instances of bypassing limits, leaving
one harness able to do so.
2025-09-29 16:25:54 -04:00
Greg Sanders 12f48d5ed3 test: add chained 1p1c propagation test 2025-07-24 09:44:49 -04:00
Greg Sanders eabcd0eb6f txgraph: remove unnecessary m_group_oversized (simplification) 2025-07-02 14:52:54 -04:00
Greg Sanders f0524cda39 functional test: correctly detect nonstd TRUC tx vsize in feature_taproot 2025-07-02 11:23:53 -04:00
Greg Sanders 4be81e9746 feature_taproot: sample tx version border values more
Currently if the version 3 is selected for an otherwise
standard spender, the test will fail. It's unlikely but
possible, so change the test to update expectations and
sample more aggressively on border values to instigate
failures much quicker in the future if another version is
made standard.
2025-06-30 17:02:58 -04:00
Greg Sanders 28299ce776 p2p: remove vestigial READ_STATUS_CHECKBLOCK_FAILED 2025-06-10 10:07:56 -04:00
Greg Sanders bac9ee4830 p2p: Add witness mutation check inside FillBlock
Since #29412, we have not allowed mutated blocks to continue
being processed immediately the block is received, but this
is only done for the legacy BLOCK message.

Extend these checks as belt-and-suspenders to not allow
similar mutation strategies to affect relay by honest peers
by applying the check inside
PartiallyDownloadedBlock::FillBlock, immediately before
returning READ_STATUS_OK.

This also removes the extraneous CheckBlock call.
2025-06-10 10:07:56 -04:00
Greg Sanders a189d63618 add release note for datacarriersize default change 2025-05-30 10:14:18 -04:00
Greg Sanders 0b4048c733 datacarrier: deprecate startup arguments for future removal 2025-05-30 10:14:18 -04:00
Greg Sanders 63091b79e7 test: remove unnecessary -datacarriersize args from tests 2025-05-30 10:14:18 -04:00
Greg SandersandAnthony Towns 9f36962b07 policy: uncap datacarrier by default
Datacarrier output script sizes and output counts are now
uncapped by default.

To avoid introducing another startup argument, we modify the
OP_RETURN accounting to "budget" the spk sizes.

If a user has set a custom default, this results in that
budget being spent over the sum of all OP_RETURN outputs'
scripts in the transaction, no longer capping the number
of OP_RETURN outputs themselves. This should allow a
superset of current behavior while respecting the passed
argument in terms of total arbitrary data storage.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
2025-05-30 10:12:38 -04:00
Greg Sanders 84aa484d45 test: fix transaction_graph_test reorg test
The current test directly uses invalidatblock to trigger
mempool re-entry of transactions. Unfortunately, the
behavior doesn't match what a real reorg would look like. As
a result you get surprising behavior such as the mempool
descendant chain limits being exceeded, or if a fork is
greater than 10 blocks deep, evicted block transactions stop
being submitted back into in the mempool.

Fix this by preparing an empty fork chain, and then
continuing with the logic, finally submitting the fork chain
once the rest of the test is prepared. This triggers a more
typical codepath.

Also, extend the descendant limit to 100, like ancestor
limit.
2025-05-27 17:08:15 -04:00
Greg Sanders eaf44f3767 test: check chainlimits respects on reorg 2025-05-27 17:02:42 -04:00
Greg Sanders 47894367b5 functional test: add MAX_DISCONNECTED_TX_POOL_BYTES coverage 2025-05-27 17:02:02 -04:00
Greg Sanders 8fcd684505 test: ensure reason is checked for invalid blocks rejection 2025-05-22 10:43:44 -04:00
Greg Sanders 1a689a2c88 test: fix block tests of invalid_txs 2025-05-22 10:30:13 -04:00
Greg Sanders f66b14d2ec test: fix pushdata scripts
The original scripts were done incorrectly,
so they are changed to represent two
different 2-byte pushes.
2025-05-20 10:39:39 -04:00
Greg Sanders b1ea542ae6 test: test MAX_SCRIPT_SIZE for block validity 2025-04-21 09:39:05 -04:00
Greg Sanders a40bd374aa Get*Union: disallow nulltpr Refs 2025-03-31 13:07:37 -04:00
Greg Sanders 57433502e6 CountDistinctClusters: nullptrs disallowed 2025-03-31 13:07:37 -04:00
Greg Sanders 8bca0d325a TxGraphImpl::Compact: m_main_clusterset.m_removed is always empty 2025-03-31 13:07:14 -04:00
Greg Sanders 2c5cf987e9 TxGraphImpl::PullIn: only allowed when staging exists 2025-03-31 13:07:10 -04:00
Greg Sanders f974359e21 test: Add encodable PUSHDATA1 examples to feature_taproot 2025-03-31 08:19:10 -04:00
Greg Sanders 8400b742fa fuzz: add basic TxOrphanage::EraseForBlock cov 2025-02-20 14:00:21 -05:00
Greg Sanders 2706c5b7c8 test: test_inv_block, use mocktime instead of waiting 2025-02-06 11:36:40 -05:00
Greg Sanders 846a138728 func test: Expand tx download preference tests
1. Check that outbound nodes are treated
the same as whitelisted connections for
the purposes of getdata delays

2. Add test case that demonstrates
download retries are preferentially
given to outbound (preferred) connections
even when multiple announcements are
considered ready.
2024-12-09 10:25:03 -05:00
Greg Sanders 0f84cdd266 func: test orphan parent is re-requested from 2nd peer 2024-12-03 11:12:49 -05:00
Greg Sanders bb53ce9bda tests: Add functional test for submitting a previously pruned block
This tests the new submitblock behaviour that is introduced in the
previous commit: Submitting a previously pruned block should persist the
block's data again.
2024-11-21 22:18:35 +01:00
Greg Sanders 466e4df3fb assert_mempool_contents: assert not duplicates expected 2024-11-20 13:49:41 -05:00
Greg Sanders ea5db2f269 functional: only generate required blocks for test 2024-11-20 13:49:41 -05:00
Greg Sanders d033acb608 fuzz: package_eval: let fuzzer run out input in main tx creation loop 2024-11-20 13:49:41 -05:00
Greg Sanders ba35a570c5 CheckEphemeralSpends: return boolean, and set child state and txid outparams 2024-11-20 13:49:41 -05:00
Greg Sanders cf0cee1617 func: add note about lack of 1P1C propagation in tree submitpackage 2024-11-20 13:49:41 -05:00
Greg Sanders 8424290304 unit test: ephemeral_tests is using a dust relay rate, not minrelay 2024-11-20 13:49:41 -05:00
Greg Sanders d9cfa5fc4e CheckEphemeralSpends: no need to iterate inputs if no parent dust 2024-11-20 13:49:41 -05:00
Greg Sanders 87b26e3dc0 func: rename test_free_relay to test_no_minrelay_fee 2024-11-20 13:49:41 -05:00
Greg Sanders e5709a4a41 func: slight elaboration on submitpackage restriction 2024-11-20 13:49:41 -05:00
Greg Sanders 08e969bd10 RPC: only enforce dust rules on priority when standardness active 2024-11-20 13:49:41 -05:00
Greg Sanders ca050d12e7 unit test: adapt to changing MAX_DUST_OUTPUTS_PER_TX 2024-11-20 13:49:41 -05:00
Greg Sanders 7c3490169c fuzz: package_eval: move last_tx inside txn ctor 2024-11-20 13:49:41 -05:00
Greg Sanders 445eaed182 fuzz: use optional status instead of should_rbf_eph_spend 2024-11-20 13:49:41 -05:00
Greg Sanders 4dfdf615b9 fuzz: remove unused TransactionsDelta validation interface 2024-11-20 13:44:49 -05:00
Greg Sanders 09ce926e4a func: cleanup reorg test comment 2024-11-20 13:44:49 -05:00
Greg Sanders 768a0c1889 func: cleanup test_dustrelay comments 2024-11-20 13:44:49 -05:00
Greg Sanders bedca1cb66 fuzz: Directly place transactions in vector 2024-11-20 13:44:49 -05:00
Greg Sanders c041ad6ecc fuzz: explain package eval coin tracking better 2024-11-20 13:44:49 -05:00
Greg Sanders bc0d98ea61 fuzz: remove dangling reference to GetEntry 2024-11-20 13:44:49 -05:00
Greg Sanders 15b6cbf07f unit test: make dust index less magical 2024-11-20 13:44:49 -05:00
Greg Sanders 5fbcfd12b8 unit test: assert txid returned on CheckEphemeralSpends failures
Simplify nullopt checks
2024-11-20 12:49:03 -05:00
Greg Sanders ef94d84b4e bench: remove unnecessary CMTxn constructors 2024-11-20 12:49:03 -05:00
Greg Sanders c5c10fd317 ephemeral policy doxygen cleanup 2024-11-20 12:49:03 -05:00
Greg Sanders dd9044b8d4 ephemeral policy: IWYU 2024-11-20 12:49:03 -05:00
Greg Sanders c6859ce2de Move+rename GetDustIndexes -> GetDust
Use to replace HasDust and where appropraite
2024-11-20 12:48:03 -05:00
Greg Sanders 62016b3230 Use std::ranges for ephemeral policy checks 2024-11-15 09:31:59 -05:00
Greg Sanders 3ed930a1f4 Have HasDust and PreCheckValidEphemeralTx take CTransaction 2024-11-15 09:31:59 -05:00
Greg Sanders 04a614bf9a Rename CheckValidEphemeralTx to PreCheckEphemeralTx 2024-11-15 09:31:59 -05:00
Greg Sanders cbf1a47d60 CheckEphemeralSpends: only compute txid of tx when needed 2024-11-13 09:19:10 -05:00
Greg Sanders 5c2e291060 bench: Add basic CheckEphemeralSpends benchmark 2024-11-12 09:41:24 -05:00
Greg Sanders 3f6559fa58 Add release note for ephemeral dust 2024-11-12 09:41:24 -05:00
Greg Sanders 71a6ab4b33 test: unit test for CheckEphemeralSpends 2024-11-12 09:41:24 -05:00
Greg Sanders 21d28b2f36 fuzz: add ephemeral_package_eval harness
Works a bit harder to get ephemeral dust
transactions into the mempool.
2024-11-12 09:41:24 -05:00
Greg Sanders 127719f516 test: Add CheckMempoolEphemeralInvariants
Checks that transactions in mempool with dust
follow expected invariants.
2024-11-12 09:24:54 -05:00
Greg Sanders e2e30e89ba functional test: Add ephemeral dust tests 2024-11-12 09:24:54 -05:00
Greg Sanders 4e68f90139 rpc: disallow in-mempool prioritisation of dusty tx 2024-11-12 09:24:54 -05:00
Greg Sanders e1d3e81ab4 policy: Allow dust in transactions, spent in-mempool
Also known as Ephemeral Dust.

We try to ensure that dust is spent in blocks by requiring:
  - ephemeral dust tx is 0-fee
  - ephemeral dust tx only has one dust output
  - If the ephemeral dust transaction has a child,
    the dust is spent by by that child.

0-fee requirement means there is no incentive to mine
a transaction which doesn't have a child bringing its
own fees for the transaction package.
2024-11-12 09:24:54 -05:00
Greg Sanders 04b2714fbb functional test: Add new -dustrelayfee=0 test case
This test would catch regressions where ephemeral
dust checks are being erroneously applied on outputs
that are not actually dust.
2024-11-12 09:24:54 -05:00
Greg Sanders c189eec848 doc: release note for mempoolrullrbf removal 2024-10-31 13:19:31 -04:00
Greg Sanders d47297c6aa rpc: Mark fullrbf and bip125-replaceable as deprecated 2024-10-31 13:19:31 -04:00
Greg Sanders 04a5dcee8a docs: remove requirement to signal bip125
Also remove stated support of BIP125 from bips file.
2024-10-31 13:19:31 -04:00
Greg Sanders 111a23d9b3 Remove -mempoolfullrbf option 2024-10-28 11:53:20 -04:00
Greg Sanders f32c34d0c3 functional test: Additional package evaluation coverage
Current test coverage doesn't ensure that mempool trimming
doesn't appear prior to the entire package, and not just
the subpackage, is finished being submitted.

Add a scenario that covers this case, where package
ancestors can make it in individually, but would be
immadiately evicted if not for the package CPFP.
2024-10-25 09:22:57 -04:00
Greg Sanders 31378d44f4 test: Add time-timewarp-attack boundary cases 2024-08-22 12:43:13 -04:00
Greg Sanders 2a3a24296e test: check that P2A with witness data is still consensus-legal 2024-08-02 13:03:06 -04:00
Greg Sanders 68bd86cd7c test: P2A is a destination type with an address 2024-08-02 13:03:06 -04:00
Greg Sanders 75648cea5a test: add P2A ProduceSignature coverage 2024-07-30 14:06:58 -04:00
Greg Sanders 7998ce6b20 Add release note for P2A output feature 2024-07-30 14:06:58 -04:00
Greg Sanders 71c9b02a04 test: add P2A coverage for decodescript 2024-07-30 14:06:58 -04:00
Greg Sanders 1349e9ec15 test: Add anchor mempool acceptance test 2024-07-30 14:06:58 -04:00
Greg Sanders 9d89209937 policy: stop 3rd party wtxid malleability of anchor spend 2024-07-30 14:06:58 -04:00
Greg Sanders b60aaf8b23 policy: make anchor spend standard
Only standard when non-nested.
2024-07-30 14:06:58 -04:00
Greg Sanders 455fca86cf policy: Add OP_1 <0x4e73> as a standard output type
These outputs are called anchors, and allow
key-less anchor spends which are vsize-minimized
versus keyed anchors which require larger outputs
when creating and inputs when spending.
2024-07-30 14:06:58 -04:00
Greg Sanders 3f00aae140 package rbf: cpfp structure requires package > parent feerate 2024-07-09 13:18:04 -04:00
Greg Sanders ad7f1f697f test package rbf boundary conditions more closely 2024-07-09 13:18:04 -04:00
Greg Sanders 4ccb3d6d0d fuzz: have package_rbf always make small txns
The fuzz target is generating a large amount of
transactions, but the core of the logic is
ConsumeTxMemPoolEntry making the mempool
entries for adding to the mempool. Since
ConsumeTxMemPoolEntry generates its own transaction
"vsize", we can improve efficiency of the target
by explicitly creating very small transactions,
reducing the hashing and memory burden.
2024-06-18 10:19:41 -04:00
Greg Sanders ff4558d441 doc: reword package RBF documentation 2024-06-18 09:30:30 -04:00
Greg Sanders de669a883b doc: replace mention of V3 with TRUC 2024-06-17 17:26:23 -04:00
Greg Sanders 172c1ad026 test: expand LimitOrphan and EraseForPeer coverage 2024-06-17 09:56:41 -04:00
Greg Sanders 94ed4fbf8e Add release note for size 2 package rbf 2024-06-13 09:52:59 -04:00
Greg Sanders afd52d8e63 doc: update package RBF comment 2024-06-13 09:52:59 -04:00
Greg Sanders 6e3c4394cf mempool: Improve logging of replaced transactions 2024-06-13 09:52:59 -04:00
Greg Sanders d3466e4cc5 CheckPackageMempoolAcceptResult: Check package rbf invariants 2024-06-13 09:52:59 -04:00
Greg Sanders 316d7b63c9 Fuzz: pass mempool to CheckPackageMempoolAcceptResult 2024-06-13 09:52:59 -04:00
Greg Sanders 5da3967815 PackageV3Checks: Relax assumptions
Relax assumptions about in-mempool children of in-mempool
parents. With package RBF, we will allow a package of size
2 with conflicts on its parent and reconsider the parent
if its fee is insufficient on its own.

Consider:

TxA (in mempool) <- TxB (in mempool)

TxA (in mempool) <- TxB' (in package, conflicts with TxB) <-
TxC (in package)

If TxB' fails to RBF TxB due to insufficient feerate, the
package TxB' + TxC will be considered. PackageV3Checks
called on TxB' will see an in-mempool parent TxA, and
see the in-mempool child TxB. We cannot assume there is
no in-mempool sibling, rather detect it and fail normally.

Prior to package RBF, this would have failed on the first
conflict in package.
2024-06-10 13:17:04 -04:00
Greg Sanders 28dbe218fe refactor: move orphanage constants to header file 2024-06-07 10:06:29 -04:00
Greg Sanders 2fd34ba504 Add sanity checks for various ATMPArgs booleans 2024-05-23 12:08:46 -04:00
Greg Sanders 69f7ab05ba Add m_allow_sibling_eviction as separate ATMPArgs flag 2024-05-23 12:08:39 -04:00
Greg Sanders 57ee3029dd Add description for m_test_accept 2024-05-23 12:08:39 -04:00