During an update, several checks are performed:
capReserves
asserts that the length of the reserve is 2.
_getSlotsOffset
, also called in _init
, assert the length is not 0 (otherwise, it reverts due to underflow).
However, there is a path during the _init
of a pump (if lastTimestamp
is 0) that doesn't check if the reserve length exceeds 2. This could mislead a Well creator into thinking that the pump will work with more than 2 reserves, especially since many parts of the code are designed to handle more than 2 reserves. But any subsequent call with more than 2 reserves will revert.
Furthermore, if the reserve exceeds 3, it will write into the EMA reserve slots, causing the EMA last reserves to be incorrect until the next update.
Likelyhood: Low
If a pump is initialized (accidentaly or intentionally) with more than 2 reserves.
Impact: High
Slot corruption leading to unexpected behavior for users of a Well.
Confusing for Well implementers.
Instead of using the condition below in _capReserves
function, use it at the beginning of the update
function:
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.