diff --git a/pallets/emission0/src/weights.rs b/pallets/emission0/src/weights.rs index ad60a2d..0006f3f 100644 --- a/pallets/emission0/src/weights.rs +++ b/pallets/emission0/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for `pallet_emission0` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0 -//! DATE: 2025-01-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `Luizs-MacBook-Pro.local`, CPU: `` +//! HOSTNAME: `MacBook-Pro-de-Joao.local`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: @@ -64,8 +64,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `339` // Estimated: `7638` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(26_000_000, 7638) + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(34_000_000, 7638) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -77,8 +77,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `168` // Estimated: `7638` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 7638) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 7638) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -88,8 +88,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `199` // Estimated: `3529` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 3529) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 3529) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -115,8 +115,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `339` // Estimated: `7638` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(26_000_000, 7638) + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(34_000_000, 7638) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -128,8 +128,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `168` // Estimated: `7638` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 7638) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 7638) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -139,8 +139,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `199` // Estimated: `3529` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 3529) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 3529) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/pallets/governance/src/benchmarks.rs b/pallets/governance/src/benchmarks.rs index ce2b886..9e514b1 100644 --- a/pallets/governance/src/benchmarks.rs +++ b/pallets/governance/src/benchmarks.rs @@ -203,4 +203,13 @@ benchmarks! { let _ = ::Currency::deposit_creating(&module_key, cost); }: _(RawOrigin::Signed(module_key.clone()), Percent::from_parts(40), Percent::from_parts(40), data) + + set_root_curator { + let module_key: T::AccountId = account("ModuleKey", 0, 2); + }: _(RawOrigin::Root, module_key) + + remove_root_curator { + }: _(RawOrigin::Root) + + } diff --git a/pallets/governance/src/lib.rs b/pallets/governance/src/lib.rs index 4a70814..65a6858 100644 --- a/pallets/governance/src/lib.rs +++ b/pallets/governance/src/lib.rs @@ -35,6 +35,7 @@ use polkadot_sdk::sp_std::vec::Vec; #[frame::pallet] pub mod pallet { #![allow(clippy::too_many_arguments)] + use frame::prelude::ensure_signed_or_root; use proposal::GlobalParamsData; use weights::WeightInfo; @@ -71,6 +72,9 @@ pub mod pallet { #[pallet::storage] pub type Whitelist = StorageMap<_, Identity, AccountIdOf, ()>; + #[pallet::storage] + pub type RootCurator = StorageValue<_, AccountIdOf, OptionQuery>; + #[pallet::storage] pub type Curators = StorageMap<_, Identity, AccountIdOf, ()>; @@ -160,14 +164,20 @@ pub mod pallet { #[pallet::call_index(0)] #[pallet::weight((::WeightInfo::add_curator(), DispatchClass::Normal, Pays::Yes))] pub fn add_curator(origin: OriginFor, key: AccountIdOf) -> DispatchResult { - ensure_root(origin)?; + if ensure_signed_or_root(origin.clone())?.is_some() { + roles::ensure_root_curator::(origin)?; + } + roles::manage_role::>(key, true, Error::::AlreadyCurator) } #[pallet::call_index(1)] #[pallet::weight((::WeightInfo::remove_curator(), DispatchClass::Normal, Pays::Yes))] pub fn remove_curator(origin: OriginFor, key: AccountIdOf) -> DispatchResult { - ensure_root(origin)?; + if ensure_signed_or_root(origin.clone())?.is_some() { + roles::ensure_root_curator::(origin)?; + } + roles::manage_role::>(key, false, Error::::NotAllocator) } @@ -322,6 +332,20 @@ pub mod pallet { data, ) } + + #[pallet::call_index(18)] + #[pallet::weight((::WeightInfo::set_root_curator(), DispatchClass::Normal, Pays::No))] + pub fn set_root_curator(origin: OriginFor, key: AccountIdOf) -> DispatchResult { + ensure_root(origin)?; + roles::set_root_curator::(key) + } + + #[pallet::call_index(19)] + #[pallet::weight((::WeightInfo::remove_root_curator(), DispatchClass::Normal, Pays::No))] + pub fn remove_root_curator(origin: OriginFor) -> DispatchResult { + ensure_root(origin)?; + roles::remove_root_curator::() + } } #[pallet::event] @@ -408,6 +432,8 @@ pub mod pallet { NotEnoughBalanceToApply, /// The operation can only be performed by the curator. NotCurator, + /// The operation can only be performed by the root curator. + NotRootCurator, /// The application with the given ID was not found. ApplicationNotFound, /// The account is already whitelisted and cannot be added again. diff --git a/pallets/governance/src/roles.rs b/pallets/governance/src/roles.rs index f17e6fe..5546c8f 100644 --- a/pallets/governance/src/roles.rs +++ b/pallets/governance/src/roles.rs @@ -21,6 +21,16 @@ pub(super) fn manage_role, ()>>( Ok(()) } +pub fn set_root_curator(key: AccountIdOf) -> DispatchResult { + crate::RootCurator::::set(Some(key)); + Ok(()) +} + +pub fn remove_root_curator() -> DispatchResult { + crate::RootCurator::::set(None); + Ok(()) +} + pub fn penalize_agent(agent_key: AccountIdOf, percentage: u8) -> DispatchResult { let percentage = Percent::from_parts(percentage); if percentage > T::MaxPenaltyPercentage::get() { @@ -40,9 +50,18 @@ pub fn penalize_agent(agent_key: AccountIdOf, percentage: u8) -> D Ok(()) } +pub fn ensure_root_curator(origin: OriginFor) -> DispatchResult { + let key: AccountIdOf = ensure_signed(origin)?; + if crate::RootCurator::::get() != Some(key) { + return Err(Error::::NotRootCurator.into()); + } + + Ok(()) +} + pub fn ensure_curator(origin: OriginFor) -> DispatchResult { let key: AccountIdOf = ensure_signed(origin)?; - if !crate::Curators::::contains_key(key) { + if !crate::Curators::::contains_key(&key) && crate::RootCurator::::get() != Some(key) { return Err(Error::::NotCurator.into()); } diff --git a/pallets/governance/src/weights.rs b/pallets/governance/src/weights.rs index a45546d..d67decd 100644 --- a/pallets/governance/src/weights.rs +++ b/pallets/governance/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for `pallet_governance` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0 -//! DATE: 2025-01-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `Luizs-MacBook-Pro.local`, CPU: `` +//! HOSTNAME: `MacBook-Pro-de-Joao.local`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: @@ -56,6 +56,8 @@ pub trait WeightInfo { fn enable_vote_delegation() -> Weight; fn disable_vote_delegation() -> Weight; fn add_emission_proposal() -> Weight; + fn set_root_curator() -> Weight; + fn remove_root_curator() -> Weight; } /// Weights for `pallet_governance` using the Substrate node and recommended hardware. @@ -67,8 +69,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `6` // Estimated: `3497` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 3497) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 3497) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -78,8 +80,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `60` // Estimated: `3497` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 3497) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 3497) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +91,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `6` // Estimated: `3497` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 3497) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 3497) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -100,8 +102,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `62` // Estimated: `3497` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 3497) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 3497) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -115,8 +117,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `66` // Estimated: `3822` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 3822) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 3822) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -132,8 +134,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `130` // Estimated: `4314` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 4314) + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(24_000_000, 4314) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -149,8 +151,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3822` - // Minimum execution time: 32_000_000 picoseconds. - Weight::from_parts(33_000_000, 3822) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(46_000_000, 3822) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -166,8 +168,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `241` // Estimated: `3822` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(34_000_000, 3822) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(48_000_000, 3822) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -179,8 +181,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `189` // Estimated: `3822` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3822) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 3822) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -192,8 +194,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `170` // Estimated: `4314` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 4314) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 4314) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -207,8 +209,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3593` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 3593) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(40_000_000, 3593) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -222,8 +224,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3593` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 3593) + // Minimum execution time: 37_000_000 picoseconds. + Weight::from_parts(38_000_000, 3593) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -237,8 +239,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3593` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 3593) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(39_000_000, 3593) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -254,8 +256,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `316` // Estimated: `6100` - // Minimum execution time: 23_000_000 picoseconds. - Weight::from_parts(23_000_000, 6100) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(32_000_000, 6100) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -265,8 +267,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `216` // Estimated: `3464` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 3464) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 3464) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -276,8 +278,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `6` // Estimated: `1484` - // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(4_000_000, 1484) + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(5_000_000, 1484) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -287,8 +289,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `6` // Estimated: `1484` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(4_000_000, 1484) + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 1484) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -302,11 +304,31 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3593` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 3593) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(38_000_000, 3593) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: `Governance::RootCurator` (r:0 w:1) + /// Proof: `Governance::RootCurator` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn set_root_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Governance::RootCurator` (r:0 w:1) + /// Proof: `Governance::RootCurator` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn remove_root_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } // For backwards compatibility and tests. @@ -317,8 +339,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `6` // Estimated: `3497` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 3497) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 3497) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -328,8 +350,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `60` // Estimated: `3497` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 3497) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 3497) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -339,8 +361,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `6` // Estimated: `3497` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 3497) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 3497) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -350,8 +372,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `62` // Estimated: `3497` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 3497) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 3497) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -365,8 +387,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `66` // Estimated: `3822` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 3822) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 3822) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -382,8 +404,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `130` // Estimated: `4314` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 4314) + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(24_000_000, 4314) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -399,8 +421,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3822` - // Minimum execution time: 32_000_000 picoseconds. - Weight::from_parts(33_000_000, 3822) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(46_000_000, 3822) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -416,8 +438,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `241` // Estimated: `3822` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(34_000_000, 3822) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(48_000_000, 3822) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -429,8 +451,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `189` // Estimated: `3822` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3822) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 3822) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -442,8 +464,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `170` // Estimated: `4314` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 4314) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 4314) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -457,8 +479,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3593` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 3593) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(40_000_000, 3593) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -472,8 +494,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3593` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 3593) + // Minimum execution time: 37_000_000 picoseconds. + Weight::from_parts(38_000_000, 3593) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -487,8 +509,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3593` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 3593) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(39_000_000, 3593) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -504,8 +526,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `316` // Estimated: `6100` - // Minimum execution time: 23_000_000 picoseconds. - Weight::from_parts(23_000_000, 6100) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(32_000_000, 6100) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -515,8 +537,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `216` // Estimated: `3464` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 3464) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 3464) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -526,8 +548,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `6` // Estimated: `1484` - // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(4_000_000, 1484) + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(5_000_000, 1484) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -537,8 +559,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `6` // Estimated: `1484` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(4_000_000, 1484) + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 1484) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -552,9 +574,29 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `152` // Estimated: `3593` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 3593) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(38_000_000, 3593) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } + /// Storage: `Governance::RootCurator` (r:0 w:1) + /// Proof: `Governance::RootCurator` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn set_root_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `Governance::RootCurator` (r:0 w:1) + /// Proof: `Governance::RootCurator` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn remove_root_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } } diff --git a/pallets/governance/tests/curator.rs b/pallets/governance/tests/curator.rs index 866f620..ced325e 100644 --- a/pallets/governance/tests/curator.rs +++ b/pallets/governance/tests/curator.rs @@ -36,3 +36,23 @@ fn only_curators_can_whitelist() { ); }); } + +#[test] +fn only_root_curators_can_add_curator() { + new_test_ext().execute_with(|| { + let not_curator_key = 0; + let module_key = 1; + + assert_err!( + pallet_governance::Pallet::::add_curator(get_origin(not_curator_key), module_key), + Error::::NotRootCurator + ); + + let curator_key = 0; + pallet_governance::RootCurator::::set(Some(curator_key)); + assert_ok!(pallet_governance::Pallet::::add_curator( + get_origin(curator_key), + module_key + ),) + }); +} diff --git a/pallets/torus0/src/weights.rs b/pallets/torus0/src/weights.rs index 5171ec3..2d9b1b1 100644 --- a/pallets/torus0/src/weights.rs +++ b/pallets/torus0/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for `pallet_torus0` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0 -//! DATE: 2025-01-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `Luizs-MacBook-Pro.local`, CPU: `` +//! HOSTNAME: `MacBook-Pro-de-Joao.local`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: @@ -65,8 +65,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `234` // Estimated: `4314` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(34_000_000, 4314) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(46_000_000, 4314) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -86,8 +86,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `392` // Estimated: `4314` - // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(37_000_000, 4314) + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(52_000_000, 4314) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -107,8 +107,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `466` // Estimated: `7638` - // Minimum execution time: 61_000_000 picoseconds. - Weight::from_parts(62_000_000, 7638) + // Minimum execution time: 85_000_000 picoseconds. + Weight::from_parts(87_000_000, 7638) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `68` // Estimated: `7638` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(25_000_000, 7638) + // Minimum execution time: 34_000_000 picoseconds. + Weight::from_parts(35_000_000, 7638) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -151,8 +151,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `94` // Estimated: `4314` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 4314) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 4314) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -168,8 +168,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `110` // Estimated: `4314` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 4314) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 4314) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -193,8 +193,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `234` // Estimated: `4314` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(34_000_000, 4314) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(46_000_000, 4314) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -214,8 +214,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `392` // Estimated: `4314` - // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(37_000_000, 4314) + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(52_000_000, 4314) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -235,8 +235,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `466` // Estimated: `7638` - // Minimum execution time: 61_000_000 picoseconds. - Weight::from_parts(62_000_000, 7638) + // Minimum execution time: 85_000_000 picoseconds. + Weight::from_parts(87_000_000, 7638) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -266,8 +266,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `68` // Estimated: `7638` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(25_000_000, 7638) + // Minimum execution time: 34_000_000 picoseconds. + Weight::from_parts(35_000_000, 7638) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -279,8 +279,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `94` // Estimated: `4314` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 4314) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 4314) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -296,8 +296,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `110` // Estimated: `4314` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 4314) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 4314) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) }