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

pallet-nfts: AttributeNamespace inconsistency between collection_attribute and set_collection_attribute #14295

Open
2 tasks done
erkkonet opened this issue Jun 2, 2023 · 0 comments
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.

Comments

@erkkonet
Copy link

erkkonet commented Jun 2, 2023

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

When using the frame_support::traits::tokens::nonfungibles_v2::Inspect/Mutate traits implementation in pallet-nfts, there is a discrepancy between the AttributeNamespace used for storing and retrieving collection attributes.

The setter fn set_collection_attribute uses AttributeNamespace::Pallet whereas the getter fn collection_attribute uses AttributeNamespace::CollectionOwner.

The result is that no data is found when trying to retrieve a previously stored value. The methods should be using the same namespace, probably CollectionOwner is the most appropriate.

Steps to reproduce

<T as Config>::Nonfungible::set_collection_attribute(collection, key, value)?;

let result = <T as Config>::Nonfungible::collection_attribute(collection, key);

The result will be None instead of the expected Some(value).

@github-actions github-actions bot added the J2-unconfirmed Issue might be valid, but it’s not yet known. label Jun 2, 2023
@juangirini juangirini added the T1-runtime This PR/Issue is related to the topic “runtime”. label Jun 7, 2023
@juangirini juangirini removed the T1-runtime This PR/Issue is related to the topic “runtime”. label Jun 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.
Projects
None yet
Development

No branches or pull requests

2 participants