Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix estimateMinFeeTx w/ bootstrap test #4214

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

Lucsanszky
Copy link
Contributor

@Lucsanszky Lucsanszky commented Mar 22, 2024

The property that we were asserting was wrong as the overestimations were not scaled by the linear factor of the fee, so we were basically adding the overestimated size, rather than the overestimated fee, to the fee and this was problematic in case the linear factor (ppMinFeeA) was zero.

Resolves #4124

Description

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@Lucsanszky Lucsanszky force-pushed the lucsanszky/fix-estimateminfeetx-underestimation branch 3 times, most recently from 72b2981 to 8eb1a92 Compare March 25, 2024 01:42
@Lucsanszky Lucsanszky marked this pull request as ready for review March 25, 2024 01:51
@lehins lehins force-pushed the lucsanszky/fix-estimateminfeetx-underestimation branch from 8eb1a92 to ffa1edf Compare April 1, 2024 19:39
Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find.
Thank you for fixing the test and making it more readable.

@lehins lehins enabled auto-merge April 1, 2024 19:44
@lehins lehins disabled auto-merge April 1, 2024 20:19
In the test, the overestimations were not scaled by the linear factor
`a` of the fee (formula for min fee calculation: `a * txSize tx + b`).
Only the overestimated transaction size was calculated
and it was added to the fee without scaling. This caused the tests to
fail when the linear factor was zero.
@lehins lehins enabled auto-merge April 1, 2024 23:19
@lehins lehins force-pushed the lucsanszky/fix-estimateminfeetx-underestimation branch from ffa1edf to 26c0d04 Compare April 1, 2024 23:19
@lehins lehins merged commit 97963a4 into master Apr 2, 2024
15 checks passed
@lehins lehins deleted the lucsanszky/fix-estimateminfeetx-underestimation branch April 2, 2024 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

estimateMinFeeTx function sometimes underestimates
2 participants