-
Notifications
You must be signed in to change notification settings - Fork 75
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
chore(sequencer): refactor fees #1739
Conversation
.ok_or_eyre( | ||
"fees not found for `ValidatorUpdate` action, hence it is disabled", | ||
)?; | ||
get_or_init_fees::<ValidatorUpdate, _, _>( |
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.
it doesn't look like there's a point to calling get_or_init_fees
in this action or any of the ones below that are feeless, as they don't update fees_by_asset
, which is the point of this function
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 was done so that the check would fail if the transaction would fail during execution (due to a given action not having fees). I think it may be worth it to keep this logic since it is used in mempool as well as check_and_execute
and may catch a failure-bound transaction before it gets executed.
Closing in favor of #1794 |
Summary
Added trait for fee components to allow generic usage of them.
Background
Previously, there was a lot of boilerplate required when testing fee components, since we are usually testing them for each and every action. Additionally, this introduces a lot of room for human error, since it's easy to mismatch an action and its associated methods. This change aims to rely more heavily on trait methods and helper functions, so that generic types can be used to eliminate boilerplate and room for error.
Changes
FeeComponents
trait and implemented it for all fee components.FeeHandler
trait.fees::query::get_fees_for_transaction
) to use helper functions with generic inputs.Testing
Passing all tests
Related Issues
closes #1715