test: add coverage for immediate orphanage eviction case #31628

pull instagibbs wants to merge 1 commits into bitcoin:master from instagibbs:2025-01-immediate-orphan-evict changing 1 files +25 −0
  1. instagibbs commented at 3:36 pm on January 9, 2025: member
    Not entirely persuaded this needs coverage, but was behavior I hadn’t considered before.
  2. DrahtBot commented at 3:36 pm on January 9, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31628.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Stale ACK rkrux

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    No conflicts as of last run.

  3. DrahtBot added the label Tests on Jan 9, 2025
  4. DrahtBot added the label CI failed on Jan 11, 2025
  5. DrahtBot removed the label CI failed on Jan 13, 2025
  6. rkrux commented at 12:03 pm on January 15, 2025: none

    Seems like a very specific condition is being tested. Would it be possible to add this inside the test_max_orphan_amount test instead of creating a new one?

    Here right after the orphanage length is asserted and right before the orphanage is cleared. https://github.com/bitcoin/bitcoin/pull/31628/files#diff-f7a7f89dc6ff73d829dbf856a922767096b11fe34ffcae1a482ca1c544611981R649

  7. instagibbs commented at 1:59 pm on January 15, 2025: member
    @rkrux If you can suggest alternative code that deterministically picks the right orphan to auto-evict, I would appreciate it.
  8. rkrux commented at 2:07 pm on January 15, 2025: none
    Oh yeah I recall that a randomly chosen orphan is evicted, I see the issue with adding this portion in the test_max_orphan_amount test now.
  9. in test/functional/p2p_orphan_handling.py:598 in 6836d42819 outdated
    586@@ -587,6 +587,30 @@ def test_orphan_txid_inv(self):
    587         assert_equal(node.getmempoolentry(tx_child["txid"])["wtxid"], tx_child["wtxid"])
    588         assert_equal(len(node.getorphantxs()), 0)
    589 
    590+    @cleanup
    591+    def test_immediately_erased_orphan(self):
    592+        self.log.info("Check that we fetch parents of an orphan, even if the orphan is not persisted in orphanage")
    593+
    594+        # Causes immediate eviction from the orphanage which normally happens randomly with
    


    rkrux commented at 2:38 pm on January 15, 2025:

    normally happens randomly

    Ahh sorry, I missed the randomly part.

  10. rkrux approved
  11. rkrux commented at 2:41 pm on January 15, 2025: none

    tACK 6836d428199c0c19f7034bf6ea0855b8ec0a69d0

    build, functional tests pass. In agreement with the approach.

  12. DrahtBot added the label Needs rebase on Jan 16, 2025
  13. instagibbs force-pushed on Jan 16, 2025
  14. instagibbs commented at 8:55 pm on January 16, 2025: member

    https://github.com/bitcoin/bitcoin/actions/runs/12815476373/job/35734215113

    having a real test failure that I can’t seem to replicate, investigating

    edit: mocktime is being logged as happening before the orphan tx being received, need to sync.

    02025-01-16T19:57:07.4089701Z  node0 2025-01-16T19:17:06.119184Z [httpworker.5] [rpc/request.cpp:241] [parse] [rpc] ThreadRPCServer method=setmocktime user=__cookie__ 
    12025-01-16T19:57:07.4090684Z  node0 2025-01-16T19:17:06.140209Z (mocktime: 2025-01-16T19:18:00Z) [msghand] [txmempool.cpp:700] [check] [mempool] Checking mempool with 0 transactions and 0 inputs 
    22025-01-16T19:57:07.4092466Z  node0 2025-01-16T19:17:06.140514Z (mocktime: 2025-01-16T19:18:00Z) [msghand] [net_processing.cpp:2974] [ProcessInvalidTx] [mempoolrej] e74691cbd1b181269301baed4266a2174cd4198fcf95591048c4ad17640f9f5b (wtxid=b1326a3ec4d996c0684c69414f627666690b7350fae829586f3b3f302a662a6f) from peer=0 was not accepted: bad-txns-inputs-missingorspent 
    32025-01-16T19:57:07.4094799Z  node0 2025-01-16T19:17:06.140650Z (mocktime: 2025-01-16T19:18:00Z) [msghand] [txorphanage.cpp:47] [AddTx] [txpackages] stored orphan tx e74691cbd1b181269301baed4266a2174cd4198fcf95591048c4ad17640f9f5b (wtxid=b1326a3ec4d996c0684c69414f627666690b7350fae829586f3b3f302a662a6f), weight: 415 (mapsz 1 outsz 1) 
    42025-01-16T19:57:07.4096652Z  node0 2025-01-16T19:17:06.140755Z (mocktime: 2025-01-16T19:18:00Z) [msghand] [node/txdownloadman_impl.cpp:414] [operator()] [txpackages] added peer=0 as a candidate for resolving orphan b1326a3ec4d996c0684c69414f627666690b7350fae829586f3b3f302a662a6f 
    52025-01-16T19:57:07.4098462Z  node0 2025-01-16T19:17:06.140853Z (mocktime: 2025-01-16T19:18:00Z) [msghand] [txorphanage.cpp:93] [EraseTx] [txpackages]    removed orphan tx e74691cbd1b181269301baed4266a2174cd4198fcf95591048c4ad17640f9f5b (wtxid=b1326a3ec4d996c0684c69414f627666690b7350fae829586f3b3f302a662a6f) after 0s 
    62025-01-16T19:57:07.4099909Z  node0 2025-01-16T19:17:06.140924Z (mocktime: 2025-01-16T19:18:00Z) [msghand] [txorphanage.cpp:152] [LimitOrphans] [txpackages] orphanage overflow, removed 1 tx 
    72025-01-16T19:57:07.4100971Z  node0 2025-01-16T19:17:49.758568Z (mocktime: 2025-01-16T19:18:00Z) [scheduler] [net.cpp:2404] [StartExtraBlockRelayPeers] [net] enabling extra block-relay-only peers 
    82025-01-16T19:57:07.4101985Z  node0 2025-01-16T19:32:04.757492Z (mocktime: 2025-01-16T19:18:00Z) [scheduler] [net.cpp:2367] [DumpAddresses] [net] Flushed 0 addresses to peers.dat  1ms 
    92025-01-16T19:57:07.4102951Z  node0 2025-01-16T19:47:04.759071Z (mocktime: 2025-01-16T19:18:00Z) [scheduler] [net.cpp:2367] [DumpAddresses] [net] Flushed 0 addresses to peers.dat  1ms 
    
  15. DrahtBot removed the label Needs rebase on Jan 17, 2025
  16. instagibbs force-pushed on Jan 17, 2025
  17. instagibbs force-pushed on Jan 17, 2025
  18. instagibbs commented at 2:51 pm on January 17, 2025: member
    pushed what I think the fix is: make sure we sync the node with a ping/pong before bumping the mocktime.
  19. test: add coverage for immediate orphanage eviction case cbf131c49d
  20. instagibbs force-pushed on Jan 17, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-01-21 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me