From 55e41481456857cd171197d91fb6b28aa21aa000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20Pa=C4=8Dandi?= <3002868+Dinonard@users.noreply.github.com> Date: Mon, 9 Jan 2023 15:17:51 +0100 Subject: [PATCH] Shiden - burn only fee, not the tip (#817) * Shiden - burn only fee, not the tip * Remove double burn * Adjust Astar & Shibuya --- runtime/astar/src/lib.rs | 2 +- runtime/shibuya/src/lib.rs | 2 +- runtime/shiden/src/lib.rs | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/runtime/astar/src/lib.rs b/runtime/astar/src/lib.rs index b34989562..acbfcb56b 100644 --- a/runtime/astar/src/lib.rs +++ b/runtime/astar/src/lib.rs @@ -619,7 +619,7 @@ impl OnUnbalanced for DealWithFees { let (to_burn, collators) = fees.ration(20, 80); // burn part of fees - let _ = Balances::burn(to_burn.peek()); + drop(to_burn); // pay fees to collators >::on_unbalanced(collators); diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 262b37580..7d2bd072e 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -716,7 +716,7 @@ impl OnUnbalanced for DealWithFees { let (to_burn, collators) = fees.ration(20, 80); // burn part of fees - let _ = Balances::burn(to_burn.peek()); + drop(to_burn); // pay fees to collators >::on_unbalanced(collators); diff --git a/runtime/shiden/src/lib.rs b/runtime/shiden/src/lib.rs index c9b484602..ebcd10836 100644 --- a/runtime/shiden/src/lib.rs +++ b/runtime/shiden/src/lib.rs @@ -656,8 +656,16 @@ impl WeightToFeePolynomial for WeightToFee { pub struct BurnFees; impl OnUnbalanced for BurnFees { - fn on_unbalanceds(_: impl Iterator) { - // burns the fees + /// Payout tips but burn all the fees + fn on_unbalanceds(mut fees_then_tips: impl Iterator) { + if let Some(fees_to_burn) = fees_then_tips.next() { + if let Some(tips) = fees_then_tips.next() { + >::on_unbalanced(tips); + } + + // burn fees + drop(fees_to_burn); + } } }