Closed code423n4 closed 2 years ago
pauliax
Consider introducing a reasonable upper limit for vaderPairs length, because it could grow too big to fit in the block limits and there is no way to remove it. This will make functions that iterate over all the pairs fail.
for (uint256 i; i < totalPairs; ++i)
There are several possible mitigation steps. You can introduce an upper limit. Or you can add a removal function. Or you can use something like EnumerableSet to store pairs, but this will increase the gas usage: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol
There can be no hard limit as block gas limits and gas cost fluctuate.
Dup #110
Handle
pauliax
Vulnerability details
Impact
Consider introducing a reasonable upper limit for vaderPairs length, because it could grow too big to fit in the block limits and there is no way to remove it. This will make functions that iterate over all the pairs fail.
Recommended Mitigation Steps
There are several possible mitigation steps. You can introduce an upper limit. Or you can add a removal function. Or you can use something like EnumerableSet to store pairs, but this will increase the gas usage: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol