The Starklane contract suffers from an architectural flaw where the _collections
array grows indefinitely as new collections are added, without a corresponding mechanism to remove unused or un-whitelisted collections. This unbounded growth poses a significant risk of gas limit exhaustion in functions that iterate over this array, potentially leading to a denial of service for critical contract functionalities.
Functions: _whiteListCollection
, getWhiteListedCollections
and thus withdrawToken
.
File: Bridge.sol
Collection Addition:
In the _whiteListCollection
function, new collections are unconditionally added to the _collections
array:
Whitelist Iteration:
The getWhiteListedCollections
function iterates over the entire _collections
array:
Lack of Removal Mechanism:
There is no implemented functionality to remove collections from the _collections
array when they are un-whitelisted or become obsolete.
Gas Limit Exhaustion: As the protocol matures and more collections are added, the _collections
array will grow indefinitely. This growth will increase the gas cost of functions that iterate over this array, eventually leading to out-of-gas errors.
Denial of Service: Critical functionalities that depend on processing the entire collections list may become inoperable due to excessive gas consumption.
Scalability Issues: The protocol's ability to add new collections will be severely limited over time.
Increased Operational Costs: Users may face higher transaction fees for operations involving whitelist checks.
Add a large number of collections to the whitelist over an extended period.
Attempt to call getWhiteListedCollections
or other functions that iterate over _collections
.
Observe increasing gas costs and eventual transaction failures due to out-of-gas errors.
Implement a removal mechanism:
Modify _whiteListCollection
to handle both addition and removal:
Implement a maximum cap on the number of whitelisted collections.
Consider using a more gas-efficient data structure for storing and querying whitelisted collections.
LightChaser: Low-19, Gas-10
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.