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

Mutable properties #269

Closed
wants to merge 7 commits into from
Closed

Mutable properties #269

wants to merge 7 commits into from

Conversation

arrudagates
Copy link

@arrudagates arrudagates commented Jan 23, 2023

This PR implements the ability to allow the current owner of an NFT to mutate properties that were set as mutable by the collection issuer prior to being sent to the new owner. Closes #198

Please do let me know if this implementation should be done differently, I just wanted to give a head start to this feature and am flexible to refactoring this PR entirely.

Regarding the arguments to the set_property call including the mutable field, this is handled by ignoring the value of that field if the user is not the collection issuer (which means they can't modify the mutability of the property), but I believe it would be a lot cleaner if we broke it down into 2 distinct calls: set_property and set_property_mutability, the former would be reverted to how it's arguments were previously, and the latter would be responsible for changing the value of the mutable field by the collection issuer (if they're also the current owner of the NFT).

@Szegoo
Copy link
Contributor

Szegoo commented Jan 25, 2023

I believe it would be a lot cleaner if we broke it down into 2 distinct calls: set_property and set_property_mutability

Yes, this would make sense, but I don't think it is bad the way it is now. I am interested to hear the opinions of others here.

Copy link
Contributor

@Szegoo Szegoo left a comment

Choose a reason for hiding this comment

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

LGTM; The integration test will also need to be updated. But that should be probably done after we decide whether we want to have two separate calls, set_property and set_property_mutability

Copy link
Contributor

@ilionic ilionic left a comment

Choose a reason for hiding this comment

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

Thank you! Works well.
I see how splitting set_property and set_property_mutability would make things cleaner in this case, but need double check few other implementations. Will get back

pallets/rmrk-core/src/tests.rs Show resolved Hide resolved
Copy link
Contributor

@ilionic ilionic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!
Not against splitting set_property and set_property_mutability if it makes code cleaner. But it seems like might require storage migration, so for @HashWarlock to chime in.
Integration tests could be addressed separately.

@HashWarlock
Copy link
Contributor

What would migration for storage look like? This will have a big impact for our PhalaWorld & Stakepool V2 implementation, so we need to prepare for this.

We should also take a look at how Attributes (Uniques v2 NFTs pallet) handles the ability to edit an Attribute for an Item since the future RMRK pallet will be ported to be tightly coupled with the Uniques v2 Pallet. We can see the implementation here https://github.com/paritytech/substrate/blob/master/frame/nfts/src/features/attributes.rs#L22 with the types settings here https://github.com/paritytech/substrate/blob/248fdf0d4b5e3758cfdadb283b5eca5f0731e466/frame/nfts/src/types.rs#L360

@h4x3rotab may have some input as well on how to best implement this for future compatibility.

@h4x3rotab
Copy link
Contributor

Currently Khala has a blockchain storage of around 300MB. Among them, 200MB are RMRK NFT properties. Not sure if we migrate the full properties, we need to suspend the blockchain to do multi-bock migrations. If so, we would like to avoid it as much as possible, because a multi-block migration can cause tremendous chaos in our live parachain.

@arrudagates
Copy link
Author

arrudagates commented Feb 1, 2023 via email

@arrudagates arrudagates deleted the gabriel-mutable_properties branch July 29, 2023 00:17
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.

Add Mutability to Properties
5 participants