fix: set username grace period and deposit (#416)

### Summary
Set username deletion to use a 30‑day grace period (in blocks) and added
a non‑zero username deposit, both based on the Moonbeam's runtimes. This
makes username unbinding wait before deletion and makes authority‑issued
usernames non‑free, mitigating the sybil vector while aligning with
existing identity config patterns.

### Changes
- Configures for `pallet_identity`
  - `UsernameGracePeriod = 30 * DAYS`
  - `UsernameGracePeriod = deposit(0, MaxUsernameLength::get())`
This commit is contained in:
Gonza Montiel 2026-01-29 10:13:31 -03:00 committed by GitHub
parent 819cde5a02
commit 91987daf1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 6 deletions

View file

@ -595,6 +595,8 @@ parameter_types! {
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
pub const PendingUsernameExpiration: u32 = 7 * DAYS;
pub const UsernameGracePeriod: u32 = 30 * DAYS;
pub const UsernameDeposit: Balance = deposit(0, MaxUsernameLength::get());
pub const MaxSuffixLength: u32 = 7;
pub const MaxUsernameLength: u32 = 32;
}
@ -626,8 +628,8 @@ impl pallet_identity::Config for Runtime {
type MaxSuffixLength = MaxSuffixLength;
type MaxUsernameLength = MaxUsernameLength;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
type UsernameDeposit = ();
type UsernameGracePeriod = ();
type UsernameDeposit = UsernameDeposit;
type UsernameGracePeriod = UsernameGracePeriod;
// TODO: Re-enable after upgrade to Polkadot SDK stable2412-8
// see https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2412-8

View file

@ -592,6 +592,8 @@ parameter_types! {
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
pub const PendingUsernameExpiration: u32 = 7 * DAYS;
pub const UsernameGracePeriod: u32 = 30 * DAYS;
pub const UsernameDeposit: Balance = deposit(0, MaxUsernameLength::get());
pub const MaxSuffixLength: u32 = 7;
pub const MaxUsernameLength: u32 = 32;
}
@ -623,8 +625,8 @@ impl pallet_identity::Config for Runtime {
type MaxSuffixLength = MaxSuffixLength;
type MaxUsernameLength = MaxUsernameLength;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
type UsernameDeposit = ();
type UsernameGracePeriod = ();
type UsernameDeposit = UsernameDeposit;
type UsernameGracePeriod = UsernameGracePeriod;
// TODO: Re-enable after upgrade to Polkadot SDK stable2412-8
// see https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2412-8

View file

@ -595,6 +595,8 @@ parameter_types! {
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
pub const PendingUsernameExpiration: u32 = 7 * DAYS;
pub const UsernameGracePeriod: u32 = 30 * DAYS;
pub const UsernameDeposit: Balance = deposit(0, MaxUsernameLength::get());
pub const MaxSuffixLength: u32 = 7;
pub const MaxUsernameLength: u32 = 32;
}
@ -626,8 +628,8 @@ impl pallet_identity::Config for Runtime {
type MaxSuffixLength = MaxSuffixLength;
type MaxUsernameLength = MaxUsernameLength;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
type UsernameDeposit = ();
type UsernameGracePeriod = ();
type UsernameDeposit = UsernameDeposit;
type UsernameGracePeriod = UsernameGracePeriod;
// TODO: Re-enable after upgrade to Polkadot SDK stable2412-8
// see https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2412-8

Binary file not shown.