diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/ambassador/mod.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/ambassador/mod.rs index 478fb65e018d..a052a9d3800c 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/ambassador/mod.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/ambassador/mod.rs @@ -220,6 +220,7 @@ impl pallet_core_fellowship::Config for Runtime { >; type ApproveOrigin = PromoteOrigin; type PromoteOrigin = PromoteOrigin; + type FastPromoteOrigin = Self::PromoteOrigin; type EvidenceSize = ConstU32<65536>; type MaxRank = ConstU32<9>; } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs index 5e956bcdfee5..942e0c294dd0 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs @@ -208,6 +208,7 @@ impl pallet_core_fellowship::Config for Runtime { >, EnsureCanPromoteTo, >; + type FastPromoteOrigin = Self::PromoteOrigin; type EvidenceSize = ConstU32<65536>; type MaxRank = ConstU32<9>; } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_ambassador_core.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_ambassador_core.rs index dbe681f51bb2..6bedfcc7e012 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_ambassador_core.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_ambassador_core.rs @@ -171,6 +171,20 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(6)) } + fn promote_fast(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16844` + // Estimated: `19894 + r * (2489 ±0)` + // Minimum execution time: 45_065_000 picoseconds. + Weight::from_parts(34_090_392, 19894) + // Standard Error: 18_620 + .saturating_add(Weight::from_parts(13_578_046, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2489).saturating_mul(r.into())) + } /// Storage: `AmbassadorCollective::Members` (r:1 w:0) /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) /// Storage: `AmbassadorCore::Member` (r:1 w:1) diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_fellowship_core.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_fellowship_core.rs index 7e6264c0c10d..05014e273f00 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_fellowship_core.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_fellowship_core.rs @@ -170,6 +170,20 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(6)) } + fn promote_fast(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16844` + // Estimated: `19894 + r * (2489 ±0)` + // Minimum execution time: 45_065_000 picoseconds. + Weight::from_parts(34_090_392, 19894) + // Standard Error: 18_620 + .saturating_add(Weight::from_parts(13_578_046, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2489).saturating_mul(r.into())) + } /// Storage: `FellowshipCollective::Members` (r:1 w:0) /// Proof: `FellowshipCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) /// Storage: `FellowshipCore::Member` (r:1 w:1) diff --git a/prdoc/pr_4877.prdoc b/prdoc/pr_4877.prdoc new file mode 100644 index 000000000000..ede536aee450 --- /dev/null +++ b/prdoc/pr_4877.prdoc @@ -0,0 +1,13 @@ +title: "Core-Fellowship: new promote_fast call" + +doc: + - audience: Runtime User + description: | + Adds the ability to quickly promote someone within a collective by bypassing the promotion + cooldown. This can help in special situations and comes with a new origin: `FastPromoteOrigin`. + +crates: + - name: pallet-core-fellowship + bump: major + - name: collectives-westend-runtime + bump: major diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index c2601952cf1b..a3dc7decd107 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1867,6 +1867,7 @@ impl pallet_core_fellowship::Config for Runtime { type InductOrigin = pallet_core_fellowship::EnsureInducted; type ApproveOrigin = EnsureRootWithSuccess>; type PromoteOrigin = EnsureRootWithSuccess>; + type FastPromoteOrigin = Self::PromoteOrigin; type EvidenceSize = ConstU32<16_384>; type MaxRank = ConstU32<9>; } diff --git a/substrate/frame/core-fellowship/src/benchmarking.rs b/substrate/frame/core-fellowship/src/benchmarking.rs index 2dabab3983d0..34461e062b35 100644 --- a/substrate/frame/core-fellowship/src/benchmarking.rs +++ b/substrate/frame/core-fellowship/src/benchmarking.rs @@ -210,6 +210,22 @@ mod benchmarks { Ok(()) } + /// Benchmark the `promote_fast` extrinsic to promote someone up to `r`. + #[benchmark] + fn promote_fast(r: Linear<1, { T::MaxRank::get() as u32 }>) -> Result<(), BenchmarkError> { + let r = r.try_into().expect("r is too large"); + let member = make_member::(0)?; + + ensure_evidence::(&member)?; + + #[extrinsic_call] + _(RawOrigin::Root, member.clone(), r); + + assert_eq!(T::Members::rank_of(&member), Some(r)); + assert!(!MemberEvidence::::contains_key(&member)); + Ok(()) + } + #[benchmark] fn offboard() -> Result<(), BenchmarkError> { let member = make_member::(0)?; diff --git a/substrate/frame/core-fellowship/src/lib.rs b/substrate/frame/core-fellowship/src/lib.rs index 6f0bb77714d9..5ed2562d6d01 100644 --- a/substrate/frame/core-fellowship/src/lib.rs +++ b/substrate/frame/core-fellowship/src/lib.rs @@ -209,6 +209,10 @@ pub mod pallet { /// rank to which it can promote. type PromoteOrigin: EnsureOrigin>; + /// The origin that has permission to "fast" promote a member by ignoring promotion periods + /// and skipping ranks. The `Success` value is the maximum rank to which it can promote. + type FastPromoteOrigin: EnsureOrigin>; + /// The maximum size in bytes submitted evidence is allowed to be. #[pallet::constant] type EvidenceSize: Get; @@ -498,6 +502,44 @@ pub mod pallet { Ok(()) } + /// Fast promotions can skip ranks and ignore the `min_promotion_period`. + /// + /// This is useful for out-of-band promotions, hence it has its own `FastPromoteOrigin` to + /// be (possibly) more restrictive than `PromoteOrigin`. Note that the member must already + /// be inducted. + #[pallet::weight(T::WeightInfo::promote_fast(*to_rank as u32))] + #[pallet::call_index(10)] + pub fn promote_fast( + origin: OriginFor, + who: T::AccountId, + to_rank: RankOf, + ) -> DispatchResult { + match T::FastPromoteOrigin::try_origin(origin) { + Ok(allow_rank) => ensure!(allow_rank >= to_rank, Error::::NoPermission), + Err(origin) => ensure_root(origin)?, + } + ensure!(to_rank as u32 <= T::MaxRank::get(), Error::::InvalidRank); + let curr_rank = T::Members::rank_of(&who).ok_or(Error::::Unranked)?; + ensure!(to_rank > curr_rank, Error::::UnexpectedRank); + + let mut member = Member::::get(&who).ok_or(Error::::NotTracked)?; + let now = frame_system::Pallet::::block_number(); + member.last_promotion = now; + member.last_proof = now; + + for rank in (curr_rank + 1)..=to_rank { + T::Members::promote(&who)?; + + // NOTE: We could factor this out, but it would destroy our invariants: + Member::::insert(&who, &member); + + Self::dispose_evidence(who.clone(), rank.saturating_sub(1), Some(rank)); + Self::deposit_event(Event::::Promoted { who: who.clone(), to_rank: rank }); + } + + Ok(()) + } + /// Stop tracking a prior member who is now not a ranked member of the collective. /// /// - `origin`: A `Signed` origin of an account. diff --git a/substrate/frame/core-fellowship/src/tests/integration.rs b/substrate/frame/core-fellowship/src/tests/integration.rs index e3451bc43405..bcf70c7beb10 100644 --- a/substrate/frame/core-fellowship/src/tests/integration.rs +++ b/substrate/frame/core-fellowship/src/tests/integration.rs @@ -78,6 +78,7 @@ impl Config for Test { type InductOrigin = EnsureInducted; type ApproveOrigin = TryMapSuccess, u64>, TryMorphInto>; type PromoteOrigin = TryMapSuccess, u64>, TryMorphInto>; + type FastPromoteOrigin = Self::PromoteOrigin; type EvidenceSize = EvidenceSize; type MaxRank = ConstU32<9>; } diff --git a/substrate/frame/core-fellowship/src/tests/unit.rs b/substrate/frame/core-fellowship/src/tests/unit.rs index 5d6d59c5c891..11d1ea9fe5b7 100644 --- a/substrate/frame/core-fellowship/src/tests/unit.rs +++ b/substrate/frame/core-fellowship/src/tests/unit.rs @@ -21,7 +21,7 @@ use std::collections::BTreeMap; use core::cell::RefCell; use frame_support::{ - assert_noop, assert_ok, derive_impl, ord_parameter_types, + assert_noop, assert_ok, derive_impl, hypothetically, ord_parameter_types, pallet_prelude::Weight, parameter_types, traits::{tokens::GetSalary, ConstU32, IsInVec, TryMapSuccess}, @@ -115,6 +115,7 @@ impl Config for Test { type InductOrigin = EnsureInducted; type ApproveOrigin = TryMapSuccess, u64>, TryMorphInto>; type PromoteOrigin = TryMapSuccess, u64>, TryMorphInto>; + type FastPromoteOrigin = Self::PromoteOrigin; type EvidenceSize = ConstU32<1024>; type MaxRank = ConstU32<9>; } @@ -256,6 +257,99 @@ fn promote_works() { }); } +#[test] +fn promote_fast_works() { + let alice = 1; + + new_test_ext().execute_with(|| { + assert_noop!( + CoreFellowship::promote_fast(signed(alice), alice, 1), + Error::::Unranked + ); + set_rank(alice, 0); + assert_noop!( + CoreFellowship::promote_fast(signed(alice), alice, 1), + Error::::NotTracked + ); + assert_ok!(CoreFellowship::import(signed(alice))); + + // Cannot fast promote to the same rank: + assert_noop!( + CoreFellowship::promote_fast(signed(alice), alice, 0), + Error::::UnexpectedRank + ); + assert_ok!(CoreFellowship::promote_fast(signed(alice), alice, 1)); + assert_eq!(TestClub::rank_of(&alice), Some(1)); + + // Cannot promote normally because of the period: + assert_noop!(CoreFellowship::promote(signed(2), alice, 2), Error::::TooSoon); + // But can fast promote: + assert_ok!(CoreFellowship::promote_fast(signed(2), alice, 2)); + assert_eq!(TestClub::rank_of(&alice), Some(2)); + + // Cannot promote to lower rank: + assert_noop!( + CoreFellowship::promote_fast(signed(alice), alice, 0), + Error::::UnexpectedRank + ); + assert_noop!( + CoreFellowship::promote_fast(signed(alice), alice, 1), + Error::::UnexpectedRank + ); + // Permission is checked: + assert_noop!( + CoreFellowship::promote_fast(signed(alice), alice, 2), + Error::::NoPermission + ); + + // Can fast promote up to the maximum: + assert_ok!(CoreFellowship::promote_fast(signed(9), alice, 9)); + // But not past the maximum: + assert_noop!( + CoreFellowship::promote_fast(RuntimeOrigin::root(), alice, 10), + Error::::InvalidRank + ); + }); +} + +/// Compare the storage root hashes of a normal promote and a fast promote. +#[test] +fn promote_fast_identical_to_promote() { + let alice = 1; + + new_test_ext().execute_with(|| { + set_rank(alice, 0); + assert_eq!(TestClub::rank_of(&alice), Some(0)); + assert_ok!(CoreFellowship::import(signed(alice))); + run_to(3); + assert_eq!(TestClub::rank_of(&alice), Some(0)); + assert_ok!(CoreFellowship::submit_evidence( + signed(alice), + Wish::Promotion, + bounded_vec![0; 1024] + )); + + let root_promote = hypothetically!({ + assert_ok!(CoreFellowship::promote(signed(alice), alice, 1)); + // Don't clean the events since they should emit the same events: + sp_io::storage::root(sp_runtime::StateVersion::V1) + }); + + // This is using thread locals instead of storage... + TestClub::demote(&alice).unwrap(); + + let root_promote_fast = hypothetically!({ + assert_ok!(CoreFellowship::promote_fast(signed(alice), alice, 1)); + + sp_io::storage::root(sp_runtime::StateVersion::V1) + }); + + assert_eq!(root_promote, root_promote_fast); + // Ensure that we don't compare trivial stuff like `()` from a type error above. + assert_eq!(root_promote.len(), 32); + }); +} + #[test] fn sync_works() { new_test_ext().execute_with(|| { diff --git a/substrate/frame/core-fellowship/src/weights.rs b/substrate/frame/core-fellowship/src/weights.rs index c1042d0ddfaf..5e64600b662b 100644 --- a/substrate/frame/core-fellowship/src/weights.rs +++ b/substrate/frame/core-fellowship/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for `pallet_core_fellowship` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-06-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-anb7yjbi-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `runner-x5tnzzy-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: @@ -56,6 +56,7 @@ pub trait WeightInfo { fn set_active() -> Weight; fn induct() -> Weight; fn promote() -> Weight; + fn promote_fast(r: u32, ) -> Weight; fn offboard() -> Weight; fn import() -> Weight; fn approve() -> Weight; @@ -71,18 +72,19 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_633_000 picoseconds. - Weight::from_parts(8_018_000, 0) + // Minimum execution time: 5_772_000 picoseconds. + Weight::from_parts(6_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: CoreFellowship Params (r:0 w:1) - /// Proof: CoreFellowship Params (max_values: Some(1), max_size: Some(364), added: 859, mode: MaxEncodedLen) + /// Storage: `CoreFellowship::Params` (r:1 w:1) + /// Proof: `CoreFellowship::Params` (`max_values`: Some(1), `max_size`: Some(368), added: 863, mode: `MaxEncodedLen`) fn set_partial_params() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 9_454_000 picoseconds. - Weight::from_parts(9_804_000, 0) + // Measured: `399` + // Estimated: `1853` + // Minimum execution time: 10_050_000 picoseconds. + Weight::from_parts(10_244_000, 1853) + .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `CoreFellowship::Member` (r:1 w:1) @@ -103,8 +105,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `17278` // Estimated: `19894` - // Minimum execution time: 57_597_000 picoseconds. - Weight::from_parts(58_825_000, 19894) + // Minimum execution time: 54_433_000 picoseconds. + Weight::from_parts(55_650_000, 19894) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -126,8 +128,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `17388` // Estimated: `19894` - // Minimum execution time: 61_387_000 picoseconds. - Weight::from_parts(63_408_000, 19894) + // Minimum execution time: 57_634_000 picoseconds. + Weight::from_parts(58_816_000, 19894) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -139,8 +141,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3514` - // Minimum execution time: 15_941_000 picoseconds. - Weight::from_parts(16_547_000, 3514) + // Minimum execution time: 14_527_000 picoseconds. + Weight::from_parts(14_948_000, 3514) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -158,8 +160,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `146` // Estimated: `3514` - // Minimum execution time: 24_963_000 picoseconds. - Weight::from_parts(25_873_000, 3514) + // Minimum execution time: 22_137_000 picoseconds. + Weight::from_parts(22_925_000, 3514) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -181,11 +183,38 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `16931` // Estimated: `19894` - // Minimum execution time: 55_062_000 picoseconds. - Weight::from_parts(58_422_000, 19894) + // Minimum execution time: 51_837_000 picoseconds. + Weight::from_parts(52_810_000, 19894) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } + /// Storage: `RankedCollective::Members` (r:1 w:1) + /// Proof: `RankedCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CoreFellowship::Member` (r:1 w:1) + /// Proof: `CoreFellowship::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `RankedCollective::MemberCount` (r:9 w:9) + /// Proof: `RankedCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CoreFellowship::MemberEvidence` (r:1 w:1) + /// Proof: `CoreFellowship::MemberEvidence` (`max_values`: None, `max_size`: Some(16429), added: 18904, mode: `MaxEncodedLen`) + /// Storage: `RankedCollective::IndexToId` (r:0 w:9) + /// Proof: `RankedCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `RankedCollective::IdToIndex` (r:0 w:9) + /// Proof: `RankedCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 9]`. + fn promote_fast(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16844` + // Estimated: `19894 + r * (2489 ±0)` + // Minimum execution time: 45_065_000 picoseconds. + Weight::from_parts(34_090_392, 19894) + // Standard Error: 18_620 + .saturating_add(Weight::from_parts(13_578_046, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2489).saturating_mul(r.into())) + } /// Storage: `RankedCollective::Members` (r:1 w:0) /// Proof: `RankedCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) /// Storage: `CoreFellowship::Member` (r:1 w:1) @@ -196,8 +225,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `293` // Estimated: `3514` - // Minimum execution time: 15_901_000 picoseconds. - Weight::from_parts(16_746_000, 3514) + // Minimum execution time: 14_321_000 picoseconds. + Weight::from_parts(14_747_000, 3514) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -209,8 +238,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `313` // Estimated: `3514` - // Minimum execution time: 14_768_000 picoseconds. - Weight::from_parts(15_421_000, 3514) + // Minimum execution time: 13_525_000 picoseconds. + Weight::from_parts(13_843_000, 3514) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -224,8 +253,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `16843` // Estimated: `19894` - // Minimum execution time: 36_925_000 picoseconds. - Weight::from_parts(38_330_000, 19894) + // Minimum execution time: 34_719_000 picoseconds. + Weight::from_parts(35_162_000, 19894) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -237,8 +266,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `79` // Estimated: `19894` - // Minimum execution time: 25_210_000 picoseconds. - Weight::from_parts(26_247_000, 19894) + // Minimum execution time: 23_477_000 picoseconds. + Weight::from_parts(23_897_000, 19894) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -252,18 +281,19 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_633_000 picoseconds. - Weight::from_parts(8_018_000, 0) + // Minimum execution time: 5_772_000 picoseconds. + Weight::from_parts(6_000_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: CoreFellowship Params (r:0 w:1) - /// Proof: CoreFellowship Params (max_values: Some(1), max_size: Some(364), added: 859, mode: MaxEncodedLen) + /// Storage: `CoreFellowship::Params` (r:1 w:1) + /// Proof: `CoreFellowship::Params` (`max_values`: Some(1), `max_size`: Some(368), added: 863, mode: `MaxEncodedLen`) fn set_partial_params() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 9_454_000 picoseconds. - Weight::from_parts(9_804_000, 0) + // Measured: `399` + // Estimated: `1853` + // Minimum execution time: 10_050_000 picoseconds. + Weight::from_parts(10_244_000, 1853) + .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `CoreFellowship::Member` (r:1 w:1) @@ -284,8 +314,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `17278` // Estimated: `19894` - // Minimum execution time: 57_597_000 picoseconds. - Weight::from_parts(58_825_000, 19894) + // Minimum execution time: 54_433_000 picoseconds. + Weight::from_parts(55_650_000, 19894) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -307,8 +337,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `17388` // Estimated: `19894` - // Minimum execution time: 61_387_000 picoseconds. - Weight::from_parts(63_408_000, 19894) + // Minimum execution time: 57_634_000 picoseconds. + Weight::from_parts(58_816_000, 19894) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -320,8 +350,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3514` - // Minimum execution time: 15_941_000 picoseconds. - Weight::from_parts(16_547_000, 3514) + // Minimum execution time: 14_527_000 picoseconds. + Weight::from_parts(14_948_000, 3514) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -339,8 +369,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `146` // Estimated: `3514` - // Minimum execution time: 24_963_000 picoseconds. - Weight::from_parts(25_873_000, 3514) + // Minimum execution time: 22_137_000 picoseconds. + Weight::from_parts(22_925_000, 3514) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -362,11 +392,38 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `16931` // Estimated: `19894` - // Minimum execution time: 55_062_000 picoseconds. - Weight::from_parts(58_422_000, 19894) + // Minimum execution time: 51_837_000 picoseconds. + Weight::from_parts(52_810_000, 19894) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } + /// Storage: `RankedCollective::Members` (r:1 w:1) + /// Proof: `RankedCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CoreFellowship::Member` (r:1 w:1) + /// Proof: `CoreFellowship::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `RankedCollective::MemberCount` (r:9 w:9) + /// Proof: `RankedCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CoreFellowship::MemberEvidence` (r:1 w:1) + /// Proof: `CoreFellowship::MemberEvidence` (`max_values`: None, `max_size`: Some(16429), added: 18904, mode: `MaxEncodedLen`) + /// Storage: `RankedCollective::IndexToId` (r:0 w:9) + /// Proof: `RankedCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `RankedCollective::IdToIndex` (r:0 w:9) + /// Proof: `RankedCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 9]`. + fn promote_fast(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16844` + // Estimated: `19894 + r * (2489 ±0)` + // Minimum execution time: 45_065_000 picoseconds. + Weight::from_parts(34_090_392, 19894) + // Standard Error: 18_620 + .saturating_add(Weight::from_parts(13_578_046, 0).saturating_mul(r.into())) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2489).saturating_mul(r.into())) + } /// Storage: `RankedCollective::Members` (r:1 w:0) /// Proof: `RankedCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) /// Storage: `CoreFellowship::Member` (r:1 w:1) @@ -377,8 +434,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `293` // Estimated: `3514` - // Minimum execution time: 15_901_000 picoseconds. - Weight::from_parts(16_746_000, 3514) + // Minimum execution time: 14_321_000 picoseconds. + Weight::from_parts(14_747_000, 3514) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -390,8 +447,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `313` // Estimated: `3514` - // Minimum execution time: 14_768_000 picoseconds. - Weight::from_parts(15_421_000, 3514) + // Minimum execution time: 13_525_000 picoseconds. + Weight::from_parts(13_843_000, 3514) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -405,8 +462,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `16843` // Estimated: `19894` - // Minimum execution time: 36_925_000 picoseconds. - Weight::from_parts(38_330_000, 19894) + // Minimum execution time: 34_719_000 picoseconds. + Weight::from_parts(35_162_000, 19894) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -418,8 +475,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `79` // Estimated: `19894` - // Minimum execution time: 25_210_000 picoseconds. - Weight::from_parts(26_247_000, 19894) + // Minimum execution time: 23_477_000 picoseconds. + Weight::from_parts(23_897_000, 19894) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) }