Skip to content

Commit

Permalink
Add disable_fee feature flag; Remove old polymesh-extension (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriqueNogara authored Dec 2, 2024
1 parent d7686cb commit 7fb0936
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 75 deletions.
95 changes: 37 additions & 58 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pallet-sto = { git = "https://github.com/PolymeshAssociation/Polymesh.git", bran
pallet-settlement = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
pallet-statistics = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
pallet-test-utils = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
pallet-transaction-payment = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
pallet-transaction-payment = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false, features = ["disable_fees"]}
pallet-treasury = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
pallet-utility = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
pallet-sudo = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
Expand All @@ -155,7 +155,6 @@ polymesh-common-utilities = { git = "https://github.com/PolymeshAssociation/Poly
polymesh-runtime-common = { path = "runtime/common/", default-features = false }
polymesh-primitives = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
polymesh-weights = { path = "pallets/weights/", default-features = false }
polymesh-extensions = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }

# RPC
node-rpc = { git = "https://github.com/PolymeshAssociation/Polymesh.git", branch = "develop", default-features = false }
Expand Down Expand Up @@ -256,7 +255,6 @@ polymesh-common-utilities = { workspace = true, default-features = false }
polymesh-runtime-common = { workspace = true, default-features = false }
polymesh-primitives = { workspace = true, default-features = false }
polymesh-weights = { workspace = true, default-features = false }
polymesh-extensions = { workspace = true, default-features = false }

# PoA
validator-set = { workspace = true, default-features = false }
Expand Down
9 changes: 8 additions & 1 deletion runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub use sp_runtime::{Perbill, Permill};
pub use frame_support::{
dispatch::{DispatchClass, GetDispatchInfo, Weight},
parameter_types,
traits::Currency,
traits::{Currency, Get},
weights::{
constants::{
WEIGHT_REF_TIME_PER_MICROS, WEIGHT_REF_TIME_PER_MILLIS, WEIGHT_REF_TIME_PER_NANOS,
Expand Down Expand Up @@ -139,6 +139,7 @@ parameter_types! {

/// Converts Weight to Fee
pub struct WeightToFee;

impl WeightToFeePolynomial for WeightToFee {
type Balance = Balance;
/// We want a 0.03 POLYX fee per ExtrinsicBaseWeight.
Expand All @@ -158,6 +159,12 @@ impl WeightToFeePolynomial for WeightToFee {
}
}

impl Get<Vec<WeightToFeeCoefficient<Balance>>> for WeightToFee {
fn get() -> Vec<WeightToFeeCoefficient<Balance>> {
Self::polynomial().to_vec()
}
}

use pallet_group_rpc_runtime_api::Member;
use polymesh_common_utilities::traits::group::InactiveMember;
use sp_std::{convert::From, prelude::*};
Expand Down
5 changes: 3 additions & 2 deletions runtime/common/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ macro_rules! misc_pallet_impls {
type GovernanceCommittee = PolymeshCommittee;
type CddProviders = CddServiceProviders;
type Identity = Identity;
type WeightToFeeConst = polymesh_runtime_common::WeightToFee;
}

impl polymesh_common_utilities::traits::CommonConfig for Runtime {
Expand Down Expand Up @@ -547,7 +548,7 @@ macro_rules! misc_pallet_impls {
frame_system::CheckGenesis::new(),
frame_system::CheckEra::from(generic::Era::mortal(period, current_block)),
frame_system::CheckNonce::from(nonce),
polymesh_extensions::CheckWeight::new(),
frame_system::CheckWeight::new(),
pallet_transaction_payment::ChargeTransactionPayment::from(tip),
pallet_permissions::StoreCallMetadata::new(),
);
Expand Down Expand Up @@ -623,7 +624,7 @@ macro_rules! runtime_apis {
frame_system::CheckGenesis<Runtime>,
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
polymesh_extensions::CheckWeight<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
pallet_permissions::StoreCallMetadata<Runtime>,
);
Expand Down
4 changes: 1 addition & 3 deletions runtime/develop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ polymesh-common-utilities = { workspace = true, default-features = false }
polymesh-runtime-common = { workspace = true, default-features = false }
polymesh-primitives = { workspace = true, default-features = false }
polymesh-weights = { workspace = true, default-features = false }
polymesh-extensions = { workspace = true, default-features = false }

# Our pallets
pallet-asset = { workspace = true, default-features = false }
Expand All @@ -35,7 +34,7 @@ pallet-sto = { workspace = true, default-features = false }
pallet-settlement = { workspace = true, default-features = false }
pallet-statistics = { workspace = true, default-features = false }
pallet-test-utils = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false, features = ["disable_fees"] }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-sudo = { workspace = true, default-features = false }
Expand Down Expand Up @@ -183,7 +182,6 @@ std = [
"sp-transaction-pool/std",
"sp-version/std",
"polymesh-contracts/std",
"polymesh-extensions/std",
]
runtime-benchmarks = [
"getrandom/js",
Expand Down
2 changes: 1 addition & 1 deletion runtime/develop/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ construct_runtime!(
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},

// TransactionPayment: Genesis config dependencies: Balance.
TransactionPayment: pallet_transaction_payment::{Pallet, Event<T>, Storage},
TransactionPayment: pallet_transaction_payment::{Pallet, Call, Event<T>, Storage},

// Identity: Genesis config deps: Timestamp.
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>, Config<T>},
Expand Down
3 changes: 1 addition & 2 deletions runtime/production/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ build = "build.rs"
[dependencies]
# Common
polymesh-common-utilities = { workspace = true, default-features = false }
polymesh-extensions = { workspace = true, default-features = false }
polymesh-primitives = { workspace = true, default-features = false }
polymesh-runtime-common = { workspace = true, default-features = false}
polymesh-weights = { workspace = true, default-features = false }
Expand Down Expand Up @@ -36,7 +35,7 @@ pallet-settlement = { workspace = true, default-features = false }
pallet-statistics = { workspace = true, default-features = false }
pallet-sto = { workspace = true, default-features = false }
pallet-sudo = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false, features = ["disable_fees"] }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion runtime/production/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ construct_runtime!(
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},

// TransactionPayment: Genesis config dependencies: Balance.
TransactionPayment: pallet_transaction_payment::{Pallet, Event<T>, Storage},
TransactionPayment: pallet_transaction_payment::{Pallet, Call, Event<T>, Storage},

// Identity: Genesis config deps: Timestamp.
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>, Config<T>},
Expand Down
4 changes: 1 addition & 3 deletions runtime/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ polymesh-common-utilities = { workspace = true, default-features = false }
polymesh-runtime-common = { workspace = true, default-features = false }
polymesh-primitives = { workspace = true, default-features = false }
polymesh-weights = { workspace = true, default-features = false }
polymesh-extensions = { workspace = true, default-features = false }

# Our pallets
pallet-asset = { workspace = true, default-features = false }
Expand All @@ -33,7 +32,7 @@ pallet-sto = { workspace = true, default-features = false }
pallet-settlement = { workspace = true, default-features = false }
pallet-statistics = { workspace = true, default-features = false }
pallet-test-utils = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false, features = ["disable_fees"] }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-sudo = { workspace = true, default-features = false }
Expand Down Expand Up @@ -171,7 +170,6 @@ std = [
"sp-transaction-pool/std",
"sp-version/std",
"polymesh-contracts/std",
"polymesh-extensions/std",
]

runtime-benchmarks = [
Expand Down
2 changes: 1 addition & 1 deletion runtime/tests/src/test_runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ frame_support::construct_runtime!(
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 5,
TransactionPayment: pallet_transaction_payment::{Pallet, Event<T>, Storage} = 6,
TransactionPayment: pallet_transaction_payment::{Pallet, Call, Event<T>, Storage} = 6,
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>, Config<T>} = 7,
CddServiceProviders: pallet_group::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>} = 8,
PolymeshCommittee: pallet_committee::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 9,
Expand Down

0 comments on commit 7fb0936

Please sign in to comment.