-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeDir: Add new pallet Decentralized Directory
#495
Conversation
Signed-off-by: Shreevatsa N <vatsa@dhiway.com>
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.
LGTM
Is there any demo script planned to be implemented for the same?
pallets/dedir/src/lib.rs
Outdated
#[pallet::weight({0})] | ||
pub fn create_registry( | ||
origin: OriginFor<T>, | ||
registry_id: RegistryIdOf<T>, |
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.
Registry ID is an identifier that should be returned after a successful operation.
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.
As per earlier conversation identifier
creation was passed onto app side.
Would move the logic here if required.
pallets/dedir/src/lib.rs
Outdated
pub fn create_registry( | ||
origin: OriginFor<T>, | ||
registry_id: RegistryIdOf<T>, | ||
attrs: Vec<(RegistryKeyIdOf<T>, RegistrySupportedTypeOf)>, |
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.
The registry entry attributes should also help to identify the lookup fields that should be used for creating entry identifiers
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.
With the discussion with @amarts previously if the identifier is available then the registry_entry attributes would be fetch able.
pallets/dedir/src/lib.rs
Outdated
registry_id: RegistryIdOf<T>, | ||
attrs: Vec<(RegistryKeyIdOf<T>, RegistrySupportedTypeOf)>, | ||
// TODO: Use Runtime Constant for upper bound | ||
additional_states: Option<BoundedVec<BoundedVec<u8, ConstU32<32>>, ConstU32<10>>>, |
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.
why can't this be enums? also why can't this be part of attrs?
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.
Ack.
As per newer design the states supported shall not be dynamic as implemented above but fixed to Active
, Revoked
, Draft
which will become enum type.
So any custom state can be part of attrs itself.
} | ||
} | ||
|
||
Registries::<T>::insert(®istry_id, registry); |
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.
registry ownership?
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.
Delegation/Ownership is not implemented in this version. Will do with next commit.
pallets/dedir/src/lib.rs
Outdated
pub fn create_registry_entry( | ||
origin: OriginFor<T>, | ||
registry_id: RegistryIdOf<T>, | ||
registry_entry_id: RegistryEntryIdOf<T>, |
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.
again registry_entry_id is the result of the operation
- Identifier management: Validation of ss58 and ident type on chain - State as enums: Make states as enums, dynamic states can be through attributes - Address review comments Signed-off-by: Shreevatsa N <vatsa@dhiway.com>
Signed-off-by: Shreevatsa N <vatsa@dhiway.com>
done with #504 |
A
v1
implementation of DeDir - Decentralised Directory.create-registry
,create-registry-entry
,registry-entry-state-change
.enum
format. Custom states will be fromattributes
.Abandoned. Do not merge.