test: feature_fee_estimation failure after duplicate coinbase tx weight reservation fix [AssertionError: Estimated fee (0.00923427) out of range] #32461

issue l0rinc openend this issue on May 9, 2025
  1. l0rinc commented at 3:04 pm on May 9, 2025: contributor

    Summary

    First encountered in https://github.com/bitcoin/bitcoin/actions/runs/14929268797/job/41941137828?pr=31144

    Doing a git bisect reveals the likely culprit is mining: bugfix: Fix duplicate coinbase tx weight reservation


    Reproducer

    git checkout 6b165f5906fc53bd10bedff85a6ef26e0aabdc5c

    0HEAD is now at 6b165f5906 Merge bitcoin/bitcoin#31384: mining: bugfix: Fix duplicate coinbase tx weight reservation
    

    cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake –build build -j$(nproc) && build/test/functional/feature_fee_estimation.py –random=3450808900320758527

     02025-05-09T14:55:06.412000Z TestFramework (INFO): User supplied random seed 3450808900320758527
     12025-05-09T14:55:06.412000Z TestFramework (INFO): PRNG seed is: 3450808900320758527
     22025-05-09T14:55:06.413000Z TestFramework (INFO): Initializing test directory /var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_wg3p8s0v
     32025-05-09T14:55:06.426000Z TestFramework (INFO): This test is time consuming, please be patient
     42025-05-09T14:55:06.426000Z TestFramework (INFO): Splitting inputs so we can generate tx's
     52025-05-09T14:55:06.988000Z TestFramework (INFO): Finished splitting
     62025-05-09T14:55:07.791000Z TestFramework (INFO): Testing estimates with single transactions.
     72025-05-09T14:55:07.791000Z TestFramework (INFO): Will output estimates for 1/2/3/6/15/25 blocks
     82025-05-09T14:55:07.791000Z TestFramework (INFO): Creating transactions and mining them with a block size that can't keep up
     92025-05-09T14:55:09.501000Z TestFramework (INFO): Creating transactions and mining them at a block size that is just big enough
    102025-05-09T14:55:11.955000Z TestFramework (INFO): Creating transactions and mining them with a block size that can't keep up
    112025-05-09T14:55:14.407000Z TestFramework (INFO): Creating transactions and mining them at a block size that is just big enough
    122025-05-09T14:55:17.271000Z TestFramework (INFO): Final estimates after emptying mempools
    132025-05-09T14:55:17.287000Z TestFramework (INFO): Test fee_estimates.dat is flushed periodically
    142025-05-09T14:55:18.131000Z TestFramework (INFO): Test fee rate estimation after restarting node with high MempoolMinFee
    152025-05-09T14:55:18.523000Z TestFramework (ERROR): Assertion failed
    16Traceback (most recent call last):
    17  File "/Users/lorinc/IdeaProjects/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
    18    self.run_test()
    19    ~~~~~~~~~~~~~^^
    20  File "/Users/lorinc/IdeaProjects/bitcoin/build/test/functional/feature_fee_estimation.py", line 458, in run_test
    21    self.test_feerate_mempoolminfee()
    22    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
    23  File "/Users/lorinc/IdeaProjects/bitcoin/build/test/functional/feature_fee_estimation.py", line 243, in test_feerate_mempoolminfee
    24    check_estimates(self.nodes[1], self.fees_per_kb)
    25    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    26  File "/Users/lorinc/IdeaProjects/bitcoin/build/test/functional/feature_fee_estimation.py", line 121, in check_estimates
    27    check_smart_estimates(node, fees_seen)
    28    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
    29  File "/Users/lorinc/IdeaProjects/bitcoin/build/test/functional/feature_fee_estimation.py", line 104, in check_smart_estimates
    30    raise AssertionError(
    31        f"Estimated fee ({feerate}) out of range ({min(fees_seen)},{max(fees_seen)})"
    32    )
    33AssertionError: Estimated fee (0.00923427) out of range (5.076142131979696e-05,0.008705986394557823)
    342025-05-09T14:55:18.578000Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
    352025-05-09T14:55:18.578000Z TestFramework (WARNING): Not cleaning up dir /var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_wg3p8s0v
    362025-05-09T14:55:18.578000Z TestFramework (ERROR): Test failed. Test logging available at /var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_wg3p8s0v/test_framework.log
    372025-05-09T14:55:18.579000Z TestFramework (ERROR):
    382025-05-09T14:55:18.579000Z TestFramework (ERROR): Hint: Call /Users/lorinc/IdeaProjects/bitcoin/test/functional/combine_logs.py '/var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_wg3p8s0v' to consolidate all logs
    392025-05-09T14:55:18.579000Z TestFramework (ERROR):
    402025-05-09T14:55:18.579000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    412025-05-09T14:55:18.579000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    422025-05-09T14:55:18.579000Z TestFramework (ERROR):
    43[node 2] Cleaning up leftover process
    44[node 1] Cleaning up leftover process
    45[node 0] Cleaning up leftover process
    

    git checkout HEAD^1

    0HEAD is now at 6a46be75c4 Merge bitcoin/bitcoin#31793: ci: Use clang-20 for sanitizer tasks
    

    cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake –build build -j$(nproc) && build/test/functional/feature_fee_estimation.py –random=3450808900320758527

     02025-05-09T14:53:52.973000Z TestFramework (INFO): User supplied random seed 3450808900320758527
     12025-05-09T14:53:52.973000Z TestFramework (INFO): PRNG seed is: 3450808900320758527
     22025-05-09T14:53:52.974000Z TestFramework (INFO): Initializing test directory /var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_1dgb1kvc
     32025-05-09T14:53:52.992000Z TestFramework (INFO): This test is time consuming, please be patient
     42025-05-09T14:53:52.992000Z TestFramework (INFO): Splitting inputs so we can generate tx's
     52025-05-09T14:53:53.560000Z TestFramework (INFO): Finished splitting
     62025-05-09T14:53:54.423000Z TestFramework (INFO): Testing estimates with single transactions.
     72025-05-09T14:53:54.423000Z TestFramework (INFO): Will output estimates for 1/2/3/6/15/25 blocks
     82025-05-09T14:53:54.423000Z TestFramework (INFO): Creating transactions and mining them with a block size that can't keep up
     92025-05-09T14:53:56.340000Z TestFramework (INFO): Creating transactions and mining them at a block size that is just big enough
    102025-05-09T14:53:58.810000Z TestFramework (INFO): Creating transactions and mining them with a block size that can't keep up
    112025-05-09T14:54:00.682000Z TestFramework (INFO): Creating transactions and mining them at a block size that is just big enough
    122025-05-09T14:54:02.972000Z TestFramework (INFO): Final estimates after emptying mempools
    132025-05-09T14:54:02.988000Z TestFramework (INFO): Test fee_estimates.dat is flushed periodically
    142025-05-09T14:54:03.839000Z TestFramework (INFO): Test fee rate estimation after restarting node with high MempoolMinFee
    152025-05-09T14:54:04.700000Z TestFramework (INFO): Test acceptstalefeeestimates option
    162025-05-09T14:54:05.129000Z TestFramework (INFO): Test reading old fee_estimates.dat
    172025-05-09T14:54:05.869000Z TestFramework (INFO): Restarting node with fresh estimation
    182025-05-09T14:54:06.413000Z TestFramework (INFO): Testing estimates with RBF.
    192025-05-09T14:54:08.411000Z TestFramework (INFO): Restarting node with fresh estimation
    202025-05-09T14:54:09.016000Z TestFramework (INFO): Test estimatesmartfee modes
    212025-05-09T14:54:27.128000Z TestFramework (INFO): Testing that fee estimation is disabled in blocksonly.
    222025-05-09T14:54:27.607000Z TestFramework (INFO): Stopping nodes
    232025-05-09T14:54:27.769000Z TestFramework (INFO): Cleaning up /var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_1dgb1kvc on exit
    242025-05-09T14:54:27.769000Z TestFramework (INFO): Tests successful
    
  2. maflcko added the label CI failed on May 9, 2025
  3. maflcko added the label TX fees and policy on May 9, 2025
  4. ismaelsadeeq commented at 6:27 pm on May 9, 2025: member

    @l0rinc Thanks for the thorough report.

    However, the failure is not in the acceptstalefeeestimates subtest, but in test_feerate_mempoolminfee.

    I believe the issue is that we are not appending high_val to self.fees_per_kb before checking the estimates.

    I attempted to fix this in #32463.


    Also, it’s quite strange that the test started failing on this commit https://github.com/bitcoin/bitcoin/commit/6b165f5906fc53bd10bedff85a6ef26e0aabdc5c

    I haven’t looked into that yet.

  5. l0rinc renamed this:
    test: `acceptstalefeeestimates` failure in `feature_fee_estimation` after duplicate coinbase tx weight reservation fix
    test: `feature_fee_estimation` failure after duplicate coinbase tx weight reservation fix
    on May 9, 2025
  6. maflcko commented at 10:53 am on May 24, 2025: member
  7. DrahtBot renamed this:
    test: `feature_fee_estimation` failure after duplicate coinbase tx weight reservation fix
    test: `feature_fee_estimation` failure after duplicate coinbase tx weight reservation fix [AssertionError: Estimated fee (0.00923427) out of range]
    on May 24, 2025
  8. ismaelsadeeq commented at 2:46 pm on May 31, 2025: member

    Also, it’s quite strange that the test started failing on this commit: https://github.com/bitcoin/bitcoin/commit/6b165f5906fc53bd10bedff85a6ef26e0aabdc5c I haven’t looked into that yet.

    I’ve debugged the issue and discovered why this seed only fails on commit 6b165f5906fc53bd10bedff85a6ef26e0aabdc5c

    This is because, prior to that commit, we reserved only 8000 WU only when using the default -blockmaxweight. When a custom value less than the default was used, we reserved only 4000 WU.

    However, after commit 6b165f5906fc53bd10bedff85a6ef26e0aabdc5c, blockmaxweight was decoupled from the reservation logic, and we now always reserve 8000 WU regardless of the configured blockmaxweight.

    This effectively reduces the number of transactions selected when building blocks in the fee estimation tests, because we use custom block weights. Reference: https://github.com/bitcoin/bitcoin/blob/4b1d48a6866b24f0ed027334c6de642fc848d083/test/functional/feature_fee_estimation.py#L148-L149

    You can reproduce the issue even on commit 6a46be75c4 by lowering the custom -blockmaxweight by using the diff below

     0diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py
     1index 974d8268a2a..fb5b8dbae62 100755
     2--- a/test/functional/feature_fee_estimation.py
     3+++ b/test/functional/feature_fee_estimation.py
     4@@ -144,8 +144,8 @@ class EstimateFeeTest(BitcoinTestFramework):
     5         self.noban_tx_relay = True
     6         self.extra_args = [
     7             [],
     8-            ["-blockmaxweight=68000"],
     9-            ["-blockmaxweight=32000"],
    10+            ["-blockmaxweight=64000"],
    11+            ["-blockmaxweight=28000"],
    12         ]
    13 
    14     def setup_network(self):
    

    This reveals the issue and also #32463 is the right fix.

  9. fanquake commented at 9:20 am on June 5, 2025: member
  10. fanquake commented at 9:20 am on June 5, 2025: member

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-06-15 18:13 UTC

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