_validPrice
can include floor and ceiling values when checking the validity
#3
Labels
_validPrice
can include floor and ceiling values when checking the validity
#3
Description
A price is considered valid if the internal method
_validPrice
returns true.review-volt-core-2022-09/code/contracts/peg/PriceBoundPSM.sol
Lines 122 to 135 in 5826c86
This method checks if the provided price is strictly greater than the floor and strictly less than the floor.
review-volt-core-2022-09/code/contracts/peg/PriceBoundPSM.sol
Lines 129 to 134 in 5826c86
These methods are taken from the
Decimal
library.review-volt-core-2022-09/code/contracts/external/Decimal.sol
Lines 163 to 177 in 5826c86
Using a strictly greater/less check will exclude the values of floor and ceiling as being valid. This forces the governance to add floor and ceiling values similar to
floor = 0.7999999999999
andceiling = 1.199999999999
to describe a valid interval from0.8
to1.2
, included.If the check would accept the limits as valid, the governance could set
floor = 0.8
andceiling = 1.2
, which are a lot easier to reason about and verify.Recommendation
Consider using the methods
greaterThanOrEqualTo
andlessThanOrEqualTo
provided byDecimal
to avoid using awkward values.review-volt-core-2022-09/code/contracts/external/Decimal.sol
Lines 179 to 193 in 5826c86
[optional] References
The text was updated successfully, but these errors were encountered: