diff --git a/pallets/universal-dividend/src/lib.rs b/pallets/universal-dividend/src/lib.rs index f6ebcc8afb51766c13bcd7ba91b6ffb67087d426..faf5749d2fdcf667822228ae045d17364147e28d 100644 --- a/pallets/universal-dividend/src/lib.rs +++ b/pallets/universal-dividend/src/lib.rs @@ -374,8 +374,7 @@ pub mod pallet { #[pallet::call] impl<T: Config> Pallet<T> { /// Claim Universal Dividends - //#[pallet::weight(T::WeightInfo::claim_uds(T::MaxPastReeval::get()))] - #[pallet::weight(0)] // TODO benchmark weights + #[pallet::weight(T::WeightInfo::claim_uds(T::MaxPastReeval::get()))] pub fn claim_uds(origin: OriginFor<T>) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; Self::do_claim_uds(&who) diff --git a/pallets/universal-dividend/src/weights.rs b/pallets/universal-dividend/src/weights.rs index d82e24dab1378f122b196a3c2c257834689c00b9..e3b860880991e7c3aa5e7cd04fb8a67c5d6418e2 100644 --- a/pallets/universal-dividend/src/weights.rs +++ b/pallets/universal-dividend/src/weights.rs @@ -23,6 +23,7 @@ pub trait WeightInfo { fn on_initialize() -> Weight; fn on_initialize_ud_created() -> Weight; fn on_initialize_ud_reevalued() -> Weight; + fn claim_uds(n: u32) -> Weight; fn transfer_ud() -> Weight; fn transfer_ud_keep_alive() -> Weight; } @@ -54,6 +55,17 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } + // Storage: Identity IdentityIndexOf (r:1 w:0) + // Storage: Identity Identities (r:1 w:1) + // Storage: UniversalDividend CurrentUdIndex (r:1 w:0) + // Storage: UniversalDividend PastReevals (r:1 w:0) + fn claim_uds(n: u32) -> Weight { + (32_514_000 as Weight) + // Standard Error: 32_000 + .saturating_add((8_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } // Storage: UniversalDividend CurrentUd (r:1 w:0) // Storage: System Account (r:1 w:1) // Storage: Account PendingNewAccounts (r:0 w:1) diff --git a/runtime/common/src/weights/pallet_universal_dividend.rs b/runtime/common/src/weights/pallet_universal_dividend.rs index 0967f2e4fdd7f5387de9357269abbec121f252ed..9a1b5c98006da1fe2eeb8effbe9708e209b6a882 100644 --- a/runtime/common/src/weights/pallet_universal_dividend.rs +++ b/runtime/common/src/weights/pallet_universal_dividend.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_universal_dividend` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-06-12, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-07-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Interpreted, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -46,7 +46,7 @@ use sp_std::marker::PhantomData; pub struct WeightInfo<T>(PhantomData<T>); impl<T: frame_system::Config> pallet_universal_dividend::WeightInfo for WeightInfo<T> { fn on_initialize() -> Weight { - 104_055_000 as Weight + 111_220_000 as Weight } // Storage: Membership CounterForMembership (r:1 w:0) // Storage: UniversalDividend NextReeval (r:1 w:0) @@ -54,7 +54,7 @@ impl<T: frame_system::Config> pallet_universal_dividend::WeightInfo for WeightIn // Storage: UniversalDividend MonetaryMass (r:1 w:1) // Storage: UniversalDividend CurrentUdIndex (r:1 w:1) fn on_initialize_ud_created() -> Weight { - (1_000_000_000 as Weight) + (525_382_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -65,10 +65,21 @@ impl<T: frame_system::Config> pallet_universal_dividend::WeightInfo for WeightIn // Storage: UniversalDividend PastReevals (r:1 w:1) // Storage: UniversalDividend CurrentUdIndex (r:1 w:1) fn on_initialize_ud_reevalued() -> Weight { - (1_500_000_000 as Weight) + (1_161_595_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(5 as Weight)) } + // Storage: Identity IdentityIndexOf (r:1 w:0) + // Storage: Identity Identities (r:1 w:1) + // Storage: UniversalDividend CurrentUdIndex (r:1 w:0) + // Storage: UniversalDividend PastReevals (r:1 w:0) + fn claim_uds(n: u32) -> Weight { + (1_221_776_000 as Weight) + // Standard Error: 958_000 + .saturating_add((7_709_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } // Storage: UniversalDividend CurrentUd (r:1 w:0) // Storage: System Account (r:1 w:1) // Storage: Account PendingNewAccounts (r:0 w:1)