-
Notifications
You must be signed in to change notification settings - Fork 383
Author priority fees fix #1528
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
Merged
Merged
Author priority fees fix #1528
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1ba89f5
Author priority fees fix
tgmichel 08028b4
editorconfig
tgmichel 4d42b6b
Merge branch 'master' into tgm-author-priority-fees-fix
tgmichel 406bde4
Split base fee and priority handling
tgmichel 5c76369
Test issuance
tgmichel 8b3d7e7
Expect treasury
tgmichel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Copyright 2019-2022 PureStake Inc. | ||
| // This file is part of Moonbeam. | ||
|
|
||
| // Moonbeam is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // Moonbeam is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with Moonbeam. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| #[macro_export] | ||
| macro_rules! impl_on_charge_evm_transaction { | ||
| {} => { | ||
| type CurrencyAccountId<T> = <T as frame_system::Config>::AccountId; | ||
|
|
||
| type BalanceFor<T> = | ||
| <<T as pallet_evm::Config>::Currency as CurrencyT<CurrencyAccountId<T>>>::Balance; | ||
|
|
||
| type PositiveImbalanceFor<T> = | ||
| <<T as pallet_evm::Config>::Currency as CurrencyT<CurrencyAccountId<T>>>::PositiveImbalance; | ||
|
|
||
| type NegativeImbalanceFor<T> = | ||
| <<T as pallet_evm::Config>::Currency as CurrencyT<CurrencyAccountId<T>>>::NegativeImbalance; | ||
|
|
||
| pub struct OnChargeEVMTransaction<OU>(sp_std::marker::PhantomData<OU>); | ||
| impl<T, OU> OnChargeEVMTransactionT<T> for OnChargeEVMTransaction<OU> | ||
| where | ||
| T: pallet_evm::Config, | ||
| PositiveImbalanceFor<T>: Imbalance<BalanceFor<T>, Opposite = NegativeImbalanceFor<T>>, | ||
| NegativeImbalanceFor<T>: Imbalance<BalanceFor<T>, Opposite = PositiveImbalanceFor<T>>, | ||
| OU: OnUnbalanced<NegativeImbalanceFor<T>>, | ||
| { | ||
| type LiquidityInfo = Option<NegativeImbalanceFor<T>>; | ||
|
|
||
| fn withdraw_fee(who: &H160, fee: U256) -> Result<Self::LiquidityInfo, pallet_evm::Error<T>> { | ||
| EVMCurrencyAdapter::<<T as pallet_evm::Config>::Currency, ()>::withdraw_fee(who, fee) | ||
| } | ||
|
|
||
| fn correct_and_deposit_fee( | ||
| who: &H160, | ||
| corrected_fee: U256, | ||
| already_withdrawn: Self::LiquidityInfo, | ||
| ) { | ||
| <EVMCurrencyAdapter<<T as pallet_evm::Config>::Currency, OU> as OnChargeEVMTransactionT< | ||
| T, | ||
| >>::correct_and_deposit_fee(who, corrected_fee, already_withdrawn) | ||
| } | ||
|
|
||
| fn pay_priority_fee(_tip: U256) {} | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 amuses me how subtle this is in code...
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.
Is it necessary to add some docs about this?
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.
@AsceticBear PTAL to polkadot-evm/frontier#700
I thought about it this past days, and decided to slightly modify the approach in Frontier. I think splitting both base fee and priority fee handling offers the most flexibility in terms of how each chain wants to deals with them.