Description: In SoulboundProfileNFT.sol
, the burnProfile
function performs two checks that verify the same condition. The second check ownerOf(tokenId) == msg.sender
is redundant because the profileToToken
mapping already ensures ownership.
This is redundant because:
profileToToken[msg.sender]
only contains tokens that belong to their respective owners
If a user has a token in this mapping, they are definitely the owner
There's no way for a token to exist in profileToToken
mapping with a different owner
Impact:
Unnecessary ownerOf
call costs extra gas
Every profile burn operation costs more gas than necessary
Proof of Concept:
The following scenarios all lead to the same result with or without the second check:
If user has no profile: First require fails
If user has profile: First require passes and ownership is already guaranteed
If token exists but user isn't owner: Impossible scenario due to profileToToken
mapping design
Recommended Mitigation: Remove the redundant ownership check:
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.