substrate icon indicating copy to clipboard operation
substrate copied to clipboard

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

Open iorveth opened this issue 5 years ago • 2 comments

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

iorveth avatar Jun 25 '21 17:06 iorveth

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.

iorveth avatar Jun 28 '21 07:06 iorveth

@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.

shawntabrizi avatar Jul 31 '21 15:07 shawntabrizi