Open hats-bug-reporter[bot] opened 2 months ago
About finalize_ts
there is no inconsistency.
It fullfil the finalization criterion if finalize_ts <= uint32(block.timestamp)
. So it is not fullfilled if finalize_ts > uint32(block.timestamp)
. So the use is consistent.
For reveal_ts
, since both are strict, there is one second where we can't assign the winner nor reveal an answer, but this doesn't lead to any issue (at worse we "waste" 1s which is negligeable).
Per the rules, are excluded:
Github username: -- Twitter username: -- Submission hash (on-chain): 0xa3d4e5242323ee490da9b267496747be8cba6ec6bc304ffa57160a721a7d3581 Severity: low
Description: Description
The contract inconsistently uses time-based condition checks, leading to potential off-by-one errors. Specifically, the
stateOpen
andstateOpenOrPendingArbitration
modifiers usefinalize_ts > block.timestamp
to check if the finalization deadline has not passed, indicating an exclusive check. Similarly, thesubmitAnswerReveal
function also uses the same exclusive check withcommitments[commitment_id].reveal_ts > block.timestamp
to ensure the reveal deadline has not passed. In contrast, theisFinalized
function usesfinalize_ts <= block.timestamp
to check if the finalization deadline has passed, making it an inclusive check. TheassignWinnerAndSubmitAnswerByArbitrator
function also uses<
incommitments[last_answer_or_commitment_id].reveal_ts < block.timestamp
to check the reveal deadline, which could cause off-by-one errors when the reveal time is exactly equal to the current timestamp. This inconsistency can lead to unexpected behavior and logical errors in time-sensitive operations, such as preventing legitimate actions or incorrectly determining if a condition has been met.Attachments
In the
RealityETH_v3_0
contract:Align the time-based condition checks across all relevant parts of the contract to use a consistent logic for inclusivity or exclusivity. Review and modify the conditions to ensure they match the intended behavior of the contract, either using inclusive (
<=
) or exclusive (<
) checks consistently, based on the specific use case. This will help avoid off-by-one errors and ensure reliable execution of time-dependent functionalities.