code-423n4 / 2021-12-vader-findings

0 stars 0 forks source link

list of vader pairs might grow too large #184

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

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.

  for (uint256 i; i < totalPairs; ++i)

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

SamSteinGG commented 2 years ago

There can be no hard limit as block gas limits and gas cost fluctuate.

jack-the-pug commented 2 years ago

Dup #110