-
Notifications
You must be signed in to change notification settings - Fork 679
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
feat: Improved Fee Rate Computation #2972
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly LGTM. Just had two comments about the fee math corner cases that must be addressed before merging. Thanks @gregorycoppola!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a few minor comments left!
}) | ||
.expect("SQLite failure"); | ||
|
||
for result in results { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should verify that you only iterate window_size
times (or that results has length window_size
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it doesn't? panic
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems drastic to panic? maybe only iterate window_size times and print a warn if results is longer than expected. thoughts @kantai ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be an appropriate panic/assert, assert!(results.len() <= window_size)
, because the SQL statement has a LIMIT
, there's nothing short of a bug in sqlite or a misunderstanding in our code that should cause that assertion to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just forget about this assert as:
-
we have a limit anyway, so we probably don't need to worry
-
this structure doesn't have a
len
:
error[E0599]: no method named `len` found for struct `AndThenRows` in the current scope
--> src/cost_estimates/fee_medians.rs:130:25
|
130 | assert!(results.len() <= window_size);
| ^^^ method not found in `AndThenRows<'_, [closure@src/cost_estimates/fee_medians.rs:122:69: 127:14]>`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replying to @pavitthrap
}) | ||
.expect("SQLite failure"); | ||
|
||
for result in results { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it doesn't? panic
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
responded to comments
}) | ||
.expect("SQLite failure"); | ||
|
||
for result in results { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems drastic to panic? maybe only iterate window_size times and print a warn if results is longer than expected. thoughts @kantai ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two unresolved points.
src/cost_estimates/fee_medians.rs
Outdated
MINIMUM_TX_FEE_RATE | ||
}; | ||
let fee_rate = fee as f64 / denominator; | ||
if fee_rate >= MINIMUM_TX_FEE_RATE && fee_rate.is_finite() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose to panic if the fee_rate is infite, because I think it should never be, unless the user had paid an infinte amount. does that sound ok @kantai
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm - thanks for addressing my feedback!
Thanks for many rounds of reviews, everyone. There was a broken that seemed flaky so re-running. |
@kantai sorry about the no-op commits. Next time I'll do it the right way but was just tired of this PR and took a short cut. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #2954
#2954 (comment) discusses four proposals for improving fee estimation.
We address these here:
Testing
neon_integrations.rs
that tests that we can load this new estimator, and use it.