-
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
feat(sequencer): rework fee handling #1526
base: main
Are you sure you want to change the base?
Conversation
@@ -1,14 +1,9 @@ | |||
use cnidarium::StateWrite; | |||
|
|||
/// This trait is a verbatim copy of `cnidarium_component::ActionHandler`. |
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.
Deleted comment because this didn't seem like a super accurate representation of ActionHandler
anymore, but can revert if others disagree.
.wrap_err("failed to add to block fees")?; | ||
state | ||
.decrease_balance(self.bridge_address, &self.fee_asset, fee) | ||
.decrease_balance(from, &self.fee_asset, fee) |
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.
Should bridge sudo change action be deducting the fee from the signer as opposed to the bridge address?
Summary
Implemented
calculate_and_pay_fees()
for each action, required by a new trait boundFeeHandler
inActionHandler
.Background
This is meant to streamline and standardize fee handling in a way that keeps the same functionality, but makes it more difficult to introduce bugs in fee handling in the future. Offline discussion suggested changing the return type of
execute_transaction()
to be our own type as opposed toVec<Event>
, but I think this would be best done in a followup, since deposit ABCI events are also recorded viaapply()
.Changes
fee_handler
with traitFeeHandler
and structFee
.FeeHandler
toActionHandler
, and created new functioncheck_execute_and_pay_fees()
, which first callscheck_and_execute()
and then callsFeeHandler::calculate_and_pay_fees()
.check_and_execute()
tocalculate_and_pay_fees()
.Vec<Fee>
. This allows forend_block()
to still pay out all fees at the end of the block, and create fee ABCI events at that time.Testing
All previous tests passing.
Breaking Changelist
app:state_ext::storage_keys_are_unchanged
snapshotRelated Issues
closes #1369
closes #1145
closes #1382