diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index 3ee1994b388df920b543764026c1180b3313cabd..c2bd72e0a82dd423d606b05d4c4dba4b9c9c5c90 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -393,7 +393,7 @@ macro_rules! pallets_config { type SpendFunds = TreasurySpendFunds<Self>; type SpendPeriod = SpendPeriod; type SpendOrigin = frame_support::traits::NeverEnsureOrigin<u64>; - type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>; + type WeightInfo = common_runtime::weights::pallet_treasury::WeightInfo<Runtime>; } // UNIVERSAL DIVIDEND // diff --git a/runtime/common/src/weights.rs b/runtime/common/src/weights.rs index c707c56a84091d7e9a655fc371b0c69af9142e2f..531717247100931223aa02ed207a3dcd0c5d5558 100644 --- a/runtime/common/src/weights.rs +++ b/runtime/common/src/weights.rs @@ -29,6 +29,7 @@ pub mod pallet_multisig; pub mod pallet_proxy; pub mod pallet_scheduler; pub mod pallet_timestamp; +pub mod pallet_treasury; pub mod pallet_universal_dividend; pub mod pallet_upgrade_origin; pub mod pallet_provide_randomness; diff --git a/runtime/common/src/weights/pallet_treasury.rs b/runtime/common/src/weights/pallet_treasury.rs new file mode 100644 index 0000000000000000000000000000000000000000..38bf975016f57e6942ee006e3dfce2c35319039c --- /dev/null +++ b/runtime/common/src/weights/pallet_treasury.rs @@ -0,0 +1,102 @@ +// 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_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-04-28, STEPS: `50`, REPEAT: 20, 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=50 +// --repeat=20 +// --pallet=pallet_treasury +// --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_treasury`. +pub struct WeightInfo<T>(PhantomData<T>); +impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> { + fn spend() -> Weight { + // Minimum execution time: 1_146 nanoseconds. + Weight::from_ref_time(1_428_000 as u64) + } + // Storage: Treasury ProposalCount (r:1 w:1) + // Storage: Treasury Proposals (r:0 w:1) + fn propose_spend() -> Weight { + // Minimum execution time: 158_571 nanoseconds. + Weight::from_ref_time(163_129_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn reject_proposal() -> Weight { + // Minimum execution time: 226_104 nanoseconds. + Weight::from_ref_time(249_137_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Treasury Proposals (r:1 w:0) + // Storage: Treasury Approvals (r:1 w:1) + /// The range of component `p` is `[0, 99]`. + fn approve_proposal(p: u32, ) -> Weight { + // Minimum execution time: 57_029 nanoseconds. + Weight::from_ref_time(90_162_378 as u64) + // Standard Error: 40_171 + .saturating_add(Weight::from_ref_time(757_294 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Treasury Approvals (r:1 w:1) + fn remove_approval() -> Weight { + // Minimum execution time: 53_325 nanoseconds. + Weight::from_ref_time(67_475_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Treasury Approvals (r:1 w:1) + // Storage: Treasury Proposals (r:2 w:2) + // Storage: System Account (r:4 w:4) + // Storage: Account PendingNewAccounts (r:0 w:2) + /// The range of component `p` is `[0, 100]`. + fn on_initialize_proposals(p: u32, ) -> Weight { + // Minimum execution time: 109_965 nanoseconds. + Weight::from_ref_time(118_648_000 as u64) + // Standard Error: 1_429_278 + .saturating_add(Weight::from_ref_time(164_690_636 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(p as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((4 as u64).saturating_mul(p as u64))) + } +} diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index 8b109b04bc409a34ac5456790db56eb9b6f37c17..1c8e38c204ca1b00687b4a70a091387779ac9c9a 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -162,7 +162,7 @@ mod benches { [pallet_scheduler, Scheduler] [frame_system, SystemBench::<Runtime>] [pallet_timestamp, Timestamp] - //[pallet_treasury, Treasury] FIXME + [pallet_treasury, Treasury] [pallet_utility, Utility] ); } diff --git a/runtime/gdev/src/parameters.rs b/runtime/gdev/src/parameters.rs index 9c23a138628d2c4b42c8e0a0b20c5b29268d0246..f43402dc31a6e576e2268c8586e34b6435f8b73a 100644 --- a/runtime/gdev/src/parameters.rs +++ b/runtime/gdev/src/parameters.rs @@ -18,6 +18,7 @@ use crate::*; use common_runtime::constants::*; use common_runtime::{Balance, BlockNumber}; use frame_support::parameter_types; +use frame_support::traits::EitherOfDiverse; use frame_support::weights::constants::WEIGHT_PER_SECOND; use sp_arithmetic::Perbill; use sp_runtime::transaction_validity::TransactionPriority; @@ -99,7 +100,9 @@ parameter_types! { } // Treasury -pub type TreasuryApproveOrigin = - pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 2>; +pub type TreasuryApproveOrigin = EitherOfDiverse< + EnsureRoot<AccountId>, + pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 2>, +>; // Root is needed for benchmarking pub type TreasuryRejectOrigin = pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 3>;