Submitted by zzzitron
The beat cannot be called anymore and price information will not be updated
Condition:
The below proof of concept demonstrates that the operate will revert with 100% wallspread. The full test code can be found here as well as the diff from Operator.t.sol.
In the test, the wallspread was set to 10000, which is 100% (line 51). The price was set so that the lower market should be deployed (line 59). In the market deployment logic (Operator::_activate) will revert due to division by zero, and operate will fail.
Once this condition is met, the operate cannot be called and Heart::beat cannot be called as well, since the Heart::beat is calling Operator::opearate under the hood. As the result the price can never be updated. But other codes who uses the price information will not know that the price information is stale. If the upper wall is active and still have the capacity, one can swap from the upper wall using the stale information, which might cause some loss of funds.
The main cause is that the RANGE::setSpreads function fails to check for wallSpread_ == 10000. If the setter does not allow the wallSpread to be 100%, the price of the lower wall will not go to zero.
In the RANGE::updatePrices, the price of lower wall will be zero if the wallSpread is 100%.
If the price of lower wall is zero, the Operator::_activate will fail for the lower cushion.
Foundry
Mitigation suggestion: line 245. Forbid wallSpread to be 100%.
Oighty (Olympus) disagreed with severity and commented:
0xean (judge) commented:
