Skip to content

Commit

Permalink
update tx payment pallet LengthToFee TransactionByteFee
Browse files Browse the repository at this point in the history
  • Loading branch information
rustlang-dev committed Nov 18, 2024
1 parent cd1e6cb commit da097c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub const MILLISECS_PER_BLOCK: u64 = prod_or_fast!(15_000, 5_000);

pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;

pub const MILLI_CTC: u128 = 1_000_000_000_000_000;
pub const CENTS: u128 = CTC / 100;

// WARNING: the next should be defined on a single line b/c of
// the assertions made in .github/check-for-changes-in-epoch-duration.sh
Expand Down Expand Up @@ -341,8 +341,8 @@ impl<T: frame_system::Config> WeightToFeePolynomial for WeightToCtcFee<T> {
type Balance = Balance;

fn polynomial() -> frame_support::weights::WeightToFeeCoefficients<Self::Balance> {
let p = MILLI_CTC / 2;
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
let p = CENTS;
let q = 10 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
smallvec::smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
Expand All @@ -352,16 +352,19 @@ impl<T: frame_system::Config> WeightToFeePolynomial for WeightToCtcFee<T> {
}
}

pub const TRANSACTION_BYTE_FEE: Balance = 10 * CENTS / 1_000;

parameter_types! {
pub FeeMultiplier: Multiplier = Multiplier::one();
pub const TransactionByteFee: Balance = TRANSACTION_BYTE_FEE;
}

impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = ConstU8<1u8>;
type WeightToFee = WeightToCtcFee<Runtime>;
type LengthToFee = ConstantMultiplier<u128, ConstU128<1_500_000_000u128>>;
type LengthToFee = ConstantMultiplier<u128, TransactionByteFee>;
type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("creditcoin3"),
impl_name: create_runtime_str!("creditcoin3"),
authoring_version: 3,
spec_version: 38,
spec_version: 39,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down

0 comments on commit da097c6

Please sign in to comment.