Skip to content
Snippets Groups Projects
Commit cee99a32 authored by bgallois's avatar bgallois Committed by Hugo Trentesaux
Browse files

fix(pallet_treasury): fix parameters for benchmark

parent 5bef1a14
No related branches found
No related tags found
1 merge request!156Substrate pallets benchmark
......@@ -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 //
......
......@@ -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;
......
// 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)))
}
}
......@@ -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]
);
}
......
......@@ -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>;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment