stacks-core icon indicating copy to clipboard operation
stacks-core copied to clipboard

nft-burn? returns unexpected error u1

Open friedger opened this issue 2 years ago • 1 comments

Describe the bug The documentation says the following for nft-burn? (https://docs.stacks.co/write-smart-contracts/language-functions#nft-burn)

If an asset identified by asset-identifier doesn't exist, this function will return an error with the following error code: (err u1)

However, calling nft-burn? with tx-sender who does not own the nft returns (err u1) even if the asset exists.

Steps To Reproduce Clone the repo and run clarinet test

burn nft by owner https://github.com/Light-Labs/ryder-nft/blob/1708febcc0339955752951b809e35d9dfdf6573f/backend-stacks/tests/ryder-nft_test.ts#L97 ==> succeeds

burn nft by user that does not own the existing id https://github.com/Light-Labs/ryder-nft/blob/1708febcc0339955752951b809e35d9dfdf6573f/backend-stacks/tests/ryder-nft_test.ts#L114 ==> burn fails (test successful)

Expected behavior Any tx-sender can call nft-burn? if the contract supports it

friedger avatar May 26 '22 15:05 friedger

This is a documentation bug. Also, code in next has been updated to use clearer variable names to better indicate the error condition being triggered.

jcnelson avatar Jun 06 '22 15:06 jcnelson

Assigning to @obycode for the time being. Please feel free to re-assign.

jcnelson avatar Feb 22 '23 02:02 jcnelson

This has been updated in the repo and shows correctly on the docs site:

(err u1) -- sender does not own the specified asset

obycode avatar Mar 14 '23 15:03 obycode