-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERC-721 example: fix panic re: approve_for
with nonexistent token
#2092
ERC-721 example: fix panic re: approve_for
with nonexistent token
#2092
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Need to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of other instances of calling self.owner_of
which panic when None
, could you fix those here too?
@ascjones done |
Summary
cargo-contract
orpallet-contracts
?In the current ERC-721 example used in integration tests (which is the source of the erc-721 example in ink-examples), the
approve_for
function will panic with the text '"Error with AccountId"' if the token id does not exist. This PR changes the function to return anError::TokenNotFound
in this case instead.I am using Prusti to verify correctness properties of the contract; the presence of this bug prevents the verification of a "panic-freedom" property.
Description
Updated the logic and added a corresponding test.
Checklist before requesting a review
CHANGELOG.md