Summary
Missing Event for important state change.
Vulnerability Details
ScrvusdOracleV2::update_profit_max_unlock_time() in the ScrvusdOracleV2 contract do not emit event to log state changes. This omission reduces the transparency and traceability of these operations, which can hinder off-chain monitoring.
@external
def update_profit_max_unlock_time(_profit_max_unlock_time: uint256, _block_number: uint256) -> bool:
"""
@notice Update price using `_parameters`
@param _profit_max_unlock_time New `profit_max_unlock_time` value
@param _block_number Block number of parameters to linearize updates
@return Boolean whether value changed
"""
access_control._check_role(UNLOCK_TIME_VERIFIER, msg.sender)
assert self.last_block_number <= _block_number, "Outdated"
self.last_block_number = _block_number
prev_value: uint256 = self.profit_max_unlock_time
self.profit_max_unlock_time = _profit_max_unlock_time
return prev_value != _profit_max_unlock_time
Impact
The absence of event emissions can lead to reduced transparency and traceability of important state changes within the smart contract ecosystem.
Tools Used
Recommended Mitigation
Consider adding event for this function to provide a clear on-chain record of when and by whom these actions were executed. This improves transparency and makes it easier to track changes.
+ event SetProfitMaxUnlockTime:
+ old_profit_max_unlock_time: uint256
+ new_profit_max_unlock_time: uint256
+ block_number: uint256
and emit in ScrvusdOracleV2::update_profit_max_unlock_time()
.
def update_profit_max_unlock_time(_profit_max_unlock_time: uint256, _block_number: uint256) -> bool:
"""
@notice Update price using `_parameters`
@param _profit_max_unlock_time New `profit_max_unlock_time` value
@param _block_number Block number of parameters to linearize updates
@return Boolean whether value changed
"""
access_control._check_role(UNLOCK_TIME_VERIFIER, msg.sender)
# Allowing same block updates for fixing bad blockhash provided (if possible)
assert self.last_block_number <= _block_number, "Outdated"
self.last_block_number = _block_number
prev_value: uint256 = self.profit_max_unlock_time
self.profit_max_unlock_time = _profit_max_unlock_time
+ log SetProfitMaxUnlockTime(prev_value, _profit_max_unlock_time, _block_number)
return prev_value != _profit_max_unlock_time