setWinner function is not precise enough.When the admin executes the setWinner function to announce the "winning national team's name" under the premise that the event has ended.
However, there is a slight inaccuracy in determining whether the "event has ended."
In common programming paradigms, we generally consider that block.timestamp >= eventEndDate indicates the event has ended.
But in this code, block.timestamp <= eventEndDate is used to represent "the event has not ended yet," which is clearly inaccurate.
Likelihood:
In the block where the timestamp exactly equals eventEndDate, it will definitely occur.
Impact:
Inconsistent with the event's advertised end time.
The admin cannot set the winner immediately at the exact moment the event ends; they must wait until eventEndDate + 1 second or later to execute, causing unnecessary delays.
Users expect to see the result immediately after the event ends, but they may need to wait for one or more additional block confirmations, potentially leading to doubts about the project team's execution capability.
Add the following function in test/BriVaultTest.t.sol, then run forge test --mt test__setWinner_inEventEndDateBlock -vv
The console will print:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.