There is no upper limit when setting max lock duration and max boost. The owner can set an extremely high amount or an extremely low amount, and the value can be changed any time
Set an upper limit to both functions, for example, max boost can only be set to 10x. Also, make sure that the value set cannot be too low.
https://github.com/Cyfrin/2023-12-stake-link/blob/549b2b8c4a5b841686fceb9c311dca9ac58225df/contracts/core/sdlPool/LinearBoostController.sol#L45-L59
The boost amount depends on four values: amount
, maxBoost
, _lockingDuration
, maxLockingDuration
Since there is no control of the minimum amount to be locked, the calculation may truncate to zero if maxBoost is too high, _lockingDuration
is too low and maxLockingDuration
is too high.
It also depends on the decimal places of _amount
, in case other sdlTokens have lower decimal values.
Consider adding a minimum amount to lock to prevent truncation from happening.
https://github.com/Cyfrin/2023-12-stake-link/blob/549b2b8c4a5b841686fceb9c311dca9ac58225df/contracts/core/sdlPool/LinearBoostController.sol#L36-L40
In function getLockIdsByOwner()
, the function loops over every single lock that has been created. If the maxLockId is too large, the function will fail due to out of gas error
Since anyone can create a lock with any amount through _storeNewLock
in SDLPoolPrimary, and the lastLockId
is always incremented but never decreased, it makes out of gas errors more prominent.
Recommend having an upper limit to the lastLockId, and also consider decreasing the max lock count when all the amount
is withdrawn. The same issue applies to SDLPoolSecondary, with queuedLocks having no upper bound.
https://github.com/Cyfrin/2023-12-stake-link/blob/549b2b8c4a5b841686fceb9c311dca9ac58225df/contracts/core/sdlPool/base/SDLPool.sol#L177-L187
https://github.com/Cyfrin/2023-12-stake-link/blob/549b2b8c4a5b841686fceb9c311dca9ac58225df/contracts/core/sdlPool/SDLPoolPrimary.sol#L279-L291
SDLPool is currently a normal contract. Usually, base pools are set to abstract contract, to prevent the base pool from ever being deployed. If the SDLPool is mistakenly deployed, it will cause confusion to both the developers and the users, as there will be another pool address with limited capabilities
https://github.com/Cyfrin/2023-12-stake-link/blob/549b2b8c4a5b841686fceb9c311dca9ac58225df/contracts/core/sdlPool/base/SDLPool.sol#L14-L17
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.