-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add GenesisConfig to identity pallet #14774
base: master
Are you sure you want to change the base?
Changes from 2 commits
3a6de3a
55ba65c
232fdf0
6a03dc6
587a6fc
89774f9
b52f93e
b5eae62
d35a8d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -79,6 +79,7 @@ mod types; | |||||||||
| pub mod weights; | ||||||||||
|
|
||||||||||
| use frame_support::traits::{BalanceStatus, Currency, OnUnbalanced, ReservableCurrency}; | ||||||||||
| use scale_info::prelude::string::String; | ||||||||||
| use sp_runtime::traits::{AppendZerosInput, Hash, Saturating, StaticLookup, Zero}; | ||||||||||
| use sp_std::prelude::*; | ||||||||||
| pub use weights::WeightInfo; | ||||||||||
|
|
@@ -201,6 +202,44 @@ pub mod pallet { | |||||||||
| ValueQuery, | ||||||||||
| >; | ||||||||||
|
|
||||||||||
| #[pallet::genesis_config] | ||||||||||
| pub struct GenesisConfig<T: Config> { | ||||||||||
| pub identities: Vec<(T::AccountId, String)>, | ||||||||||
|
||||||||||
| pub identities: Vec<(T::AccountId, String)>, | |
| pub identities: Vec<(T::AccountId, IdentityInfo)>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this was done to not require trait bounds on the IdentityInfo type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even so, it seems much more preferable to be able to specify all other identity-related fields in genesis config, so let's figure out what the trait bounds should be here...
Oh, it's just T::MaxAdditionalFields, so we should just use that:
| pub identities: Vec<(T::AccountId, String)>, | |
| pub identities: Vec<(T::AccountId, IdentityInfo<T::MaxAdditionalFields>)>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for comments both, I didn't use IdentityInfo initially as it wanted Deserialize<'_>, I agree it is preferable to support this though, I will try to add serde::[Des|S]erialize on these types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is what i meant with trait bounds. Normally we just use POD types here to not having to use Serde from within the runtime.
I think its fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Vec<u8> would be a bit less biased than a String - otherwise the encoding is not fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll probably need BoundedVec then, no reason to not make this derive MEL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, uses BoundedVec now
ggwpez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much sense does it make not to provide any judgments?
Having no judgement is as good as having no identity at all.
But not sure if its possible without also adding a genesis judge…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you suggested it, we are now depending upon you to implement a genesis identity judge :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be mindful that
DatainIdentityInfois truncated to 32 bytes (see docs), so it is recommended to pass a hash of the data rather than the data itself for stuff likedisplay.