diff --git a/Cargo.lock b/Cargo.lock index b9058574a2b4d8bf3b952586abcc8136d85d15bb..9799a0f044b1726e5d1a8221f639c080ed613958 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -877,6 +877,7 @@ dependencies = [ "pallet-babe", "pallet-balances", "pallet-certification", + "pallet-collective", "pallet-duniter-account", "pallet-duniter-wot", "pallet-grandpa", diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index d8c9c65bafc03a11a50341db39a3b3f6b478172d..951feb975ee9402a365a57d74be3594bf7720317 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -15,6 +15,7 @@ runtime-benchmarks = [ "pallet-babe/runtime-benchmarks", 'pallet-balances/runtime-benchmarks', 'pallet-certification/runtime-benchmarks', + 'pallet-collective/runtime-benchmarks', 'pallet-duniter-wot/runtime-benchmarks', 'pallet-identity/runtime-benchmarks', 'pallet-membership/runtime-benchmarks', @@ -91,6 +92,7 @@ frame-support = { git = 'https://github.com/duniter/substrate', branch = 'dunite frame-system = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false } pallet-babe = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false } pallet-balances = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false } +pallet-collective = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false } pallet-grandpa = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false } pallet-im-online = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false } pallet-multisig = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false } diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index c2bd72e0a82dd423d606b05d4c4dba4b9c9c5c90..b802f3070c11319141eefa4caee397cc311c252b 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -533,8 +533,11 @@ macro_rules! pallets_config { type MotionDuration = TechnicalCommitteeMotionDuration; type MaxProposals = frame_support::pallet_prelude::ConstU32<20>; type MaxMembers = frame_support::pallet_prelude::ConstU32<100>; + type WeightInfo = common_runtime::weights::pallet_collective::WeightInfo<Runtime>; + #[cfg(not(feature = "runtime-benchmarks"))] type DefaultVote = TechnicalCommitteeDefaultVote; - type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>; + #[cfg(feature = "runtime-benchmarks")] + type DefaultVote = pallet_collective::PrimeDefaultVote; // Overwrite with a default vote that can return `true` sometimes as it is necessary for benchmarking } }; } diff --git a/runtime/common/src/weights.rs b/runtime/common/src/weights.rs index 531717247100931223aa02ed207a3dcd0c5d5558..efdf94c4292664c8ae4856861e57ed12eb7da728 100644 --- a/runtime/common/src/weights.rs +++ b/runtime/common/src/weights.rs @@ -23,6 +23,7 @@ pub mod block_weights; pub mod frame_system; pub mod pallet_babe; pub mod pallet_balances; +pub mod pallet_collective; pub mod pallet_grandpa; pub mod pallet_im_online; pub mod pallet_multisig; diff --git a/runtime/common/src/weights/pallet_collective.rs b/runtime/common/src/weights/pallet_collective.rs new file mode 100644 index 0000000000000000000000000000000000000000..06b8d3a8f7763395fb75f34e4449adbbb1c25f1c --- /dev/null +++ b/runtime/common/src/weights/pallet_collective.rs @@ -0,0 +1,196 @@ +// Copyright 2021-2022 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/>. + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-04-29, STEPS: `5`, REPEAT: 2, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `benjamin-xps139380`, CPU: `Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// target/release/duniter +// benchmark +// pallet +// --chain=dev +// --steps=5 +// --repeat=2 +// --pallet=pallet_collective +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/common/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo<T>(PhantomData<T>); +impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> { + // Storage: TechnicalCommittee Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:0 w:1) + // Storage: TechnicalCommittee Voting (r:20 w:20) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 20]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 117_409 nanoseconds. + Weight::from_ref_time(117_409_000 as u64) + // Standard Error: 967_384 + .saturating_add(Weight::from_ref_time(5_314_373 as u64).saturating_mul(m as u64)) + // Standard Error: 4_836_923 + .saturating_add(Weight::from_ref_time(25_325_026 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(p as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + /// The range of component `b` is `[1, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 83_565 nanoseconds. + Weight::from_ref_time(95_367_623 as u64) + // Standard Error: 23_211 + .saturating_add(Weight::from_ref_time(51_015 as u64).saturating_mul(b as u64)) + // Standard Error: 239_004 + .saturating_add(Weight::from_ref_time(90_067 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:0) + /// The range of component `b` is `[1, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 92_863 nanoseconds. + Weight::from_ref_time(103_223_869 as u64) + // Standard Error: 31_713 + .saturating_add(Weight::from_ref_time(33_486 as u64).saturating_mul(b as u64)) + // Standard Error: 326_544 + .saturating_add(Weight::from_ref_time(526_966 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalCount (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + /// The range of component `b` is `[1, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 20]`. + fn propose_proposed(b: u32, m: u32, _p: u32, ) -> Weight { + // Minimum execution time: 128_970 nanoseconds. + Weight::from_ref_time(139_202_954 as u64) + // Standard Error: 40_122 + .saturating_add(Weight::from_ref_time(54_685 as u64).saturating_mul(b as u64)) + // Standard Error: 418_110 + .saturating_add(Weight::from_ref_time(301_028 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + fn vote(m: u32, ) -> Weight { + // Minimum execution time: 115_665 nanoseconds. + Weight::from_ref_time(208_489_321 as u64) + // Standard Error: 784_058 + .saturating_add(Weight::from_ref_time(84_836 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 20]`. + fn close_early_disapproved(_m: u32, p: u32, ) -> Weight { + // Minimum execution time: 120_835 nanoseconds. + Weight::from_ref_time(158_562_516 as u64) + // Standard Error: 2_851_904 + .saturating_add(Weight::from_ref_time(6_278_723 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[1, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 20]`. + fn close_early_approved(_b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 185_843 nanoseconds. + Weight::from_ref_time(313_702_045 as u64) + // Standard Error: 2_202_892 + .saturating_add(Weight::from_ref_time(937_341 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 20]`. + fn close_disapproved(_m: u32, p: u32, ) -> Weight { + // Minimum execution time: 139_843 nanoseconds. + Weight::from_ref_time(205_739_344 as u64) + // Standard Error: 2_524_168 + .saturating_add(Weight::from_ref_time(578_197 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[1, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 20]`. + fn close_approved(_b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 185_344 nanoseconds. + Weight::from_ref_time(149_598_371 as u64) + // Standard Error: 537_639 + .saturating_add(Weight::from_ref_time(542_924 as u64).saturating_mul(m as u64)) + // Standard Error: 2_658_416 + .saturating_add(Weight::from_ref_time(3_783_404 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 20]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Minimum execution time: 79_294 nanoseconds. + Weight::from_ref_time(105_208_697 as u64) + // Standard Error: 1_319_396 + .saturating_add(Weight::from_ref_time(641_804 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } +} diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index 1c8e38c204ca1b00687b4a70a091387779ac9c9a..a96c9b659c635e346f8aa5241f4b98f4ed7d6241 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -153,7 +153,7 @@ mod benches { // Substrate [pallet_balances, Balances] [frame_benchmarking::baseline, Baseline::<Runtime>] - //[pallet_collective, TechnicalCommittee] FIXME + [pallet_collective, TechnicalCommittee] //[pallet_session, TransactionPayment] FIXME [pallet_im_online, ImOnline] [pallet_multisig, Multisig]