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

fix #252

parent f6f32eca
No related branches found
No related tags found
1 merge request!314Set correct treasury spend origin
Pipeline #39812 passed
...@@ -20,8 +20,7 @@ use crate::chain_spec::gen_genesis_data::{ ...@@ -20,8 +20,7 @@ use crate::chain_spec::gen_genesis_data::{
}; };
use common_runtime::{constants::*, entities::IdtyData, GenesisIdty}; use common_runtime::{constants::*, entities::IdtyData, GenesisIdty};
use g1_runtime::{ use g1_runtime::{
opaque::SessionKeys, pallet_universal_dividend, parameters, Runtime, RuntimeGenesisConfig, opaque::SessionKeys, pallet_universal_dividend, parameters, Runtime, WASM_BINARY,
WASM_BINARY,
}; };
use sc_service::ChainType; use sc_service::ChainType;
use serde::Deserialize; use serde::Deserialize;
......
...@@ -398,7 +398,7 @@ macro_rules! pallets_config { ...@@ -398,7 +398,7 @@ macro_rules! pallets_config {
type RejectOrigin = TreasuryRejectOrigin; type RejectOrigin = TreasuryRejectOrigin;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type SpendFunds = TreasurySpendFunds<Self>; type SpendFunds = TreasurySpendFunds<Self>;
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>; type SpendOrigin = TreasuryApproveOrigin;
type SpendPeriod = SpendPeriod; type SpendPeriod = SpendPeriod;
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>; type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
} }
......
...@@ -16,7 +16,10 @@ ...@@ -16,7 +16,10 @@
use crate::*; use crate::*;
use common_runtime::{constants::*, Moment}; use common_runtime::{constants::*, Moment};
use frame_support::{parameter_types, weights::constants::WEIGHT_REF_TIME_PER_SECOND}; use frame_support::{
parameter_types, traits::EitherOfDiverse, weights::constants::WEIGHT_REF_TIME_PER_SECOND,
};
use frame_system::EnsureWithSuccess;
use sp_runtime::transaction_validity::TransactionPriority; use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! { parameter_types! {
...@@ -146,10 +149,17 @@ parameter_types! { ...@@ -146,10 +149,17 @@ parameter_types! {
// Multisig // Multisig
parameter_types! { parameter_types! {
pub const MaxSignatories: u16 = 10; pub const MaxSignatories: u16 = 10;
pub const MaxBalance: Balance = Balance::MAX;
} }
// Treasury // Treasury
pub type TreasuryApproveOrigin = pub type TreasuryApproveOrigin = EnsureWithSuccess<
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 2>; EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 2>,
>,
AccountId,
MaxBalance,
>; // Root is needed for benchmarking
pub type TreasuryRejectOrigin = pub type TreasuryRejectOrigin =
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 3>; pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 3>;
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
//! Autogenerated weights for `pallet_treasury` //! Autogenerated weights for `pallet_treasury`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-01-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2025-02-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F` //! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// --genesis-builder=spec-genesis // --genesis-builder=spec-genesis
// --steps=50 // --steps=50
// --repeat=20 // --repeat=20
// --pallet=* // --pallet=pallet_treasury
// --extrinsic=* // --extrinsic=*
// --wasm-execution=compiled // --wasm-execution=compiled
// --heap-pages=4096 // --heap-pages=4096
...@@ -47,24 +47,33 @@ use core::marker::PhantomData; ...@@ -47,24 +47,33 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_treasury`. /// Weight functions for `pallet_treasury`.
pub struct WeightInfo<T>(PhantomData<T>); pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> { impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
/// Storage: `Treasury::ProposalCount` (r:1 w:1)
/// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Proposals` (r:0 w:1)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
fn spend_local() -> Weight { fn spend_local() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `0` // Measured: `6`
// Estimated: `0` // Estimated: `1887`
// Minimum execution time: 0_000 picoseconds. // Minimum execution time: 12_816_000 picoseconds.
Weight::from_parts(0, 0) Weight::from_parts(17_705_000, 0)
.saturating_add(Weight::from_parts(0, 0)) .saturating_add(Weight::from_parts(0, 1887))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
} }
/// Storage: `Treasury::Approvals` (r:1 w:0) /// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
fn remove_approval() -> Weight { fn remove_approval() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `90`
// Estimated: `1887` // Estimated: `1887`
// Minimum execution time: 3_556_000 picoseconds. // Minimum execution time: 6_252_000 picoseconds.
Weight::from_parts(3_805_000, 0) Weight::from_parts(8_521_000, 0)
.saturating_add(Weight::from_parts(0, 1887)) .saturating_add(Weight::from_parts(0, 1887))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: `System::Account` (r:1 w:0) /// Storage: `System::Account` (r:1 w:0)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`)
...@@ -75,55 +84,66 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> { ...@@ -75,55 +84,66 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
/// The range of component `p` is `[0, 99]`. /// The range of component `p` is `[0, 99]`.
fn on_initialize_proposals(p: u32, ) -> Weight { fn on_initialize_proposals(p: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `82 + p * (1 ±0)` // Measured: `173 + p * (1 ±0)`
// Estimated: `3558` // Estimated: `3558`
// Minimum execution time: 11_461_000 picoseconds. // Minimum execution time: 11_412_000 picoseconds.
Weight::from_parts(12_397_435, 0) Weight::from_parts(15_421_603, 0)
.saturating_add(Weight::from_parts(0, 3558)) .saturating_add(Weight::from_parts(0, 3558))
// Standard Error: 376 // Standard Error: 1_811
.saturating_add(Weight::from_parts(20_402, 0).saturating_mul(p.into())) .saturating_add(Weight::from_parts(41_456, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes(2))
} }
/// Storage: `Treasury::SpendCount` (r:1 w:1)
/// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Spends` (r:0 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn spend() -> Weight { fn spend() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `0` // Measured: `6`
// Estimated: `0` // Estimated: `1489`
// Minimum execution time: 0_000 picoseconds. // Minimum execution time: 9_147_000 picoseconds.
Weight::from_parts(0, 0) Weight::from_parts(9_483_000, 0)
.saturating_add(Weight::from_parts(0, 0)) .saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`)
fn payout() -> Weight { fn payout() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `179`
// Estimated: `3526` // Estimated: `6126`
// Minimum execution time: 4_855_000 picoseconds. // Minimum execution time: 42_637_000 picoseconds.
Weight::from_parts(5_244_000, 0) Weight::from_parts(46_638_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 6126))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn check_status() -> Weight { fn check_status() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `116`
// Estimated: `3526` // Estimated: `3526`
// Minimum execution time: 4_857_000 picoseconds. // Minimum execution time: 10_962_000 picoseconds.
Weight::from_parts(5_162_000, 0) Weight::from_parts(11_678_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 3526))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn void_spend() -> Weight { fn void_spend() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `116`
// Estimated: `3526` // Estimated: `3526`
// Minimum execution time: 4_559_000 picoseconds. // Minimum execution time: 10_355_000 picoseconds.
Weight::from_parts(4_803_000, 0) Weight::from_parts(11_353_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 3526))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
} }
...@@ -19,6 +19,7 @@ use common_runtime::constants::*; ...@@ -19,6 +19,7 @@ use common_runtime::constants::*;
use frame_support::{ use frame_support::{
parameter_types, traits::EitherOfDiverse, weights::constants::WEIGHT_REF_TIME_PER_SECOND, parameter_types, traits::EitherOfDiverse, weights::constants::WEIGHT_REF_TIME_PER_SECOND,
}; };
use frame_system::EnsureWithSuccess;
use sp_runtime::transaction_validity::TransactionPriority; use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! { parameter_types! {
...@@ -108,12 +109,17 @@ frame_support::parameter_types! { ...@@ -108,12 +109,17 @@ frame_support::parameter_types! {
// Multisig // Multisig
parameter_types! { parameter_types! {
pub const MaxSignatories: u16 = 10; pub const MaxSignatories: u16 = 10;
pub const MaxBalance: Balance = Balance::MAX;
} }
// Treasury // Treasury
pub type TreasuryApproveOrigin = EitherOfDiverse< pub type TreasuryApproveOrigin = EnsureWithSuccess<
EnsureRoot<AccountId>, EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 2>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 2>,
>,
AccountId,
MaxBalance,
>; // Root is needed for benchmarking >; // Root is needed for benchmarking
pub type TreasuryRejectOrigin = pub type TreasuryRejectOrigin =
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 3>; pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 3>;
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
//! Autogenerated weights for `pallet_treasury` //! Autogenerated weights for `pallet_treasury`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-01-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2025-02-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F` //! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// --genesis-builder=spec-genesis // --genesis-builder=spec-genesis
// --steps=50 // --steps=50
// --repeat=20 // --repeat=20
// --pallet=* // --pallet=pallet_treasury
// --extrinsic=* // --extrinsic=*
// --wasm-execution=compiled // --wasm-execution=compiled
// --heap-pages=4096 // --heap-pages=4096
...@@ -47,24 +47,33 @@ use core::marker::PhantomData; ...@@ -47,24 +47,33 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_treasury`. /// Weight functions for `pallet_treasury`.
pub struct WeightInfo<T>(PhantomData<T>); pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> { impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
/// Storage: `Treasury::ProposalCount` (r:1 w:1)
/// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Proposals` (r:0 w:1)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
fn spend_local() -> Weight { fn spend_local() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `0` // Measured: `6`
// Estimated: `0` // Estimated: `1887`
// Minimum execution time: 0_000 picoseconds. // Minimum execution time: 10_391_000 picoseconds.
Weight::from_parts(0, 0) Weight::from_parts(11_591_000, 0)
.saturating_add(Weight::from_parts(0, 0)) .saturating_add(Weight::from_parts(0, 1887))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
} }
/// Storage: `Treasury::Approvals` (r:1 w:0) /// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
fn remove_approval() -> Weight { fn remove_approval() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `90`
// Estimated: `1887` // Estimated: `1887`
// Minimum execution time: 3_605_000 picoseconds. // Minimum execution time: 5_672_000 picoseconds.
Weight::from_parts(3_896_000, 0) Weight::from_parts(5_892_000, 0)
.saturating_add(Weight::from_parts(0, 1887)) .saturating_add(Weight::from_parts(0, 1887))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: `System::Account` (r:1 w:0) /// Storage: `System::Account` (r:1 w:0)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`)
...@@ -75,55 +84,66 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> { ...@@ -75,55 +84,66 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
/// The range of component `p` is `[0, 99]`. /// The range of component `p` is `[0, 99]`.
fn on_initialize_proposals(p: u32, ) -> Weight { fn on_initialize_proposals(p: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `82 + p * (1 ±0)` // Measured: `173 + p * (1 ±0)`
// Estimated: `3558` // Estimated: `3558`
// Minimum execution time: 10_805_000 picoseconds. // Minimum execution time: 11_705_000 picoseconds.
Weight::from_parts(12_178_298, 0) Weight::from_parts(14_836_921, 0)
.saturating_add(Weight::from_parts(0, 3558)) .saturating_add(Weight::from_parts(0, 3558))
// Standard Error: 476 // Standard Error: 1_697
.saturating_add(Weight::from_parts(26_138, 0).saturating_mul(p.into())) .saturating_add(Weight::from_parts(47_143, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes(2))
} }
/// Storage: `Treasury::SpendCount` (r:1 w:1)
/// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Spends` (r:0 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn spend() -> Weight { fn spend() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `0` // Measured: `6`
// Estimated: `0` // Estimated: `1489`
// Minimum execution time: 0_000 picoseconds. // Minimum execution time: 9_047_000 picoseconds.
Weight::from_parts(0, 0) Weight::from_parts(9_641_000, 0)
.saturating_add(Weight::from_parts(0, 0)) .saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`)
fn payout() -> Weight { fn payout() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `179`
// Estimated: `3526` // Estimated: `6126`
// Minimum execution time: 4_499_000 picoseconds. // Minimum execution time: 44_565_000 picoseconds.
Weight::from_parts(4_892_000, 0) Weight::from_parts(46_238_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 6126))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn check_status() -> Weight { fn check_status() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `116`
// Estimated: `3526` // Estimated: `3526`
// Minimum execution time: 4_644_000 picoseconds. // Minimum execution time: 10_752_000 picoseconds.
Weight::from_parts(4_823_000, 0) Weight::from_parts(11_997_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 3526))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn void_spend() -> Weight { fn void_spend() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `116`
// Estimated: `3526` // Estimated: `3526`
// Minimum execution time: 4_098_000 picoseconds. // Minimum execution time: 9_980_000 picoseconds.
Weight::from_parts(4_374_000, 0) Weight::from_parts(10_455_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 3526))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
} }
...@@ -16,7 +16,10 @@ ...@@ -16,7 +16,10 @@
use crate::*; use crate::*;
use common_runtime::constants::*; use common_runtime::constants::*;
use frame_support::{parameter_types, weights::constants::WEIGHT_REF_TIME_PER_SECOND}; use frame_support::{
parameter_types, traits::EitherOfDiverse, weights::constants::WEIGHT_REF_TIME_PER_SECOND,
};
use frame_system::EnsureWithSuccess;
use sp_runtime::transaction_validity::TransactionPriority; use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! { parameter_types! {
...@@ -138,10 +141,17 @@ parameter_types! { ...@@ -138,10 +141,17 @@ parameter_types! {
// Multisig // Multisig
parameter_types! { parameter_types! {
pub const MaxSignatories: u16 = 10; pub const MaxSignatories: u16 = 10;
pub const MaxBalance: Balance = Balance::MAX;
} }
// Treasury // Treasury
pub type TreasuryApproveOrigin = pub type TreasuryApproveOrigin = EnsureWithSuccess<
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 2>; EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 2>,
>,
AccountId,
MaxBalance,
>; // Root is needed for benchmarking
pub type TreasuryRejectOrigin = pub type TreasuryRejectOrigin =
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 3>; pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCommitteeInstance, 1, 3>;
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
//! Autogenerated weights for `pallet_treasury` //! Autogenerated weights for `pallet_treasury`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-01-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2025-02-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F` //! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// --genesis-builder=spec-genesis // --genesis-builder=spec-genesis
// --steps=50 // --steps=50
// --repeat=20 // --repeat=20
// --pallet=* // --pallet=pallet_treasury
// --extrinsic=* // --extrinsic=*
// --wasm-execution=compiled // --wasm-execution=compiled
// --heap-pages=4096 // --heap-pages=4096
...@@ -47,24 +47,33 @@ use core::marker::PhantomData; ...@@ -47,24 +47,33 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_treasury`. /// Weight functions for `pallet_treasury`.
pub struct WeightInfo<T>(PhantomData<T>); pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> { impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
/// Storage: `Treasury::ProposalCount` (r:1 w:1)
/// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Proposals` (r:0 w:1)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
fn spend_local() -> Weight { fn spend_local() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `0` // Measured: `6`
// Estimated: `0` // Estimated: `1887`
// Minimum execution time: 0_000 picoseconds. // Minimum execution time: 10_200_000 picoseconds.
Weight::from_parts(0, 0) Weight::from_parts(11_023_000, 0)
.saturating_add(Weight::from_parts(0, 0)) .saturating_add(Weight::from_parts(0, 1887))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
} }
/// Storage: `Treasury::Approvals` (r:1 w:0) /// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
fn remove_approval() -> Weight { fn remove_approval() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `90`
// Estimated: `1887` // Estimated: `1887`
// Minimum execution time: 3_447_000 picoseconds. // Minimum execution time: 6_002_000 picoseconds.
Weight::from_parts(3_621_000, 0) Weight::from_parts(6_292_000, 0)
.saturating_add(Weight::from_parts(0, 1887)) .saturating_add(Weight::from_parts(0, 1887))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: `System::Account` (r:1 w:0) /// Storage: `System::Account` (r:1 w:0)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`)
...@@ -75,55 +84,66 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> { ...@@ -75,55 +84,66 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
/// The range of component `p` is `[0, 99]`. /// The range of component `p` is `[0, 99]`.
fn on_initialize_proposals(p: u32, ) -> Weight { fn on_initialize_proposals(p: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `82 + p * (1 ±0)` // Measured: `173 + p * (1 ±0)`
// Estimated: `3558` // Estimated: `3558`
// Minimum execution time: 10_682_000 picoseconds. // Minimum execution time: 11_741_000 picoseconds.
Weight::from_parts(12_020_888, 0) Weight::from_parts(14_618_792, 0)
.saturating_add(Weight::from_parts(0, 3558)) .saturating_add(Weight::from_parts(0, 3558))
// Standard Error: 417 // Standard Error: 946
.saturating_add(Weight::from_parts(22_993, 0).saturating_mul(p.into())) .saturating_add(Weight::from_parts(39_436, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes(2))
} }
/// Storage: `Treasury::SpendCount` (r:1 w:1)
/// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Spends` (r:0 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn spend() -> Weight { fn spend() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `0` // Measured: `6`
// Estimated: `0` // Estimated: `1489`
// Minimum execution time: 0_000 picoseconds. // Minimum execution time: 9_166_000 picoseconds.
Weight::from_parts(0, 0) Weight::from_parts(9_685_000, 0)
.saturating_add(Weight::from_parts(0, 0)) .saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`)
fn payout() -> Weight { fn payout() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `179`
// Estimated: `3526` // Estimated: `6126`
// Minimum execution time: 4_535_000 picoseconds. // Minimum execution time: 44_377_000 picoseconds.
Weight::from_parts(4_862_000, 0) Weight::from_parts(46_847_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 6126))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn check_status() -> Weight { fn check_status() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `116`
// Estimated: `3526` // Estimated: `3526`
// Minimum execution time: 4_604_000 picoseconds. // Minimum execution time: 10_849_000 picoseconds.
Weight::from_parts(4_766_000, 0) Weight::from_parts(11_380_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 3526))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: `Treasury::Spends` (r:1 w:0) /// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
fn void_spend() -> Weight { fn void_spend() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `6` // Measured: `116`
// Estimated: `3526` // Estimated: `3526`
// Minimum execution time: 4_143_000 picoseconds. // Minimum execution time: 9_761_000 picoseconds.
Weight::from_parts(4_415_000, 0) Weight::from_parts(10_219_000, 0)
.saturating_add(Weight::from_parts(0, 3526)) .saturating_add(Weight::from_parts(0, 3526))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment