Identity pallet improvements (#2048)

This PR is a follow up to #1661 

- [x] rename the `simple` module to `legacy`
- [x] fix benchmarks to disregard the number of additional fields
- [x] change the storage deposits to charge per encoded byte of the
identity information instance, removing the need for `fn
additional(&self) -> usize` in `IdentityInformationProvider`
- [x] ~add an extrinsic to rejig deposits to account for the change
above~
- [ ] ~ensure through proper configuration that the new byte-based
deposit is always lower than whatever is reserved now~
- [x] remove `IdentityFields` from the `set_fields` extrinsic signature,
as per [this
discussion](https://github.com/paritytech/polkadot-sdk/pull/1661#discussion_r1371703403)

> ensure through proper configuration that the new byte-based deposit is
always lower than whatever is reserved now

Not sure this is needed anymore. If the new deposits are higher than
what is currently on chain and users don't have enough funds to reserve
what is needed, the extrinisc fails and they're basically grandfathered
and frozen until they add more funds and/or make a change to their
identity. This behavior seems fine to me. Original idea
[here](https://github.com/paritytech/polkadot-sdk/pull/1661#issuecomment-1779606319).

> add an extrinsic to rejig deposits to account for the change above

This was initially implemented but now removed from this PR in favor of
the implementation detailed
[here](https://github.com/paritytech/polkadot-sdk/pull/2088).

---------

Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
Co-authored-by: joepetrowski <joe@parity.io>
This commit is contained in:
georgepisaltuandjoepetrowski authored and GitHub committed 2023-11-03 20:38:26 +01:00
1 parent ca5f10567a
commit 21fbc00d04
15 files changed
+353 -459

No files matched your search

@@ -65,8 +65,7 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
/// Storage: Identity IdentityOf (r:1 w:1)
/// Proof: Identity IdentityOf (max_values: None, max_size: Some(7538), added: 10013, mode: MaxEncodedLen)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[0, 100]`.
fn set_identity(r: u32, x: u32, ) -> Weight {
fn set_identity(r: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `442 + r * (5 ±0)`
// Estimated: `11003`
@@ -75,8 +74,6 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
.saturating_add(Weight::from_parts(0, 11003))
// Standard Error: 2_307
.saturating_add(Weight::from_parts(92_753, 0).saturating_mul(r.into()))
// Standard Error: 450
.saturating_add(Weight::from_parts(449_529, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -130,8 +127,7 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
/// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen)
/// The range of component `r` is `[1, 20]`.
/// The range of component `s` is `[0, 100]`.
/// The range of component `x` is `[0, 100]`.
fn clear_identity(_r: u32, s: u32, x: u32, ) -> Weight {
fn clear_identity(_r: u32, s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `469 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)`
// Estimated: `11003`
@@ -140,8 +136,6 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
.saturating_add(Weight::from_parts(0, 11003))
// Standard Error: 1_353
.saturating_add(Weight::from_parts(1_074_019, 0).saturating_mul(s.into()))
// Standard Error: 1_353
.saturating_add(Weight::from_parts(229_947, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -151,8 +145,7 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
/// Storage: Identity IdentityOf (r:1 w:1)
/// Proof: Identity IdentityOf (max_values: None, max_size: Some(7538), added: 10013, mode: MaxEncodedLen)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[0, 100]`.
fn request_judgement(r: u32, x: u32, ) -> Weight {
fn request_judgement(r: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `367 + r * (57 ±0) + x * (66 ±0)`
// Estimated: `11003`
@@ -161,16 +154,14 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
.saturating_add(Weight::from_parts(0, 11003))
// Standard Error: 2_214
.saturating_add(Weight::from_parts(83_822, 0).saturating_mul(r.into()))
// Standard Error: 432
.saturating_add(Weight::from_parts(458_801, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Identity IdentityOf (r:1 w:1)
/// Proof: Identity IdentityOf (max_values: None, max_size: Some(7538), added: 10013, mode: MaxEncodedLen)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[0, 100]`.
fn cancel_request(r: u32, x: u32, ) -> Weight {
fn cancel_request(r: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `398 + x * (66 ±0)`
// Estimated: `11003`
@@ -179,8 +170,6 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
.saturating_add(Weight::from_parts(0, 11003))
// Standard Error: 2_528
.saturating_add(Weight::from_parts(85_593, 0).saturating_mul(r.into()))
// Standard Error: 493
.saturating_add(Weight::from_parts(468_140, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -234,8 +223,7 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
/// Storage: Identity IdentityOf (r:1 w:1)
/// Proof: Identity IdentityOf (max_values: None, max_size: Some(7538), added: 10013, mode: MaxEncodedLen)
/// The range of component `r` is `[1, 19]`.
/// The range of component `x` is `[0, 100]`.
fn provide_judgement(r: u32, x: u32, ) -> Weight {
fn provide_judgement(r: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `445 + r * (57 ±0) + x * (66 ±0)`
// Estimated: `11003`
@@ -244,8 +232,6 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
.saturating_add(Weight::from_parts(0, 11003))
// Standard Error: 2_881
.saturating_add(Weight::from_parts(109_812, 0).saturating_mul(r.into()))
// Standard Error: 533
.saturating_add(Weight::from_parts(733_244, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -259,8 +245,7 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
/// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen)
/// The range of component `r` is `[1, 20]`.
/// The range of component `s` is `[0, 100]`.
/// The range of component `x` is `[0, 100]`.
fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight {
fn kill_identity(r: u32, s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `676 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)`
// Estimated: `11003`
@@ -271,8 +256,6 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
.saturating_add(Weight::from_parts(15_486, 0).saturating_mul(r.into()))
// Standard Error: 1_275
.saturating_add(Weight::from_parts(1_085_117, 0).saturating_mul(s.into()))
// Standard Error: 1_275
.saturating_add(Weight::from_parts(228_226, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))