-
Notifications
You must be signed in to change notification settings - Fork 345
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
Send priority fees to collators #3120
base: master
Are you sure you want to change the base?
Conversation
WASM runtime size check:Compared to target branchMoonbase runtime: 2268 KB (no changes) ✅ Moonbeam runtime: 2240 KB (no changes) ✅ Moonriver runtime: 2240 KB (no changes) ✅ Compared to latest release (runtime-3400)Moonbase runtime: 2268 KB (+240 KB compared to latest release) Moonbeam runtime: 2240 KB (+228 KB compared to latest release) Moonriver runtime: 2240 KB (+228 KB compared to latest release) |
Coverage Report@@ Coverage Diff @@
## master tarekkma/priority-fees +/- ##
==========================================================
+ Coverage 74.40% 74.53% +0.13%
- Files 376 375 -1
+ Lines 95432 95469 +37
==========================================================
+ Hits 70998 71154 +156
- Misses 24434 24315 -119
|
pub struct BlockAuthorAccountId<R>(PhantomData<R>); | ||
impl<R> TypedGet for BlockAuthorAccountId<R> | ||
where | ||
R: frame_system::Config + pallet_author_inherent::Config, | ||
pallet_author_inherent::Pallet<R>: Get<R::AccountId>, | ||
{ | ||
type Type = R::AccountId; | ||
fn get() -> Self::Type { | ||
<pallet_author_inherent::Pallet<R> as Get<R::AccountId>>::get() | ||
} | ||
} | ||
|
||
/// Deal with ethereum based priority fees/tips. See DealWithEthereumBaseFees for base fees. | ||
pub struct DealWithEthereumPriorityFees<R>(sp_std::marker::PhantomData<R>); | ||
impl<R> OnUnbalanced<Credit<R::AccountId, pallet_balances::Pallet<R>>> | ||
for DealWithEthereumPriorityFees<R> | ||
where | ||
R: pallet_balances::Config + pallet_author_inherent::Config, | ||
pallet_author_inherent::Pallet<R>: Get<R::AccountId>, | ||
{ | ||
fn on_nonzero_unbalanced(amount: Credit<R::AccountId, pallet_balances::Pallet<R>>) { | ||
ResolveTo::<BlockAuthorAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(amount); | ||
} | ||
} |
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.
We could move this code and DealWithSubstrateFeesAndTip
to common and share the implementation with all runtimes
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 kept it separate since the original DealWithFees
was repeated in all runtimes with the same 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.
The changes look good.
I think we should common implementations of DealWithSubstrateFeesAndTip
, DealWithEthereumBaseFees
, DealWithEthereumPriorityFees
in all runtimes.
What does it do?
Expand on the work done in #2923 and #3043, and send the priority fees to the block author (collator).
What important points reviewers should know?
FeesTreasuryProportion
is used to split the followingDealWithFees
struct and replaced it withDealWithSubstrateFeesAndTip
DealWithEthereumBaseFees
DealWithEthereumPriorityFees
Tests
Some tests that were checking fees have been updated. Previously, they used the block author (ALITH), who will now receive tips due to this change, causing inaccuracies in the calculations.
Reviewer Checklist:
Is there something left for follow-up PRs?
What alternative implementations were considered?
Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?
What value does it bring to the blockchain users?