NFTBridge
60,000 USDC
View results
Submission Details
Severity: low
Invalid

Lack of update to `_collections` after whishlist removal makes its length increase only

Summary

When removing a collection from whitelist, L2 bridge updates the whitelist linked list to remove it. The L1 doesn't remove the collection from the _collections array. The length of _collections will increase only and cost more gas.

Vulnerability Details

Bridge.sol::_whiteListCollection

function _whiteListCollection(address collection, bool enable) internal {
if (enable && !_whiteList[collection]) {
bool toAdd = true;
uint256 i = 0;
while(i < _collections.length) {
if (collection == _collections[i]) {
toAdd = false;
break;
}
i++;
}
if (toAdd) {
_collections.push(collection);
}
}
_whiteList[collection] = enable;
}

Impact

  1. getting and updating whitelist cost more gas

  2. break consistency with L2 bridge

Tools Used

manual review

Recommendations

add _collections removal logic in Bridge.sol::_whiteListCollection.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

invalid-unwhitelist-on-L1-do-not-pop-from-array

LightChaser: Low-19, Gas-10

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.