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

fix pallet_identity weight::zero

parent 520d939e
No related branches found
No related tags found
No related merge requests found
......@@ -495,7 +495,8 @@ impl<T: Config> pallet_identity::traits::OnIdtyChange<T> for Pallet<T> {
| IdtyEvent::ChangedOwnerKey { .. }
| IdtyEvent::Removed { .. } => {}
}
// TODO proper weight
// The weight accounting is performed where the handler is called.
// See in pallet-identity.
Weight::zero()
}
}
......@@ -284,6 +284,20 @@ benchmarks! {
let idty_index: T::IdtyIndex = 0u32.into();
assert!(Identities::<T>::get(idty_index).is_none());
}: {Pallet::<T>::do_remove_identity(idty_index, IdtyRemovalReason::Revoked);}
do_remove_identity {
let idty_index: T::IdtyIndex = 1u32.into();
let new_identity: T::AccountId = account("Bob", 2, SEED);
assert!(Identities::<T>::get(idty_index).is_some());
Identities::<T>::mutate( idty_index, |id| {
if let Some(id) = id {
id.old_owner_key = Some((new_identity, BlockNumberFor::<T>::zero()));
}
});
assert!(Identities::<T>::get(idty_index).unwrap().old_owner_key.is_some());
}: {Pallet::<T>::do_remove_identity(idty_index, IdtyRemovalReason::Revoked);}
verify {
assert_has_event::<T>(Event::<T>::IdtyRemoved { idty_index, reason: IdtyRemovalReason::Revoked }.into());
}
prune_identities_noop {
assert!(IdentitiesRemovableOn::<T>::try_get(T::BlockNumber::zero()).is_err());
}: {Pallet::<T>::prune_identities(T::BlockNumber::zero());}
......
......@@ -738,6 +738,7 @@ pub mod pallet {
status: idty_val.status,
},
);
return T::WeightInfo::do_remove_identity();
}
T::WeightInfo::do_remove_identity_noop()
}
......
......@@ -31,6 +31,7 @@ pub trait WeightInfo {
fn link_account() -> Weight;
fn on_initialize() -> Weight;
fn do_remove_identity_noop() -> Weight;
fn do_remove_identity() -> Weight;
fn prune_identities_noop() -> Weight;
fn prune_identities_none() -> Weight;
fn prune_identities_err() -> Weight;
......@@ -177,6 +178,16 @@ impl WeightInfo for () {
.saturating_add(RocksDbWeight::get().reads(3))
.saturating_add(RocksDbWeight::get().writes(1))
}
fn do_remove_identity() -> Weight {
// Proof Size summary in bytes:
// Measured: `359`
// Estimated: `3824`
// Minimum execution time: 543_046_000 picoseconds.
Weight::from_parts(544_513_000, 0)
.saturating_add(Weight::from_parts(0, 3824))
.saturating_add(RocksDbWeight::get().reads(3))
.saturating_add(RocksDbWeight::get().writes(1))
}
fn prune_identities_noop() -> Weight {
// Proof Size summary in bytes:
// Measured: `359`
......
......@@ -2,7 +2,7 @@
//! Autogenerated weights for `pallet_identity`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-11-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-11-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
......@@ -61,8 +61,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `982`
// Estimated: `6922`
// Minimum execution time: 37_343_000 picoseconds.
Weight::from_parts(38_374_000, 0)
// Minimum execution time: 36_524_000 picoseconds.
Weight::from_parts(38_494_000, 0)
.saturating_add(Weight::from_parts(0, 6922))
.saturating_add(T::DbWeight::get().reads(13))
.saturating_add(T::DbWeight::get().writes(12))
......@@ -85,8 +85,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `955`
// Estimated: `4420`
// Minimum execution time: 23_567_000 picoseconds.
Weight::from_parts(24_519_000, 0)
// Minimum execution time: 22_820_000 picoseconds.
Weight::from_parts(24_189_000, 0)
.saturating_add(Weight::from_parts(0, 4420))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
......@@ -113,8 +113,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1948`
// Estimated: `5413`
// Minimum execution time: 37_244_000 picoseconds.
Weight::from_parts(40_560_000, 0)
// Minimum execution time: 38_911_000 picoseconds.
Weight::from_parts(40_700_000, 0)
.saturating_add(Weight::from_parts(0, 5413))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(5))
......@@ -133,11 +133,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
/// Proof Skipped: AuthorityMembers Members (max_values: None, max_size: None, mode: Measured)
fn change_owner_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `1115`
// Estimated: `7055`
// Minimum execution time: 78_496_000 picoseconds.
Weight::from_parts(85_171_000, 0)
.saturating_add(Weight::from_parts(0, 7055))
// Measured: `1119`
// Estimated: `7059`
// Minimum execution time: 75_748_000 picoseconds.
Weight::from_parts(78_925_000, 0)
.saturating_add(Weight::from_parts(0, 7059))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
}
......@@ -167,8 +167,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1498`
// Estimated: `7438`
// Minimum execution time: 86_488_000 picoseconds.
Weight::from_parts(89_856_000, 0)
// Minimum execution time: 85_124_000 picoseconds.
Weight::from_parts(87_603_000, 0)
.saturating_add(Weight::from_parts(0, 7438))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(10))
......@@ -199,8 +199,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1343`
// Estimated: `7283`
// Minimum execution time: 38_570_000 picoseconds.
Weight::from_parts(39_625_000, 0)
// Minimum execution time: 38_340_000 picoseconds.
Weight::from_parts(39_702_000, 0)
.saturating_add(Weight::from_parts(0, 7283))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(10))
......@@ -212,11 +212,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 874_000 picoseconds.
Weight::from_parts(946_000, 0)
// Minimum execution time: 866_000 picoseconds.
Weight::from_parts(932_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 865
.saturating_add(Weight::from_parts(640_555, 0).saturating_mul(i.into()))
// Standard Error: 980
.saturating_add(Weight::from_parts(645_049, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: System Account (r:1 w:1)
......@@ -225,8 +225,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `67`
// Estimated: `3591`
// Minimum execution time: 3_954_000 picoseconds.
Weight::from_parts(4_176_000, 0)
// Minimum execution time: 3_986_000 picoseconds.
Weight::from_parts(4_380_000, 0)
.saturating_add(Weight::from_parts(0, 3591))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
......@@ -241,8 +241,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `307`
// Estimated: `3772`
// Minimum execution time: 45_049_000 picoseconds.
Weight::from_parts(46_758_000, 0)
// Minimum execution time: 45_363_000 picoseconds.
Weight::from_parts(47_138_000, 0)
.saturating_add(Weight::from_parts(0, 3772))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(1))
......@@ -252,7 +252,7 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 28_000 picoseconds.
Weight::from_parts(29_000, 0)
Weight::from_parts(31_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: Identity Identities (r:1 w:0)
......@@ -261,19 +261,67 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `269`
// Estimated: `3734`
// Minimum execution time: 3_447_000 picoseconds.
Weight::from_parts(3_570_000, 0)
// Minimum execution time: 3_361_000 picoseconds.
Weight::from_parts(3_521_000, 0)
.saturating_add(Weight::from_parts(0, 3734))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: Identity Identities (r:1 w:1)
/// Proof Skipped: Identity Identities (max_values: None, max_size: None, mode: Measured)
/// Storage: SmithMembership Membership (r:1 w:1)
/// Proof Skipped: SmithMembership Membership (max_values: None, max_size: None, mode: Measured)
/// Storage: SmithMembership CounterForMembership (r:1 w:1)
/// Proof: SmithMembership CounterForMembership (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: SmithMembership MembershipsExpireOn (r:1 w:1)
/// Proof Skipped: SmithMembership MembershipsExpireOn (max_values: None, max_size: None, mode: Measured)
/// Storage: AuthorityMembers Members (r:1 w:1)
/// Proof Skipped: AuthorityMembers Members (max_values: None, max_size: None, mode: Measured)
/// Storage: AuthorityMembers OnlineAuthorities (r:1 w:1)
/// Proof Skipped: AuthorityMembers OnlineAuthorities (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: AuthorityMembers OutgoingAuthorities (r:1 w:1)
/// Proof Skipped: AuthorityMembers OutgoingAuthorities (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: AuthorityMembers AuthoritiesCounter (r:1 w:1)
/// Proof Skipped: AuthorityMembers AuthoritiesCounter (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: AuthorityMembers IncomingAuthorities (r:1 w:1)
/// Proof Skipped: AuthorityMembers IncomingAuthorities (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: Session NextKeys (r:1 w:1)
/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
/// Storage: System Account (r:2 w:2)
/// Proof: System Account (max_values: None, max_size: Some(126), added: 2601, mode: MaxEncodedLen)
/// Storage: Membership Membership (r:1 w:1)
/// Proof Skipped: Membership Membership (max_values: None, max_size: None, mode: Measured)
/// Storage: Membership CounterForMembership (r:1 w:1)
/// Proof: Membership CounterForMembership (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: Membership MembershipsExpireOn (r:1 w:1)
/// Proof Skipped: Membership MembershipsExpireOn (max_values: None, max_size: None, mode: Measured)
/// Storage: UniversalDividend CurrentUdIndex (r:1 w:0)
/// Proof: UniversalDividend CurrentUdIndex (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
/// Storage: Identity CounterForIdentities (r:1 w:1)
/// Proof: Identity CounterForIdentities (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: Identity IdentityIndexOf (r:0 w:1)
/// Proof Skipped: Identity IdentityIndexOf (max_values: None, max_size: None, mode: Measured)
/// Storage: Quota IdtyQuota (r:0 w:1)
/// Proof: Quota IdtyQuota (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen)
/// Storage: Session KeyOwner (r:0 w:4)
/// Proof Skipped: Session KeyOwner (max_values: None, max_size: None, mode: Measured)
fn do_remove_identity() -> Weight {
// Proof Size summary in bytes:
// Measured: `1525`
// Estimated: `6192`
// Minimum execution time: 57_451_000 picoseconds.
Weight::from_parts(60_603_000, 0)
.saturating_add(Weight::from_parts(0, 6192))
.saturating_add(T::DbWeight::get().reads(17))
.saturating_add(T::DbWeight::get().writes(22))
}
/// Storage: Identity IdentitiesRemovableOn (r:1 w:0)
/// Proof Skipped: Identity IdentitiesRemovableOn (max_values: None, max_size: None, mode: Measured)
fn prune_identities_noop() -> Weight {
// Proof Size summary in bytes:
// Measured: `108`
// Estimated: `3573`
// Minimum execution time: 1_213_000 picoseconds.
Weight::from_parts(1_314_000, 0)
// Minimum execution time: 1_282_000 picoseconds.
Weight::from_parts(1_356_000, 0)
.saturating_add(Weight::from_parts(0, 3573))
.saturating_add(T::DbWeight::get().reads(1))
}
......@@ -285,8 +333,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `293`
// Estimated: `3758`
// Minimum execution time: 4_540_000 picoseconds.
Weight::from_parts(4_681_000, 0)
// Minimum execution time: 4_515_000 picoseconds.
Weight::from_parts(4_653_000, 0)
.saturating_add(Weight::from_parts(0, 3758))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
......@@ -299,8 +347,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `360`
// Estimated: `3825`
// Minimum execution time: 5_511_000 picoseconds.
Weight::from_parts(5_784_000, 0)
// Minimum execution time: 5_762_000 picoseconds.
Weight::from_parts(6_064_000, 0)
.saturating_add(Weight::from_parts(0, 3825))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment