-
Notifications
You must be signed in to change notification settings - Fork 6
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(sub0): nonfungibles pop-api + pallet implementation #353
feat(sub0): nonfungibles pop-api + pallet implementation #353
Conversation
…onfungibles' into chungquantin/sub0-nonfungibles
f20d191
to
11977d1
Compare
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.
Amazing work! Especially in the short amount of time.
I feel there has to be a way to reduce the amount of changes made throughout the repository. E.g. BoundedSlice implements the PartialEq
trait which we might be able to use and therefore don't have to make the changes you made regarding the PartialEq
. In addition, I think the changes in the api's pallet mock.rs are not required. This all makes the sub0 branch cleaner in terms of additional changes and reduces the amount of possible errors that can occur.
Not now, but the benchmark and weight results of destroy
are incorrect. Just leaving this here for later reference, as well as the other comments starting with "Not now,"
For all, inluding the other comments, please be thoughtful on the amount of time spend as we want this to merge asap. It might also have to be rebased after the sponsorship gets merged.
The integration tests are passing apart from the event assertions for the fungibles, more specifically, in the transfer_works
and approve_works
test this event assertion is failing, there might be caused due to the accout mapping, unfortunately I couldn't figure it out. This shouildn't stop merging this PR though.
// TODO: Do we need another storage item to keep track of number of holders of a | ||
// collection | ||
let _ = | ||
AccountBalance::<T, I>::clear_prefix(collection, collection_details.items, None); |
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.
Not now, I think this is a storage write per account that is removed here. This means that we might need to add the amount of items in the collection in the witness data.
// collection | ||
let _ = | ||
AccountBalance::<T, I>::clear_prefix(collection, collection_details.items, None); | ||
let _ = Allowances::<T, I>::clear_prefix((collection,), collection_details.items, None); |
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.
Not now, this is not included in the benchmark function and needs to be accommodated for. This again should added to the witness data in some way.
This comment and the above give reason to change the destroying of a collection like done in pallet assets. This needs to be though out how this will look like and whether this improves things.
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.
@@ -141,6 +124,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { | |||
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) | |||
/// Storage: `Nfts::Attribute` (r:1001 w:1000) | |||
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`) | |||
/// Storage: `Nfts::AccountBalance` (r:1 w:0) |
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.
FYI: this showed me that there could be something wrong in the current implementation of destroy
's benchmark logic. Always super valuable to see the changes in the weight results.
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.
@@ -644,39 +641,41 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { | |||
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) | |||
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0) | |||
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) | |||
/// Storage: `Nfts::AccountBalance` (r:2 w:2) |
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.
Not now, this is the counter argument for adding this storage map. Nothing to do now but important to re-evaluate later on.
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.
45ac5ca
to
5bcdd66
Compare
refactor: item metadata fix: item metadata tests test(nonfungibles): add mint and burn tests refactor: non fungibles sub0 (#364) Co-authored-by: Tin Chung <[email protected]> fix: pallet tests + integration tests refactor: remove unused types refactor(nonfungibles): CollectionConfig parameter chore: resolve review comments refactor: item metadata fix: item metadata tests test(nonfungibles): add mint and burn tests refactor: non fungibles sub0 (#364) Co-authored-by: Tin Chung <[email protected]> fix: pallet tests + integration tests refactor: remove unused types refactor(nonfungibles): CollectionConfig parameter chore: remove unused code
e00f8be
to
8745056
Compare
3fa6003
into
chungquantin/sub0-pallet_nfts
Co-authored-by: Daanvdplas <[email protected]>
Nonfungible contracts size:
Description
In an effort to provide a unifying experience for developers to access runtime functionality for non-fungible tokens, APIs compliant to the PSP34 standard will be provided, as well as a set of extra functions (see Management). The interface as defined by this specification will be accessible for smart contracts via:
Note that the lack of version equals latest. As an example, the user could explicitly specify the version as:
The PR includes changes made to the forked pallet-nfts following what has been discussed in the internal spec. Introducing two new pallets;
pallets/nfts
: Changes made to the forked version to add new storage itemsAccountBalance
andAllowances
and update the following logic + unit tests to support the new storage items.pallets/api/nonfungibles
: Built on top of thepallet-nfts
to expose READs and DISPATCHs for pop-api library.The Nonfungible API provides the contract ability to mint / burn a new item, transfer and approve following the PSP34 Standard.
There are additional features to manage the Nonfungible such as create / destroy a collection, set / clear metadata, set / clear / approve / cancel_approve item attribute.
Becnhmarking:
AccountBalance
read case.approved_transfer
,transfer
andcancel_approval
to countAllowances
storage read.