Skip to content
Snippets Groups Projects
Unverified Commit b44a3345 authored by bgallois's avatar bgallois
Browse files

move benchmarks to common runtime

parent 874fb2a7
No related branches found
No related tags found
1 merge request!312Upgrade polkadot v1.17.0
Pipeline #39712 failed
...@@ -46,10 +46,7 @@ lazy_static! { ...@@ -46,10 +46,7 @@ lazy_static! {
/// Unwraps a [`crate::service::client::Client`] into the concrete runtime client. /// Unwraps a [`crate::service::client::Client`] into the concrete runtime client.
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
macro_rules! unwrap_client { macro_rules! unwrap_client {
( ($client:ident, $code:expr) => {
$client:ident,
$code:expr
) => {
match $client.as_ref() { match $client.as_ref() {
crate::service::client::Client::Client($client) => $code, crate::service::client::Client::Client($client) => $code,
} }
......
// Copyright 2021 Axiom-Team
//
// This file is part of Duniter-v2S.
//
// Duniter-v2S is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// Duniter-v2S is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
#![cfg(feature = "runtime-benchmarks")]
#[macro_export]
macro_rules! benchmarks_config {
() => {
#[macro_use]
extern crate frame_benchmarking;
pub use pallet_collective::RawOrigin;
type WorstOrigin = RawOrigin<AccountId, TechnicalCommitteeInstance>;
mod benches {
define_benchmarks!(
[pallet_certification, Certification]
[pallet_distance, Distance]
[pallet_oneshot_account, OneshotAccount]
[pallet_universal_dividend, UniversalDividend]
[pallet_provide_randomness, ProvideRandomness]
[pallet_upgrade_origin, UpgradeOrigin]
[pallet_duniter_account, Account]
[pallet_quota, Quota]
[pallet_identity, Identity]
[pallet_membership, Membership]
[pallet_smith_members, SmithMembers]
[pallet_authority_members, AuthorityMembers]
// Substrate
[frame_system_extensions, SystemExtensionsBench::<Runtime>]
[pallet_balances, Balances]
[frame_benchmarking::baseline, Baseline::<Runtime>]
[pallet_collective, TechnicalCommittee]
[pallet_session, SessionBench::<Runtime>]
[pallet_im_online, ImOnline]
[pallet_sudo, Sudo]
[pallet_multisig, Multisig]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_scheduler, Scheduler]
[frame_system, SystemBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_transaction_payment, TransactionPayment]
[pallet_treasury, Treasury]
[pallet_utility, Utility]
);
}
};
}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
mod apis; mod apis;
mod benchmarks;
pub mod constants; pub mod constants;
pub mod entities; pub mod entities;
pub mod fees; pub mod fees;
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
extern crate frame_benchmarking;
pub mod parameters; pub mod parameters;
pub mod weights; pub mod weights;
...@@ -39,8 +35,6 @@ use frame_support::{traits::Contains, PalletId}; ...@@ -39,8 +35,6 @@ use frame_support::{traits::Contains, PalletId};
pub use frame_system::Call as SystemCall; pub use frame_system::Call as SystemCall;
use frame_system::EnsureRoot; use frame_system::EnsureRoot;
pub use pallet_balances::Call as BalancesCall; pub use pallet_balances::Call as BalancesCall;
#[cfg(feature = "runtime-benchmarks")]
pub use pallet_collective::RawOrigin;
use pallet_grandpa::{ use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
}; };
...@@ -137,39 +131,7 @@ pub type Executive = frame_executive::Executive< ...@@ -137,39 +131,7 @@ pub type Executive = frame_executive::Executive<
pub type TechnicalCommitteeInstance = Instance2; pub type TechnicalCommitteeInstance = Instance2;
#[cfg(feature = "runtime-benchmarks")] common_runtime::benchmarks_config!();
mod benches {
define_benchmarks!(
[pallet_certification, Certification]
[pallet_distance, Distance]
[pallet_oneshot_account, OneshotAccount]
[pallet_universal_dividend, UniversalDividend]
[pallet_provide_randomness, ProvideRandomness]
[pallet_upgrade_origin, UpgradeOrigin]
[pallet_duniter_account, Account]
[pallet_identity, Identity]
[pallet_membership, Membership]
[pallet_smith_members, SmithMembers]
[pallet_authority_members, AuthorityMembers]
// Substrate
[frame_system_extensions, SystemExtensionsBench::<Runtime>]
[pallet_balances, Balances]
[frame_benchmarking::baseline, Baseline::<Runtime>]
[pallet_collective, TechnicalCommittee]
[pallet_sudo, Sudo]
[pallet_session, SessionBench::<Runtime>]
[pallet_im_online, ImOnline]
[pallet_multisig, Multisig]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_scheduler, Scheduler]
[frame_system, SystemBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_transaction_payment, TransactionPayment]
[pallet_treasury, Treasury]
[pallet_utility, Utility]
);
}
pub struct BaseCallFilter; pub struct BaseCallFilter;
impl Contains<RuntimeCall> for BaseCallFilter { impl Contains<RuntimeCall> for BaseCallFilter {
...@@ -231,8 +193,6 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType { ...@@ -231,8 +193,6 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
} }
} }
#[cfg(feature = "runtime-benchmarks")]
type WorstOrigin = RawOrigin<AccountId, TechnicalCommitteeInstance>;
// Configure pallets to include in runtime. // Configure pallets to include in runtime.
common_runtime::pallets_config!(); common_runtime::pallets_config!();
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
extern crate frame_benchmarking;
pub mod parameters; pub mod parameters;
pub mod weights; pub mod weights;
...@@ -39,8 +35,6 @@ use frame_support::{traits::Contains, PalletId}; ...@@ -39,8 +35,6 @@ use frame_support::{traits::Contains, PalletId};
pub use frame_system::Call as SystemCall; pub use frame_system::Call as SystemCall;
use frame_system::EnsureRoot; use frame_system::EnsureRoot;
pub use pallet_balances::Call as BalancesCall; pub use pallet_balances::Call as BalancesCall;
#[cfg(feature = "runtime-benchmarks")]
pub use pallet_collective::RawOrigin;
pub use pallet_duniter_test_parameters::Parameters as GenesisParameters; pub use pallet_duniter_test_parameters::Parameters as GenesisParameters;
use pallet_grandpa::{ use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
...@@ -138,40 +132,7 @@ pub type Executive = frame_executive::Executive< ...@@ -138,40 +132,7 @@ pub type Executive = frame_executive::Executive<
pub type TechnicalCommitteeInstance = Instance2; pub type TechnicalCommitteeInstance = Instance2;
#[cfg(feature = "runtime-benchmarks")] common_runtime::benchmarks_config!();
mod benches {
define_benchmarks!(
[pallet_certification, Certification]
[pallet_distance, Distance]
[pallet_oneshot_account, OneshotAccount]
[pallet_universal_dividend, UniversalDividend]
[pallet_provide_randomness, ProvideRandomness]
[pallet_upgrade_origin, UpgradeOrigin]
[pallet_duniter_account, Account]
[pallet_quota, Quota]
[pallet_identity, Identity]
[pallet_membership, Membership]
[pallet_smith_members, SmithMembers]
[pallet_authority_members, AuthorityMembers]
// Substrate
[frame_system_extensions, SystemExtensionsBench::<Runtime>]
[pallet_balances, Balances]
[frame_benchmarking::baseline, Baseline::<Runtime>]
[pallet_collective, TechnicalCommittee]
[pallet_session, SessionBench::<Runtime>]
[pallet_im_online, ImOnline]
[pallet_sudo, Sudo]
[pallet_multisig, Multisig]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_scheduler, Scheduler]
[frame_system, SystemBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_transaction_payment, TransactionPayment]
[pallet_treasury, Treasury]
[pallet_utility, Utility]
);
}
pub struct BaseCallFilter; pub struct BaseCallFilter;
impl Contains<RuntimeCall> for BaseCallFilter { impl Contains<RuntimeCall> for BaseCallFilter {
...@@ -274,8 +235,6 @@ impl pallet_duniter_test_parameters::Config for Runtime { ...@@ -274,8 +235,6 @@ impl pallet_duniter_test_parameters::Config for Runtime {
type PeriodCount = Balance; type PeriodCount = Balance;
type SessionCount = u32; type SessionCount = u32;
} }
#[cfg(feature = "runtime-benchmarks")]
type WorstOrigin = RawOrigin<AccountId, TechnicalCommitteeInstance>;
common_runtime::pallets_config!(); common_runtime::pallets_config!();
// Create the runtime by composing the pallets that were previously configured. // Create the runtime by composing the pallets that were previously configured.
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
extern crate frame_benchmarking;
pub mod parameters; pub mod parameters;
pub mod weights; pub mod weights;
...@@ -39,8 +35,6 @@ use frame_support::{traits::Contains, PalletId}; ...@@ -39,8 +35,6 @@ use frame_support::{traits::Contains, PalletId};
pub use frame_system::Call as SystemCall; pub use frame_system::Call as SystemCall;
use frame_system::EnsureRoot; use frame_system::EnsureRoot;
pub use pallet_balances::Call as BalancesCall; pub use pallet_balances::Call as BalancesCall;
#[cfg(feature = "runtime-benchmarks")]
pub use pallet_collective::RawOrigin;
use pallet_grandpa::{ use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
}; };
...@@ -137,39 +131,7 @@ pub type Executive = frame_executive::Executive< ...@@ -137,39 +131,7 @@ pub type Executive = frame_executive::Executive<
pub type TechnicalCommitteeInstance = Instance2; pub type TechnicalCommitteeInstance = Instance2;
#[cfg(feature = "runtime-benchmarks")] common_runtime::benchmarks_config!();
mod benches {
define_benchmarks!(
[pallet_certification, Certification]
[pallet_distance, Distance]
[pallet_oneshot_account, OneshotAccount]
[pallet_universal_dividend, UniversalDividend]
[pallet_provide_randomness, ProvideRandomness]
[pallet_upgrade_origin, UpgradeOrigin]
[pallet_duniter_account, Account]
[pallet_identity, Identity]
[pallet_membership, Membership]
[pallet_smith_members, SmithMembers]
[pallet_authority_members, AuthorityMembers]
// Substrate
[frame_system_extensions, SystemExtensionsBench::<Runtime>]
[pallet_balances, Balances]
[frame_benchmarking::baseline, Baseline::<Runtime>]
[pallet_collective, TechnicalCommittee]
[pallet_session, SessionBench::<Runtime>]
[pallet_im_online, ImOnline]
[pallet_multisig, Multisig]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_sudo, Sudo]
[pallet_scheduler, Scheduler]
[frame_system, SystemBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_transaction_payment, TransactionPayment]
[pallet_treasury, Treasury]
[pallet_utility, Utility]
);
}
pub struct BaseCallFilter; pub struct BaseCallFilter;
impl Contains<RuntimeCall> for BaseCallFilter { impl Contains<RuntimeCall> for BaseCallFilter {
...@@ -239,8 +201,6 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType { ...@@ -239,8 +201,6 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
} }
// Configure pallets to include in runtime. // Configure pallets to include in runtime.
#[cfg(feature = "runtime-benchmarks")]
type WorstOrigin = RawOrigin<AccountId, TechnicalCommitteeInstance>;
common_runtime::pallets_config!(); common_runtime::pallets_config!();
// Create the runtime by composing the pallets that were previously configured. // Create the runtime by composing the pallets that were previously configured.
......
imports_granularity = "Crate" imports_granularity = "Crate"
reorder_impl_items = true reorder_impl_items = true
error_on_unformatted = true error_on_unformatted = true
format_macro_matchers = true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment