fees: document non-monotonic estimation edge case #31080

pull willcl-ark wants to merge 1 commits into bitcoin:master from willcl-ark:doc-fee-inconsistency changing 1 files +6 −0
  1. willcl-ark commented at 8:42 pm on October 12, 2024: member

    Closes: #11800

    In scenarios where data is available for higher targets but not for lower ones, this method may return lower fee rates for higher confirmation targets. This could occur if estimateCombinedFee returns no valid data (-1) for some estimates for a low target, but does return valid data for a higher target.

    Users of this function should be aware of this potential, if unlikely, inconsistency in behaviour in data-sparse scenarios.

  2. DrahtBot commented at 8:42 pm on October 12, 2024: 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/31080.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK ismaelsadeeq
    Approach ACK adamandrews1, tdb3

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

  3. in src/policy/fees.cpp:906 in 745fe425b5 outdated
    901@@ -902,6 +902,14 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation
    902      * horizons so we already have monotonically increasing estimates and
    903      * the purpose of conservative estimates is not to let short term
    904      * fluctuations lower our estimates by too much.
    905+     *
    906+     * Note: In scenarios where data is available for higher targets but not
    


    adamandrews1 commented at 8:23 pm on October 15, 2024:
    Nit: The lead is a bit buried here. I would plainly state “Monotonically increasing estimates are not guaranteed in certain data-sparse scenarios. In particular, (fill in the rest of your comment)”

    willcl-ark commented at 10:00 pm on October 15, 2024:

    Thanks, I’m happy to take this suggestion. What do you think about:

     * Note: Monotonically increasing estimates are not guaranteed in certain
     * data-sparse scenarios. In particular, if estimateCombinedFee returns no
     * valid data (-1) for some estimates for a lower target, but does return
     * valid data for a higher target, the estimate can theoretically return a
     * higher value for higher targets.
    

    adamandrews1 commented at 10:02 pm on October 15, 2024:
    Great - LGMT

    willcl-ark commented at 8:15 am on October 16, 2024:
    OK pushed that in 372ca14
  4. adamandrews1 approved
  5. fees: document non-monotonic estimation edge case
    Closes: #11800
    
    In scenarios where data is available for higher targets but not for
    lower ones, this method *may* return lower fee rates for higher
    confirmation targets. This could occur if estimateCombinedFee returns no
    valid data (-1) for some estimates for a low target, but **does** return
    valid data for a higher target.
    372ca14fbe
  6. willcl-ark force-pushed on Oct 16, 2024
  7. adamandrews1 approved
  8. adamandrews1 commented at 7:29 pm on October 16, 2024: none
    Concept ACK Approach ACK
  9. laanwj added the label TX fees and policy on Oct 20, 2024
  10. laanwj added the label Docs on Oct 20, 2024
  11. fanquake requested review from ismaelsadeeq on Oct 21, 2024
  12. DrahtBot added the label CI failed on Oct 22, 2024
  13. in src/policy/fees.cpp:910 in 372ca14fbe
    901@@ -902,6 +902,12 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation
    902      * horizons so we already have monotonically increasing estimates and
    903      * the purpose of conservative estimates is not to let short term
    904      * fluctuations lower our estimates by too much.
    905+     *
    906+     * Note: Monotonically increasing estimates are not guaranteed in certain
    907+     * data-sparse scenarios. In particular, if estimateCombinedFee returns no
    908+     * valid data (-1) for some estimates for a lower target, but does return
    909+     * valid data for a higher target, the estimate can theoretically return a
    910+     * higher value for higher targets.
    


    ismaelsadeeq commented at 10:11 am on October 22, 2024:
    0     * Note: In certain rare edge cases, monotonically increasing estimates may not be 
    1     * guaranteed. Specifically, given two targets N and M, where M > N, if a sub-estimate
    2     * for target N fail to return a valid fee rate, while target M has valid fee rate for that
    3     * sub-estimate, target M may result in a higher fee rate 
    4     * estimate than target N.
    5     *
    6     * See: [#11800 (comment)](/bitcoin-bitcoin/11800/#issuecomment-349697807)
    

    I think the suggestion describes scenario better as stated in #11800 (comment).

    This will be even better when we specify which sub-estimate failures break the monotonic behavior of the fee rate estimates. The comments mention that we check the maximum confirmations for shorter time horizons to preserve this behavior.

    This applies to the first three sub-estimates for economical estimates and the first two for conservative estimates.

  14. ismaelsadeeq commented at 10:13 am on October 22, 2024: member
    Concept ACK
  15. DrahtBot removed the label CI failed on Oct 25, 2024
  16. tdb3 commented at 7:23 pm on November 2, 2024: contributor

    Approach ACK

    The update suggested in #31080 (review) seems to increase clarity.


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: 2024-12-21 15:12 UTC

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