Skip to content

Commit

Permalink
Transaction fee paid fix (#1479)
Browse files Browse the repository at this point in the history
* Fix payer in transaction fee paid event.

* 100% of transaction/protocol fees goto the block author.

* cleanup.

* cargo fmt
  • Loading branch information
Neopallium committed Jun 22, 2023
1 parent de418e9 commit 1c53c22
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 41 deletions.
18 changes: 4 additions & 14 deletions pallets/runtime/develop/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ use crate::constants::time::*;
use codec::Encode;
use core::convert::TryFrom;
use frame_support::{
construct_runtime,
dispatch::DispatchResult,
parameter_types,
traits::{tokens::imbalance::SplitTwoWays, KeyOwnerProofSystem},
construct_runtime, dispatch::DispatchResult, parameter_types, traits::KeyOwnerProofSystem,
weights::Weight,
};
use pallet_asset::checkpoint as pallet_checkpoint;
Expand All @@ -24,7 +21,7 @@ use polymesh_runtime_common::{
impls::Author,
merge_active_and_inactive,
runtime::{GovernanceCommittee, BENCHMARK_MAX_INCREASE, VMO},
AvailableBlockRatio, MaximumBlockWeight, NegativeImbalance,
AvailableBlockRatio, MaximumBlockWeight,
};
use sp_runtime::transaction_validity::TransactionPriority;
use sp_runtime::{
Expand Down Expand Up @@ -143,15 +140,8 @@ parameter_types! {
pub const MaxNumberOfNFTsMoves: u32 = 100;
}

/// Splits fees 80/20 between treasury and block author.
pub type DealWithFees = SplitTwoWays<
Balance,
NegativeImbalance<Runtime>,
Treasury, // 4 parts (80%) goes to the treasury.
Author<Runtime>, // 1 part (20%) goes to the block author.
4,
1,
>;
/// 100% goes to the block author.
pub type DealWithFees = Author<Runtime>;

// Staking:
pallet_staking_reward_curve::build! {
Expand Down
17 changes: 4 additions & 13 deletions pallets/runtime/mainnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
use crate::constants::time::*;
use codec::Encode;
use frame_support::{
construct_runtime, parameter_types,
traits::{tokens::imbalance::SplitTwoWays, KeyOwnerProofSystem},
weights::Weight,
construct_runtime, parameter_types, traits::KeyOwnerProofSystem, weights::Weight,
};
use pallet_asset::checkpoint as pallet_checkpoint;
use pallet_corporate_actions::ballot as pallet_corporate_ballot;
Expand All @@ -21,7 +19,7 @@ use polymesh_runtime_common::{
impls::Author,
merge_active_and_inactive,
runtime::{GovernanceCommittee, BENCHMARK_MAX_INCREASE, VMO},
AvailableBlockRatio, MaximumBlockWeight, NegativeImbalance,
AvailableBlockRatio, MaximumBlockWeight,
};
use sp_runtime::transaction_validity::TransactionPriority;
use sp_runtime::{
Expand Down Expand Up @@ -140,15 +138,8 @@ parameter_types! {
pub const MaxNumberOfNFTsMoves: u32 = 100;
}

/// Splits fees 80/20 between treasury and block author.
pub type DealWithFees = SplitTwoWays<
Balance,
NegativeImbalance<Runtime>,
Treasury, // 4 parts (80%) goes to the treasury.
Author<Runtime>, // 1 part (20%) goes to the block author.
4,
1,
>;
/// 100% goes to the block author.
pub type DealWithFees = Author<Runtime>;

// Staking:
pallet_staking_reward_curve::build! {
Expand Down
17 changes: 4 additions & 13 deletions pallets/runtime/testnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ use frame_support::traits::OnRuntimeUpgrade;

use core::convert::TryFrom;
use frame_support::{
construct_runtime, parameter_types,
traits::{tokens::imbalance::SplitTwoWays, KeyOwnerProofSystem},
weights::Weight,
construct_runtime, parameter_types, traits::KeyOwnerProofSystem, weights::Weight,
};
use pallet_asset::checkpoint as pallet_checkpoint;
use pallet_corporate_actions::ballot as pallet_corporate_ballot;
Expand All @@ -26,7 +24,7 @@ use polymesh_runtime_common::{
impls::Author,
merge_active_and_inactive,
runtime::{GovernanceCommittee, BENCHMARK_MAX_INCREASE, VMO},
AvailableBlockRatio, MaximumBlockWeight, NegativeImbalance,
AvailableBlockRatio, MaximumBlockWeight,
};
use sp_runtime::transaction_validity::TransactionPriority;
use sp_runtime::{
Expand Down Expand Up @@ -146,15 +144,8 @@ parameter_types! {
pub const MaxNumberOfNFTsMoves: u32 = 100;
}

/// Splits fees 80/20 between treasury and block author.
pub type DealWithFees = SplitTwoWays<
Balance,
NegativeImbalance<Runtime>,
Treasury, // 4 parts (80%) goes to the treasury.
Author<Runtime>, // 1 part (20%) goes to the block author.
4,
1,
>;
/// 100% goes to the block author.
pub type DealWithFees = Author<Runtime>;

// Staking:
pallet_staking_reward_curve::build! {
Expand Down
2 changes: 1 addition & 1 deletion pallets/transaction-payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ where
&fee_key, info, post_info, actual_fee, tip, imbalance,
)?;
Module::<T>::deposit_event(Event::<T>::TransactionFeePaid {
who,
who: fee_key,
actual_fee,
tip,
});
Expand Down

0 comments on commit 1c53c22

Please sign in to comment.