Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Update NFT module to use internal functions to save data to stores #9004

Closed
Tracked by #7245
Incede opened this issue Sep 18, 2023 · 0 comments
Closed
Tracked by #7245

Update NFT module to use internal functions to save data to stores #9004

Incede opened this issue Sep 18, 2023 · 0 comments
Assignees
Milestone

Comments

@Incede
Copy link
Contributor

Incede commented Sep 18, 2023

Description

  • The NFT module defines the createNFTEntry function which is responsible for creating a new NFT and ensuring that the NFT’s attributesArray array does not have duplicate modules
  • The createNFTEntry function is never called. Instead, the nftStore.save method is called directly in many locations. In some locations, such as in the create method, the attributeArray uniqueness check is copy-pasted, while in others this uniqueness property is not enforced.
  • In particular, two places may result in the NFT having duplicate module attributes
    When a foreign NFT is received (lisk-sdk/framework/src/modules/nft/cc_commands/cc_transfer.ts#L142-L145)
    When a foreign NFT is bounced (lisk-sdk/framework/src/modules/nft/cc_commands/cc_transfer.ts#L149-L152)
  • Other instances
    lisk-sdk/framework/src/modules/nft/cc_commands/cc_transfer.ts#L116
    lisk-sdk/framework/src/modules/nft/method.ts#L977
  • Similarly createUserEntry function is not used here and here
  • Similarly createEscrowEntry function is not used here

Acceptance Criteria

  • All places, including the ones mentioned above where internal functions can be used to save data to stores must be checked and updated
  • Unit tests must be added to check there are no duplicate module attributes

Additional Information

release/6.1.0

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

No branches or pull requests

4 participants