Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Uniques burn extrinsic does not clear Instance metadata and attributes during execution #9207

Closed
iorveth opened this issue Jun 25, 2021 · 2 comments

Comments

@iorveth
Copy link

iorveth commented Jun 25, 2021

Instance attributes and metadata should be cleared during the burn extrinsic execution. https://github.com/paritytech/substrate/blob/master/frame/uniques/src/lib.rs#L473

@github-actions github-actions bot added the J2-unconfirmed Issue might be valid, but it’s not yet known. label Jun 25, 2021
@iorveth iorveth changed the title Uniques burn extrinsic does not clear instance metadata and attributes during execution Uniques burn extrinsic does not clear Instance metadata and attributes during execution Jun 25, 2021
@iorveth
Copy link
Author

iorveth commented Jun 28, 2021

I think we should also introduce new InstanceDestroyWitness similar to https://github.com/paritytech/substrate/blob/master/frame/uniques/src/lib.rs#L402 to be able to properly benchmark this operation and avoid possible issues.

@shawntabrizi shawntabrizi added I3-bug The node fails to follow expected behavior. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. labels Jul 31, 2021
@shawntabrizi shawntabrizi added Z5-intended and removed I3-bug The node fails to follow expected behavior. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder J2-unconfirmed Issue might be valid, but it’s not yet known. Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. labels Jul 31, 2021
@shawntabrizi
Copy link
Member

@iorveth

Thanks for opening up the issue here, however the behavior with metadata is intended. Here is some historical context:

When developing the Assets pallet, we decided to keep the asset metadata as a separate set of functionalities from the underlying assets themselves. Asset metadata is strictly a "user friendly" feature, and not one that is required for any on-chain consensus, and thus from the perspective of a very strict runtime engineer, it is not necessary.

However, such metadata can be useful for UX, so by separating these functions, we allow the runtime developer to potentially opt in or opt out of these additional state and weight for using the metadata.

This same approach and API was brought to the Uniques pallet during development. While it is arguable that metadata is much more relevant for NFTs, keeping a familiar API also makes sense.

So, in addition to calling burn on the asset, you must call clear_metadata which will separately clean up the metadata information and free any associated deposit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants