Missing error propagation in set_range_handler function can lead to wrong calculations
Summary
The set_range_handler function in the wooracle module does not properly propagate errors from the update_range_max call due to the missing ? operator. This omission can lead to silent failures, where the function appears to succeed even when an error has occurred.
Vulnerability Detail
In the set_range_handler function, the ? operator is used to propagate errors from the update_range_min function call, but is missing from the subsequent update_range_max call. The ? operator is essential for propagating errors to the caller. Without it, any error returned by update_range_max is ignored, and the function returns Ok(()) even when the operation fails.
Impact
This could lead to silent failures where the range_max value is not updated as expected. The wooracle may remain in an inconsistent state because the function incorrectly indicates success. Incorrect setup of the range_max variable can result in wrong calculations and functioning of the protocol.
Add the ? operator to the update_range_max call in the set_range_handler function to ensure proper error propagation. This will prevent silent failures and ensure that the function returns an error when update_range_max fails.
Proud Wintergreen Butterfly
Medium
Missing error propagation in set_range_handler function can lead to wrong calculations
Summary
The
set_range_handler
function in thewooracle
module does not properly propagate errors from theupdate_range_max
call due to the missing?
operator. This omission can lead to silent failures, where the function appears to succeed even when an error has occurred.Vulnerability Detail
In the
set_range_handler
function, the?
operator is used to propagate errors from theupdate_range_min
function call, but is missing from the subsequentupdate_range_max
call. The?
operator is essential for propagating errors to the caller. Without it, any error returned byupdate_range_max
is ignored, and the function returnsOk(())
even when the operation fails.Impact
This could lead to silent failures where the
range_max
value is not updated as expected. Thewooracle
may remain in an inconsistent state because the function incorrectly indicates success. Incorrect setup of therange_max
variable can result in wrong calculations and functioning of the protocol.Code Snippet
line missing the operator
Tool used
Manual Review
Recommendation
Add the ? operator to the update_range_max call in the set_range_handler function to ensure proper error propagation. This will prevent silent failures and ensure that the function returns an error when update_range_max fails.