Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions .maintain/frame-weight-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ impl {{pallet}}::WeightInfo for SubstrateWeight {
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Minimum execution time: {{underscore benchmark.min_execution_time}} nanoseconds.
Weight::from_ref_time({{underscore benchmark.base_weight}})
Weight::from_parts({{underscore benchmark.base_weight}}, 0)
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into()))
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(DbWeight::get().reads({{benchmark.base_reads}}))
Expand Down
402 changes: 205 additions & 197 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pallet-staking = { git = "https://github.com/PolymeshAssociation/polkadot-sdk",
pallet-staking-runtime-api = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2512-0" }
pallet-staking-reward-curve = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2512-0" }
pallet-sudo = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2512-0" }
pallet-transaction-payment = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2512-0" }
pallet-timestamp = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2512-0" }
sc-authority-discovery = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2512-0" }
sc-basic-authorship = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2512-0" }
Expand Down Expand Up @@ -177,7 +178,7 @@ pallet-sto = { path = "pallets/sto", default-features = false }
pallet-settlement = { path = "pallets/settlement", default-features = false }
pallet-validators = { path = "pallets/validators", default-features = false }
pallet-statistics = { path = "pallets/statistics", default-features = false }
pallet-transaction-payment = { path = "pallets/transaction-payment", default-features = false }
polymesh-transaction-payment = { path = "pallets/transaction-payment", default-features = false }
pallet-treasury = { path = "pallets/treasury", default-features = false }
pallet-utility = { path = "pallets/utility", default-features = false }
polymesh-contracts = { path = "pallets/contracts", default-features = false }
Expand Down Expand Up @@ -235,6 +236,7 @@ pallet-staking-runtime-api = { version = "14.0.0", default-features = false }
pallet-staking-reward-curve = { version = "11.0.0", default-features = false }
pallet-sudo = { version = "28.0.0", default-features = false }
pallet-timestamp = { version = "27.0.0", default-features = false }
pallet-transaction-payment = { version = "28.0.0", default-features = false }
scale-info = { version = "2.11.6", default-features = false, features = ["derive"] }
sp-api = { version = "26.0.0", default-features = false }
sp-application-crypto = { version = "30.0.0", default-features = false }
Expand Down Expand Up @@ -306,7 +308,6 @@ rand_chacha = { version = "0.3", default-features = false }

[dependencies]
pallet-asset = { workspace = true }
pallet-balances = { workspace = true, default-features = false, features = ["insecure_zero_ed"] }
pallet-committee = { workspace = true, default-features = false }
pallet-corporate-actions = { workspace = true, default-features = false }
pallet-external-agents = { workspace = true, default-features = false }
Expand All @@ -316,11 +317,9 @@ pallet-multisig = { workspace = true, default-features = false }
pallet-permissions = { workspace = true, default-features = false }
pallet-pips = { workspace = true, default-features = false }
pallet-protocol-fee = { workspace = true, default-features = false }
pallet-staking = { workspace = true, default-features = false }
pallet-staking-runtime-api = { workspace = true, default-features = false }
pallet-validators = { workspace = true, default-features = false }
pallet-sudo = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
polymesh-transaction-payment = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
polymesh-common-utilities = { workspace = true, default-features = false }
polymesh-primitives = { workspace = true, default-features = false }
Expand Down Expand Up @@ -378,9 +377,13 @@ frame-support = { workspace = true }
frame-system = { workspace = true }
frame-system-rpc-runtime-api = { workspace = true }
pallet-babe = { workspace = true }
pallet-balances = { workspace = true, default-features = false, features = ["insecure_zero_ed"] }
pallet-im-online = { workspace = true }
pallet-indices = { workspace = true }
pallet-session = { workspace = true }
pallet-staking = { workspace = true, default-features = false }
pallet-staking-runtime-api = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.17.2" }
sp-api = { workspace = true }
sp-authority-discovery = { workspace = true }
Expand Down Expand Up @@ -411,7 +414,7 @@ substrate-build-script-utils = { version = "11.0.0" }
[features]
default = ["std"]
disable_fees = [
"pallet-transaction-payment/disable_fees",
"polymesh-transaction-payment/disable_fees",
"polymesh-runtime-develop/disable_fees",
"polymesh-runtime-mainnet/disable_fees",
"polymesh-runtime-testnet/disable_fees",
Expand Down
12 changes: 9 additions & 3 deletions pallets/runtime/common/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,19 @@ macro_rules! misc_pallet_impls {
}

impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
#[allow(deprecated)]
type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;
type WeightToFee = polymesh_runtime_common::WeightToFee;
type LengthToFee = polymesh_runtime_common::LengthToFee;
type FeeMultiplierUpdate = ();
type OperationalFeeMultiplier = polymesh_runtime_common::OperationalFeeMultiplier;
type WeightInfo = polymesh_weights::pallet_transaction_payment::SubstrateWeight;
type WeightInfo = polymesh_weights::polymesh_transaction_payment::SubstrateWeight;
type ChargeFees = PolymeshTransactionPayment;
}

impl polymesh_transaction_payment::Config for Runtime {
type CddHandler = CddHandler;
type Subsidiser = Relayer;
type GovernanceCommittee = PolymeshCommittee;
Expand Down Expand Up @@ -630,7 +636,7 @@ macro_rules! misc_pallet_impls {
frame_system::CheckEra::from(generic::Era::mortal(period, current_block)),
frame_system::CheckNonce::from(nonce),
frame_system::CheckWeight::new(),
pallet_transaction_payment::ChargeTransactionPayment::from(tip),
polymesh_transaction_payment::ChargeTransactionPayment::from(tip),
pallet_permissions::StoreCallMetadata::new(),
);
let raw_payload = SignedPayload::new(call, extra)
Expand Down Expand Up @@ -805,7 +811,7 @@ macro_rules! runtime_apis {
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
polymesh_transaction_payment::ChargeTransactionPayment<Runtime>,
pallet_permissions::StoreCallMetadata<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
Expand Down
5 changes: 4 additions & 1 deletion pallets/runtime/develop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-sudo = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
polymesh-transaction-payment = { workspace = true, default-features = false }

# Others
serde = { version = "1.0.104", default-features = false }
Expand Down Expand Up @@ -106,7 +107,7 @@ polymesh-build-tool = { workspace = true, default-features = false }
[features]
default = ["std", "equalize"]
testing = []
disable_fees = ["pallet-transaction-payment/disable_fees"]
disable_fees = ["polymesh-transaction-payment/disable_fees"]
equalize = []

ci-runtime = []
Expand Down Expand Up @@ -151,6 +152,7 @@ std = [
"pallet-sto/std",
"pallet-sudo/std",
"pallet-transaction-payment/std",
"polymesh-transaction-payment/std",
"pallet-utility/std",
"pallet-validators/std",
"polymesh-contracts/std",
Expand Down Expand Up @@ -194,6 +196,7 @@ runtime-benchmarks = [
"pallet-statistics/runtime-benchmarks",
"pallet-sto/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks",
"polymesh-transaction-payment/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-validators/runtime-benchmarks",
Expand Down
4 changes: 4 additions & 0 deletions pallets/runtime/develop/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ mod runtime {
#[runtime::pallet_index(6)]
pub type TransactionPayment = pallet_transaction_payment::Pallet<Runtime>;

#[runtime::pallet_index(51)]
pub type PolymeshTransactionPayment = polymesh_transaction_payment::Pallet<Runtime>;

#[runtime::pallet_index(7)]
pub type Identity = pallet_identity::Pallet<Runtime>;

Expand Down Expand Up @@ -505,6 +508,7 @@ mod benches {
[pallet_scheduler, Scheduler]
[pallet_staking, Staking]
[pallet_validators, Validators]
[polymesh_transaction_payment, PolymeshTransactionPayment]
[polymesh_contracts, PolymeshContracts]
[pallet_nft, Nft]
[pallet_contracts, Contracts]
Expand Down
6 changes: 4 additions & 2 deletions pallets/runtime/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pallet-transaction-payment = { workspace = true, default-features = false }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
polymesh-transaction-payment = { workspace = true, default-features = false }

# RPC
node-rpc-runtime-api = { workspace = true, default-features = false }
Expand Down Expand Up @@ -100,7 +101,7 @@ polymesh-build-tool = { workspace = true, default-features = false }

[features]
default = ["std", "equalize"]
disable_fees = ["pallet-transaction-payment/disable_fees"]
disable_fees = ["polymesh-transaction-payment/disable_fees"]
equalize = []
testing = []

Expand Down Expand Up @@ -160,6 +161,7 @@ std = [
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
"polymesh-transaction-payment/std",
"pallet-treasury/std",
"pallet-utility/std",
"polymesh-contracts/std",
Expand Down Expand Up @@ -187,4 +189,4 @@ std = [
"sp-genesis-builder/std",
]

runtime-benchmarks = []
runtime-benchmarks = []
3 changes: 3 additions & 0 deletions pallets/runtime/mainnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ mod runtime {
#[runtime::pallet_index(6)]
pub type TransactionPayment = pallet_transaction_payment::Pallet<Runtime>;

#[runtime::pallet_index(51)]
pub type PolymeshTransactionPayment = polymesh_transaction_payment::Pallet<Runtime>;

#[runtime::pallet_index(7)]
pub type Identity = pallet_identity::Pallet<Runtime>;

Expand Down
4 changes: 3 additions & 1 deletion pallets/runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-sudo = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
polymesh-transaction-payment = { workspace = true, default-features = false }

# RPC
node-rpc-runtime-api = { workspace = true, default-features = false }
Expand Down Expand Up @@ -102,7 +103,7 @@ polymesh-build-tool = { workspace = true, default-features = false }

[features]
default = ["std", "equalize"]
disable_fees = ["pallet-transaction-payment/disable_fees"]
disable_fees = ["polymesh-transaction-payment/disable_fees"]
equalize = []
testing = []

Expand Down Expand Up @@ -163,6 +164,7 @@ std = [
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
"polymesh-transaction-payment/std",
"pallet-treasury/std",
"pallet-utility/std",
"polymesh-primitives/std",
Expand Down
3 changes: 3 additions & 0 deletions pallets/runtime/testnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ mod runtime {
#[runtime::pallet_index(6)]
pub type TransactionPayment = pallet_transaction_payment::Pallet<Runtime>;

#[runtime::pallet_index(51)]
pub type PolymeshTransactionPayment = polymesh_transaction_payment::Pallet<Runtime>;

#[runtime::pallet_index(7)]
pub type Identity = pallet_identity::Pallet<Runtime>;

Expand Down
4 changes: 3 additions & 1 deletion pallets/runtime/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ 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 }
polymesh-transaction-payment = { workspace = true, default-features = false }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
Expand Down Expand Up @@ -152,6 +153,7 @@ std = [
"pallet-statistics/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
"polymesh-transaction-payment/std",
"pallet-treasury/std",
"pallet-sudo/std",
"polymesh-primitives/std",
Expand All @@ -173,4 +175,4 @@ std = [

runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]

try-runtime = []
try-runtime = []
2 changes: 1 addition & 1 deletion pallets/runtime/tests/src/balances_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use sp_runtime::transaction_validity::TransactionSource;

use pallet_balances::{self as balances, Event as BalancesRawEvent};
use pallet_identity as identity;
use pallet_transaction_payment::{ChargeTransactionPayment, Val};
use polymesh_primitives::Memo;
use polymesh_transaction_payment::{ChargeTransactionPayment, Val};

use super::storage::{RuntimeCall as StorageRuntimeCall, TestStorage};
use super::ExtBuilder;
Expand Down
8 changes: 4 additions & 4 deletions pallets/runtime/tests/src/relayer_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityEr
use sp_runtime::MultiAddress;

use pallet_relayer::Subsidy;
use pallet_transaction_payment::Val;
use polymesh_common_utilities::protocol_fee::ProtocolOp;
use polymesh_primitives::constants::currency::POLY;
use polymesh_primitives::traits::CddAndFeeDetails;
use polymesh_primitives::{AccountId, Balance, Signatory, Ticker, TransactionError};
use polymesh_runtime_develop::runtime::{CddHandler, RuntimeCall as DevRuntimeCall};
use polymesh_transaction_payment::Val;

use super::storage::{get_last_auth_id, make_account_without_cdd, RuntimeCall, TestStorage, User};
use super::ExtBuilder;
Expand All @@ -26,7 +26,7 @@ type AccountKeyRefCount = pallet_identity::AccountKeyRefCount<TestStorage>;
type Balances = pallet_balances::Pallet<TestStorage>;
type ProtocolFee = pallet_protocol_fee::Pallet<TestStorage>;
type TransactionPayment = pallet_transaction_payment::Pallet<TestStorage>;
type ChargeTransactionPayment = pallet_transaction_payment::ChargeTransactionPayment<TestStorage>;
type ChargeTransactionPayment = polymesh_transaction_payment::ChargeTransactionPayment<TestStorage>;
type Error = pallet_relayer::Error<TestStorage>;
type IdentityError = pallet_identity::Error<TestStorage>;
type RuntimeOrigin = <TestStorage as frame_system::Config>::RuntimeOrigin;
Expand Down Expand Up @@ -123,7 +123,7 @@ fn assert_invalid_subsidy_call(caller: &AccountId, call: &RuntimeCall) {
let val_charge = Val::Charge {
tip: 0,
who: caller.clone(),
fee: 1,
fee_with_tip: 1,
subsidiser: None,
};
let pre_err = ChargeTransactionPayment::from(0)
Expand Down Expand Up @@ -545,7 +545,7 @@ fn do_relayer_transaction_and_protocol_fees_test() {
Val::Charge {
tip: 0,
who: bob.acc(),
fee: 1,
fee_with_tip: 1,
subsidiser: Some(alice.acc()),
},
&RuntimeOrigin::signed(bob.acc()),
Expand Down
8 changes: 4 additions & 4 deletions pallets/runtime/tests/src/signed_extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn make_signed_extra(current_block: u64, period: u64, nonce: Nonce, tip: u128) -
CheckEra::<Runtime>::from(generic::Era::mortal(period, current_block)),
CheckNonce::<Runtime>::from(nonce),
CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
polymesh_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
pallet_permissions::StoreCallMetadata::<Runtime>::new(),
)
}
Expand Down Expand Up @@ -154,7 +154,7 @@ fn normal_tx() -> Result<(), String> {
TransactionSource::InBlock,
)
.expect("Tx should be valid");
assert_eq!(tx_validity.0.priority, 0);
assert_eq!(tx_validity.0.priority, 786432);
Ok(())
}

Expand Down Expand Up @@ -190,7 +190,7 @@ fn operational_tx() -> Result<(), String> {
TransactionSource::InBlock,
)
.expect("Tx should be valid");
assert_eq!(tx_validity.0.priority as u128, tip);
assert_eq!(tx_validity.0.priority as u128, 162794569728);

// Operational TX without any tip.
let sign_extra = make_signed_extra(0, 10, 0, 0u128.into());
Expand All @@ -205,6 +205,6 @@ fn operational_tx() -> Result<(), String> {
TransactionSource::InBlock,
)
.expect("Tx should be valid");
assert_eq!(tx_validity.0.priority, 0);
assert_eq!(tx_validity.0.priority, 162530328576);
Ok(())
}
5 changes: 4 additions & 1 deletion pallets/runtime/tests/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ mod runtime {
#[runtime::pallet_index(6)]
pub type TransactionPayment = pallet_transaction_payment::Pallet<Runtime>;

#[runtime::pallet_index(51)]
pub type PolymeshTransactionPayment = polymesh_transaction_payment::Pallet<Runtime>;

#[runtime::pallet_index(7)]
pub type Identity = pallet_identity::Pallet<Runtime>;

Expand Down Expand Up @@ -1087,7 +1090,7 @@ fn signed_extra(nonce: Nonce) -> SignedExtra {
frame_system::CheckEra::from(Era::mortal(256, 0)),
frame_system::CheckNonce::from(nonce),
frame_system::CheckWeight::new(),
pallet_transaction_payment::ChargeTransactionPayment::from(0),
polymesh_transaction_payment::ChargeTransactionPayment::from(0),
pallet_permissions::StoreCallMetadata::new(),
)
}
Expand Down
Loading