From 91987daf1ee3d85ecc93b7b54bdce417082ddbb6 Mon Sep 17 00:00:00 2001 From: Gonza Montiel Date: Thu, 29 Jan 2026 10:13:31 -0300 Subject: [PATCH] fix: set username grace period and deposit (#416) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 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())` --- operator/runtime/mainnet/src/configs/mod.rs | 6 ++++-- operator/runtime/stagenet/src/configs/mod.rs | 6 ++++-- operator/runtime/testnet/src/configs/mod.rs | 6 ++++-- test/.papi/metadata/datahaven.scale | Bin 627667 -> 627667 bytes 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/operator/runtime/mainnet/src/configs/mod.rs b/operator/runtime/mainnet/src/configs/mod.rs index db7e60be..3bd49071 100644 --- a/operator/runtime/mainnet/src/configs/mod.rs +++ b/operator/runtime/mainnet/src/configs/mod.rs @@ -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; - 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 diff --git a/operator/runtime/stagenet/src/configs/mod.rs b/operator/runtime/stagenet/src/configs/mod.rs index 63c05aac..509734a7 100644 --- a/operator/runtime/stagenet/src/configs/mod.rs +++ b/operator/runtime/stagenet/src/configs/mod.rs @@ -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; - 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 diff --git a/operator/runtime/testnet/src/configs/mod.rs b/operator/runtime/testnet/src/configs/mod.rs index bc48c537..0ba71058 100644 --- a/operator/runtime/testnet/src/configs/mod.rs +++ b/operator/runtime/testnet/src/configs/mod.rs @@ -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; - 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 diff --git a/test/.papi/metadata/datahaven.scale b/test/.papi/metadata/datahaven.scale index a63800a7d3a479325216192462894c147ec14c4a..74c4129cc1309e6955671c0e29d8c78e1c94fbb7 100644 GIT binary patch delta 57 zcmcb-TF7M3lnJF8he_>F7M3lnJFBPfabe}#e!QAhnVFe^fua3v9V-yC0Wmueb8LTG I$N5YI0Ct-epa1{>