test: Add functional tests for blockreconstructionextratxn and extra pool (compactblocks) - #33023
test: Add functional tests for blockreconstructionextratxn and extra pool (compactblocks)#33023bigshiny90 wants to merge 1 commit into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33023. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste LLM Linter (✨ experimental)Possible typos and grammar issues:
drahtbot_id_5_m |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
76f1896 to
3e93378
Compare
90f0f1d to
a01547c
Compare
|
updated to fix CI Lint errors (also had to remove an unused param) |
a01547c to
4985235
Compare
brunoerg
left a comment
There was a problem hiding this comment.
I think the description is not clear about what you're trying to cover/achieve with the test. Can you explain it better? Also, corecheck doesn't show any related new coverage.
Added better description (hopefully) to PR I'm not sure about corecheck, but i'll hazard a guess: There are other tests that cover the p2p_compactblocks - so these tests seem to cover the same ground, though in reality they are testing something new. (also, the fact that most of what is being tested is not publicly exposed). Just a guess, as I don’t know how corecheck determines things Hopefully answers the questions? |
4985235 to
b4f34aa
Compare
b4f34aa to
bd1c6b4
Compare
This adds comprehensive functional tests for the extra transaction pool used in compact block reconstruction, controlled by the -blockreconstructionextratxn parameter. Github-Pull: bitcoin#33023 Rebased-From: bd1c6b4ea9b94ab4b2604f2a4b8a7fd1fe55c92a
kevkevinpal
left a comment
There was a problem hiding this comment.
I get the idea of testing the extra pool. I think some of the tests can be consolidated.
I did run the test locally, and it passes for me. I haven't checked code coverage either to see if it covers anything extra,
but grep -nri "blockreconstructionextratxn" ./test/functional/ does not have any matches
There was a problem hiding this comment.
This seems misplaced for this test test_extratxn_invalid_parameters
There was a problem hiding this comment.
removed. now just tests for invalid capacity -1
There was a problem hiding this comment.
instead of 8 can you make this num_txs - count, it makes sense to not have magic numbers
There was a problem hiding this comment.
what is the point of testing with 2 when you have another test, testing with 1?
There was a problem hiding this comment.
yes, removed redundant test - test_extratxn_minimal_capacity_eviction
There was a problem hiding this comment.
If you could why not set buffersize to 400, and then after checking the capacity test the wrap around?
Then you can drop test_extratxn_large_capacity and test_extratxn_buffer_wraparound seems redundant to do the setup multiple times when they can be done in the same test.
There was a problem hiding this comment.
I combined the 3 separate tests - test_extratxnpool_capacity, test_extratxn_large_capacity, test_extratxn_buffer_wraparound - and created one test test_extratxnpool_capacity_and_wraparound, which tests capacity 400 and wraparound behavior
bd1c6b4 to
f9c6331
Compare
This adds comprehensive functional tests for the extra transaction pool used in compact block reconstruction, controlled by the -blockreconstructionextratxn parameter. Github-Pull: bitcoin#33023 Rebased-From: f9c6331cb26f3bafc3dba7f5a72622a9ff4f190d
|
Could turn into draft while CI is red? |
|
investigating why tests fail on github CI... but runs fine on a local build |
This adds comprehensive functional tests for the extra transaction pool used in compact block reconstruction, controlled by the -blockreconstructionextratxn parameter.
f9c6331 to
841b3c2
Compare
|
needed to rebase to current master and fix tests for the new lower fee-rate policy. |
|
ACK 841b3c2 Tested locally on macOS - all test cases pass. Good coverage for the extra transaction pool used in compact block reconstruction. Tests policy-rejected txs (dust, low_fee, nonstandard), pool capacity limits, FIFO eviction, and edge cases. nit: The ✓ emojis in log messages are a bit unconventional compared to other functional tests, but doesn't affect functionality |
| result = self.send_compact_block(tx_list, indices) | ||
|
|
||
| assert_equal(result["missing_indices"], []) | ||
| self.log.info("✓ All rejected transactions are available in extra pool") |
There was a problem hiding this comment.
All these info messages on completion should be removed in my opinion.
| # Check original transactions again - first one should be evicted | ||
| result2 = self.send_compact_block(rejected_txs, indices) | ||
| assert_equal(result2["missing_indices"], [0]) | ||
| self.log.info("✓ Transaction 0 was evicted as expected (wraparound)") |
There was a problem hiding this comment.
All these info messages on test completion should be removed imo.
|
Are you still working on this? There are unaddressed review comments. |
|
Closing for now. Let us know if you're coming back to this. |
This tests the -blockreconstructionextratxn parameter and extra pool memory (ring buffer) behavior used specifically for compact block reconstruction. The "extra transaction pool" stores transactions that were rejected from the mempool for policy reasons (dust, low fees, non-standard scripts), txs replaced via rbf, etc…
There is no test coverage for this. (no unit tests either as the code being tested - in PeerManagerImpl - isn't publicly accessible in the net_processing.h file)
The code being tested is in src/net_processing.cpp - look for vExtraTxnForCompact, AddToCompactExtraTransactions and -blockreconstructionextratxn start arg.
This tests
Policy-rejected transactions are stored in the extra pool: Transactions rejected for being dust, having low fees, or using non-standard scripts are kept in the extra pool
Pool capacity limits work correctly: Tests various pool sizes. Default is 100.
Eviction behavior: When the extra pool is full, the oldest transactions are evicted (FIFO)
Wraparound behavior: The extra pool correctly wraps around when adding new transactions
Compact block reconstruction: These extra transactions are actually used during block reconstruction
Uses policy rejected transactions to populate the extra pool for tests.
(Updated 08/29/25: rebased to currrent master and fixed tests to accommodate new low-fee rate policy)