Lack of range checks in update_range_min and update_range_max functions can lead to wrong calculations
Summary
The update_range_min and update_range_max functions in the Wooracle contract allow setting range_min and range_max values without verifying their logical relationship. Specifically, there is no check to ensure that range_min is less than or equal to range_max and vice versa.
Vulnerability Detail
In the current implementation, the update_range_min and update_range_max functions directly update the range_min and range_max values in the Wooracle state without checking if range_min is less than or equal to range_max and the opposite as well.
Impact
If range_min is set to a value greater than range_max or range_max is set to a value less than range_min, the oracle can operate with invalid ranges, which can lead to mispricing issues and unexpected behavior of the protocol.
dod4ufn
Medium
Lack of range checks in update_range_min and update_range_max functions can lead to wrong calculations
Summary
The
update_range_min
andupdate_range_max
functions in theWooracle
contract allow settingrange_min
andrange_max
values without verifying their logical relationship. Specifically, there is no check to ensure thatrange_min
is less than or equal torange_max
and vice versa.Vulnerability Detail
In the current implementation, the
update_range_min
andupdate_range_max
functions directly update therange_min
andrange_max
values in theWooracle
state without checking ifrange_min
is less than or equal torange_max
and the opposite as well.Impact
If
range_min
is set to a value greater thanrange_max
orrange_max
is set to a value less than range_min, the oracle can operate with invalid ranges, which can lead to mispricing issues and unexpected behavior of the protocol.Code Snippet
update range functions
Tool used
Manual Review
Recommendation
Modify the
update_range_min
andupdate_range_max
functions to include validation checks that ensure the following:range_min
should not be set to a value greater than the currentrange_max
.range_max
should not be set to a value less than the currentrange_min
.