Cat information is not updated during other transfer function (only safeTransferFrom is override), and s_ownerToCatsTokenId is never updated during any transfer. Consequently, getCatsTokenIdOwnedBy won't return the real list of tokens owned by a user.
During a bridge operation (mintBridgedNFT) or any other transfer functions, _updateOwnershipInfo is not called, leading to:
Failure to add the transferred NFT to s_ownerToCatsTokenId of the new owner.
Failure to update s_catInfo[tokenId].idx of the token.
Failure to add the previous owner in the array of the cat.
As a result, it will be impossible to bridge this NFT if the new owner only owns this NFT because bridgeNftToAnotherChain will try to remove the tokenId from an empty array. In the worst case, if the owner already has an NFT and tries to bridge a transferred NFT, it will remove the first NFT from the array, making it impossible to bridge this one.
Likelyhood: High
Occurs every time a transfer/bridge operation is executed.
Impact: High
getCatsTokenIdOwnedBy will return tokens not owned by the user or won’t return token owned by the user.
A bridge operation or any normal transfer can result in the loss of NFTs or the impossibility to bridge them.
Override __afterTokenTransfer and add _updateOwnershipInfo in it to update ownership information for every transfer.
Add _updateOwnershipInfo to mintBridgedNFT.
In _updateOwnershipInfo, update s_ownerToCatsTokenId by accessing the array of the previous owner and erase the transferred tokenId.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.