Repository navigation
get approved existence override for consecutive - #944
Merged
Merged
Conversation
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
brozorec
requested changes
Oct 13, 2026
Collaborator
There was a problem hiding this comment.
Review — stellar-tokens
-
packages/tokens/src/non_fungible/overrides.rs:67— the defaultget_approvednow checks that the token exists throughBase::owner_of(called insideBase::get_approved) instead ofSelf::owner_of. #934, which this PR closes, requires that check to go through the contract type's ownowner_of.RoyaltySupportin the same file already does it that way. Now a contract type that overridesowner_ofbut notget_approvedstill compiles, andget_approvedfails with#200on live tokens.ConsecutiveandConsecutiveVoteswork only because each got a hand-written override. Make the defaultlet _ = Self::owner_of(e, token_id); Base::get_approval_entry(e, token_id), and keepConsecutive::get_approvedas the cheaper path. -
packages/tokens/src/non_fungible/extensions/combinations/storage.rs:114— no test reaches the newConsecutiveVotes::get_approvedoverride. Theconsecutive_votes_*tests only approve and movelast_id, which has its ownOwnerentry, soBase::owner_ofsucceeds there anyway. With the override deleted, all 125 NFT tests still pass, butget_approvedon id 0 of a three-tokenConsecutiveVotesbatch panics with#200(reproduced). Add a test that callsget_approved, and an approvedtransfer_from, on an id other than the last one in aConsecutiveVotesbatch. -
PR description— the body has onlyFixes #934and the CodeRabbit summary, but the template asks for a description of the changes. The PR changes an error code for existing callers: on every contract type,transfer_fromandburn_fromby a non-owner on a token that doesn't exist now fail with#200instead of#202. State that, and explain why theSelf::owner_ofdefault from #935 was replaced. The CodeRabbit line saying consecutive collections "now correctly recognize" approvals during transfers is misleading. They already did onmain. The newConsecutive::check_spender_approvalonly keeps them working now thatBase::get_approvedchecks existence. -
packages/tokens/src/non_fungible/extensions/consecutive/storage.rs:201— this doc comment was copied fromBase::check_spender_approvalbut dropped its caveat: the function checks neither who ownstoken_idnor authorization. As written, it reads as a complete check. In fact,spender == ownerpasses for whateverowneris passed in, so a caller that doesn't also runConsecutive::updatelets any account through. Restore the "Low-level function … without checking ownership oftoken_idand without handling authorization" wording. -
packages/tokens/src/non_fungible/test.rs:478— the comment records the error code from before this PR (#202), which means nothing once the PR is merged. Remove the history and keep only the note thatspenderis neither owner nor operator.
brozorec
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #934
PR Checklist
Summary by CodeRabbit