-
Notifications
You must be signed in to change notification settings - Fork 305
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
fees: add unit tests #4316
fees: add unit tests #4316
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.
Thanks for adding tests, requesting changes because the planner api has changed since this PR was opened so this would break CI.
let fee = planner.fee_estimate(&planner.gas_prices, &planner.fee_tier); | ||
planner.adjust_change_for_fee(fee); | ||
|
||
if planner.balance().is_zero() { |
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.
Isn't this cheating? The plan should balance once we run out of required notes if we have correctly refreshed the change notes
planner.actions = planner.plan.actions.clone(); | ||
|
||
let mut iterations = 0usize; | ||
while let Some(_required) = planner |
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 adding tests is a great idea, but my sense is that rather than replicating the logic (which has changed since this PR was opened) we should either:
- refactor the core planning logic into a pure function
- check in on Design a way to use the Rust view server with mock consensus integration tests #3913 to see if the plan is to be able to build a mock view client at some point, in which case we can use
Planner::plan
directly
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.
My intuition is that it's probably best to wait a little longer until we try to test this, we'll definitely have less turbulence in the planner in a couple weeks time or less
cc @cratelyn closing out since it's fallen out of sync with the latest round of refactors. This can be a reference for eventually integrating into the mock consensus suite. |
Describe your changes
I modified the unit tests for fees according to the updated planner logic.
Issue ticket number and link
Checklist before requesting a review
References #4155