-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: Bucket level read access #79
Merged
Merged
Conversation
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
…nfts to runtime and to file system pallet, impl do_create_bucket
Base addition of the BucketNfts pallet
Implements basic share_access extrinsic
ReadProvidersInterface trait fn derive_bucket_id implemented by Providers pallet. Test success share_access extrinsic.
Removed and added redundant checks across do_* methods
…d access regex in item metadata
e59fb3b
to
c1e2d15
Compare
ffarall
requested changes
May 29, 2024
TDemeco
reviewed
May 30, 2024
…sting bucket id, add docs
ffarall
approved these changes
May 31, 2024
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.
Merge from main, solve conflicts and ready to go. Great work!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds
pallet_nfts
(FRAME pallet) andpallet_bucket_nfts
(wrapper around the NFTs pallet) to the runtime, fulfilling the need to distribute NFTs/items to users whom a bucket owner wishes to grant read access to.Bucket NFTs Pallet
The reason for creating a new bucket NFTs pallet, is to provide ergonomic extrinsics which dApps and parachains can call and be certain they have not missed any underlying requirements which StorageHub imposes related to managing NFTs. While the pallet is small, and is mostly a wrapper around the NFTs pallet, it could potentially grow overtime catering to new unforseen usecases.
As of right now, this first iteration ensures the proper metadata is set to the items created within collections corresponding to a bucket. The only metadata required for MSPs to properly respond to user requests, is the
read_access_regex
. A finite byte field which determines which files a user owning this item has access to. Without this particular field, users would be denied all read requests sent to MSPs.NFTs Pallet (FRAME)
While we do offer ergonomic extrinsics within bucket NFTs pallet, users and bucket owners can always directly call into the NFTs pallet. While it was first decided to disable the NFTs pallet extrinsics which would force our pallet to implement a lot of redundant logic, it is not insecure nor breaking to have users bypass the bucket NFTs pallet. They would only have to ensure they meet the requirements set by StorageHub (e.g.
read_access_regex
).This enables all the features already offered by the pallet and greatly increases the potential use cases of StorageHub.
Notable Features
File System Pallet Extrinsics:
create_bucket
: Allows users to create private or public buckets, which determines whether to create a corresponding collection in the NFTs pallet.update_bucket_privacy
: Enables users to update the privacy settings of their bucket post-creation.create_and_associate_collection_with_bucket
: Allow users to create a new collection and associate it with a bucket. This is helpful when you want to overwrite a collection or a set one when there is none present set to the bucket (this can happen when the bucket is private and a user deletes the collection by calling the NFTs pallet directly).Bucket NFTs Pallet Extrinsics:
share_access
: Allows bucket owners to share access by setting aread_access_regex
on a newly created item in the NFTs pallet, owned by the recipient account.update_read_access
: Lets bucket owners update theread_access_regex
of any item in the collection. Options includeNone
(no access) andSome(regex)
.Bucket ID Generation:
derive_bucket_id
trait method fromReadProvidersInterface
, implemented by the Providers pallet. This method hashes (Hasher -Other unrelated features
File system pallet now uses provider Ids across the board instead of the base provider account Ids.