Skip to content

Fixed the default commodity_info bug#6

Open
iStrike7 wants to merge 1 commit into
danforbes:masterfrom
iStrike7:bnxDefBug
Open

Fixed the default commodity_info bug#6
iStrike7 wants to merge 1 commit into
danforbes:masterfrom
iStrike7:bnxDefBug

Conversation

@iStrike7

Copy link
Copy Markdown

In the pallet's "src/lib.rs" where the "nft::UniqueAssets" trait is implemented, both the burn and the transfer methods have a bug.
The problem is that when creating an instance of the tuple representing the commodity (lines 271 & 302) to be used for searching the storage, the default value is used, i.e., "<T as Trait>::CommodityInfo::default()". Due to this when ever the burn or transfer methods are called the search fails with a panic. This bug is not caught by the tests, as the tests themselves use default values.

This bug was fixed by adding the commodity_info as an input to the extrinsic call. This approach was taken to fix the bug with minimal changes to the underlying logic, and is hence not an ideal solution.

…an input to the extrinsic call. This approach was taken to fix the bug with minimal changes to the underlying logic, and is hence not an ideal solution.
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.

1 participant