Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

vatsa287
Copy link
Member

@vatsa287 vatsa287 commented Aug 1, 2024

A v1 implementation of DeDir - Decentralised Directory.

  • Basic Functionalities - create-registry, create-registry-entry, registry-entry-state-change.
  • Change states to be in enum format. Custom states will be from attributes.
  • Identifier creation/management.
  • Delegation/ Registry-Ownership management.

Abandoned. Do not merge.

Signed-off-by: Shreevatsa N <vatsa@dhiway.com>
@vatsa287 vatsa287 requested review from smohan-dw and amarts and removed request for smohan-dw August 3, 2024 06:14
amarts
amarts previously approved these changes Aug 5, 2024
Copy link
Member

@amarts amarts left a 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?

@vatsa287
Copy link
Member Author

vatsa287 commented Aug 5, 2024

LGTM

Is there any demo script planned to be implemented for the same?

@amarts
Sure it will be implemented.
It would be great if you can merge this PR, so I can push on top of this.

#[pallet::weight({0})]
pub fn create_registry(
origin: OriginFor<T>,
registry_id: RegistryIdOf<T>,
Copy link
Member

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.

Copy link
Member Author

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.

pub fn create_registry(
origin: OriginFor<T>,
registry_id: RegistryIdOf<T>,
attrs: Vec<(RegistryKeyIdOf<T>, RegistrySupportedTypeOf)>,
Copy link
Member

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

Copy link
Member Author

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.

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>>>,
Copy link
Member

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?

Copy link
Member Author

@vatsa287 vatsa287 Aug 7, 2024

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(&registry_id, registry);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registry ownership?

Copy link
Member Author

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.

pub fn create_registry_entry(
origin: OriginFor<T>,
registry_id: RegistryIdOf<T>,
registry_entry_id: RegistryEntryIdOf<T>,
Copy link
Member

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

pallets/dedir/src/lib.rs Outdated Show resolved Hide resolved
- 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>
@amarts
Copy link
Member

amarts commented Oct 28, 2024

done with #504

@amarts amarts closed this Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants