Unnecessary processing and event emission for already whitelisted collections.
The _whiteListCollection
function performs unnecessary operations when attempting to whitelist an already whitelisted collection. This leads to redundant processing and gas consumption.
When a collection that is already whitelisted (_whiteList[collection] == true
) is passed to the whiteList
function with enable
set to true
, the function:
Unnecessarily iterates through the _collections
array.
Redundantly sets _whiteList[collection] = true
.
Emits a CollectionWhiteListUpdated
event, even though no change occurred.
Similar issue is in enableWhiteList function.
Increased gas consumption for transactions that attempt to whitelist already whitelisted collections.
Potential confusion due to emitted events that don't represent actual state changes.
Manual review
Add an early return condition in the _whiteListCollection
function to skip processing if the collection's whitelist status is not changing:
Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.
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.