-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Identity Pallet to Runtime and Configuration (#750)
* pallet_identity as dep * added pallet identity * merge main * Review #750 (#755) * add treasury module to identity configuration; use default idendity weights; use parameter_types macro instead of Const * improve comments * fmt * increase e2e timeout --------- Co-authored-by: magecnion <magecnion@gmail.com>
- Loading branch information
1 parent
9ffd116
commit 8324424
Showing
7 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use crate::{ | ||
currency::calculate_deposit, AccountId, Balance, Balances, Runtime, RuntimeEvent, Signature, | ||
Treasury, | ||
}; | ||
use frame_support::parameter_types; | ||
use frame_system::EnsureRoot; | ||
use parachains_common::DAYS; | ||
|
||
parameter_types! { | ||
pub const MaxSubAccounts: u32 = 100; | ||
pub const MaxAdditionalFields: u32 = 100; | ||
pub const MaxRegistrars: u32 = 20; | ||
pub const PendingUsernameExpiration: u32 = 7 * DAYS; | ||
pub const MaxSuffixLength: u32 = 7; | ||
pub const MaxUsernameLength: u32 = 32; | ||
pub const BasicDeposit: Balance = calculate_deposit(1, 258); | ||
pub const ByteDeposit: Balance = calculate_deposit(0, 1); | ||
pub const SubAccountDeposit: Balance = calculate_deposit(0, 53); | ||
} | ||
|
||
type IdentityForceOrigin = EnsureRoot<AccountId>; | ||
type IdentityRegistrarOrigin = EnsureRoot<AccountId>; | ||
|
||
impl pallet_identity::Config for Runtime { | ||
type RuntimeEvent = RuntimeEvent; | ||
type Currency = Balances; | ||
// Add one item in storage and take 258 bytes | ||
type BasicDeposit = BasicDeposit; | ||
// Does not add any item to the storage but takes 1 bytes | ||
type ByteDeposit = ByteDeposit; | ||
// Add one item in storage and take 53 bytes | ||
type SubAccountDeposit = SubAccountDeposit; | ||
type MaxSubAccounts = MaxSubAccounts; | ||
type IdentityInformation = pallet_identity::legacy::IdentityInfo<MaxAdditionalFields>; | ||
type MaxRegistrars = MaxRegistrars; | ||
type Slashed = Treasury; | ||
type ForceOrigin = IdentityForceOrigin; | ||
type RegistrarOrigin = IdentityRegistrarOrigin; | ||
type OffchainSignature = Signature; | ||
type SigningPublicKey = <Signature as sp_runtime::traits::Verify>::Signer; | ||
type UsernameAuthorityOrigin = EnsureRoot<AccountId>; | ||
type PendingUsernameExpiration = PendingUsernameExpiration; | ||
type MaxSuffixLength = MaxSuffixLength; | ||
type MaxUsernameLength = MaxUsernameLength; | ||
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>; // TODO is not recommended use default weights but currently there is a function within the | ||
// benchmarks pallet code that cause a panic because it uses `Sr25519` signature type: https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/identity/src/benchmarking.rs#L608 | ||
// whereas our runtime uses `Ecdsa` signature type | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters