Skip to content
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

feat: update tx payment pallet config #525

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
resolver = "2"

[workspace.package]
version = "3.38.0"
version = "3.39.0"
authors = ["Gluwa Inc. Developer Support <support.dev@gluwa.com>"]
edition = "2021"
license = "Unlicense"
Expand Down
13 changes: 8 additions & 5 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use frame_support::weights::{constants::ParityDbWeight as RuntimeDbWeight, Weigh
use frame_support::{
construct_runtime, parameter_types,
traits::{
ConstU128, ConstU32, ConstU8, FindAuthor, InstanceFilter, KeyOwnerProofSystem, OnFinalize,
ConstU32, ConstU8, FindAuthor, InstanceFilter, KeyOwnerProofSystem, OnFinalize,
OnTimestampSet,
},
weights::{
Expand Down 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
Loading