From 18154ec92c38c876b86e4491017efdc1e609a592 Mon Sep 17 00:00:00 2001 From: rust dev Date: Fri, 15 Nov 2024 19:55:41 +0000 Subject: [PATCH] feat: update tx payment pallet config (#525) * update tx payment pallet LengthToFee TransactionByteFee * fix clippy * cargo toml to v 39 --- Cargo.lock | 28 ++++++++++++++-------------- Cargo.toml | 2 +- runtime/src/lib.rs | 13 ++++++++----- runtime/src/version.rs | 2 +- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index caec6848..b57743e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1521,7 +1521,7 @@ dependencies = [ [[package]] name = "creditcoin3-cli-opt" -version = "3.38.0" +version = "3.39.0" dependencies = [ "bip32", "clap", @@ -1535,7 +1535,7 @@ dependencies = [ [[package]] name = "creditcoin3-client-evm-tracing" -version = "3.38.0" +version = "3.39.0" dependencies = [ "creditcoin3-rpc-primitives-debug", "ethereum-types", @@ -1551,7 +1551,7 @@ dependencies = [ [[package]] name = "creditcoin3-evm-tracer" -version = "3.38.0" +version = "3.39.0" dependencies = [ "creditcoin3-primitives-ext", "ethereum-types", @@ -1571,7 +1571,7 @@ dependencies = [ [[package]] name = "creditcoin3-node" -version = "3.38.0" +version = "3.39.0" dependencies = [ "async-trait", "clap", @@ -1648,7 +1648,7 @@ dependencies = [ [[package]] name = "creditcoin3-primitives-ext" -version = "3.38.0" +version = "3.39.0" dependencies = [ "ethereum-types", "evm-tracing-events", @@ -1659,7 +1659,7 @@ dependencies = [ [[package]] name = "creditcoin3-rpc-core-debug" -version = "3.38.0" +version = "3.39.0" dependencies = [ "creditcoin3-client-evm-tracing", "creditcoin3-rpc-core-types", @@ -1673,7 +1673,7 @@ dependencies = [ [[package]] name = "creditcoin3-rpc-core-trace" -version = "3.38.0" +version = "3.39.0" dependencies = [ "creditcoin3-client-evm-tracing", "creditcoin3-rpc-core-types", @@ -1686,7 +1686,7 @@ dependencies = [ [[package]] name = "creditcoin3-rpc-core-types" -version = "3.38.0" +version = "3.39.0" dependencies = [ "ethereum-types", "serde", @@ -1695,7 +1695,7 @@ dependencies = [ [[package]] name = "creditcoin3-rpc-debug" -version = "3.38.0" +version = "3.39.0" dependencies = [ "creditcoin3-client-evm-tracing", "creditcoin3-rpc-core-debug", @@ -1726,7 +1726,7 @@ dependencies = [ [[package]] name = "creditcoin3-rpc-primitives-debug" -version = "3.38.0" +version = "3.39.0" dependencies = [ "environmental", "ethereum", @@ -1743,7 +1743,7 @@ dependencies = [ [[package]] name = "creditcoin3-rpc-trace" -version = "3.38.0" +version = "3.39.0" dependencies = [ "creditcoin3-client-evm-tracing", "creditcoin3-rpc-core-trace", @@ -1778,7 +1778,7 @@ dependencies = [ [[package]] name = "creditcoin3-runtime" -version = "3.38.0" +version = "3.39.0" dependencies = [ "creditcoin3-evm-tracer", "creditcoin3-rpc-primitives-debug", @@ -2748,7 +2748,7 @@ dependencies = [ [[package]] name = "evm-tracing-events" -version = "3.38.0" +version = "3.39.0" dependencies = [ "environmental", "ethereum", @@ -3726,7 +3726,7 @@ dependencies = [ [[package]] name = "generate-bags" -version = "3.38.0" +version = "3.39.0" dependencies = [ "clap", "creditcoin3-runtime", diff --git a/Cargo.toml b/Cargo.toml index b6daa388..5f51b388 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = [ resolver = "2" [workspace.package] -version = "3.38.0" +version = "3.39.0" authors = ["Gluwa Inc. Developer Support "] edition = "2021" license = "Unlicense" diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 8cb573eb..461ff812 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -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::{ @@ -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 @@ -341,8 +341,8 @@ impl WeightToFeePolynomial for WeightToCtcFee { type Balance = Balance; fn polynomial() -> frame_support::weights::WeightToFeeCoefficients { - 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, @@ -352,8 +352,11 @@ impl WeightToFeePolynomial for WeightToCtcFee { } } +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 { @@ -361,7 +364,7 @@ impl pallet_transaction_payment::Config for Runtime { type OnChargeTransaction = CurrencyAdapter; type OperationalFeeMultiplier = ConstU8<1u8>; type WeightToFee = WeightToCtcFee; - type LengthToFee = ConstantMultiplier>; + type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = ConstFeeMultiplier; } diff --git a/runtime/src/version.rs b/runtime/src/version.rs index 67ebe335..9ce651f3 100644 --- a/runtime/src/version.rs +++ b/runtime/src/version.rs @@ -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,