BriVault

First Flight #52
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: medium
Likelihood: low
Invalid

Timestamp Comparison in joinEvent() Allows Joining At Event Start

The joinEvent() function uses block.timestamp > eventStartDate which means users can still join exactly when the event starts (block.timestamp == eventStartDate). The requirement states "users should not be able to deposit once the event starts," suggesting they should not be able to join at or after the start time.

Impact:

  • Users can join at the exact moment of event start

  • Violates stated requirement

  • Could allow last-second betting based on information

Proof of Concept:

function testCanJoinExactlyAtEventStart() public {
vm.startPrank(attacker);
asset.approve(address(vault), 10000 * 10**18);
vault.deposit(10000 * 10**18, attacker);
vm.stopPrank();
// Warp to exact event start time
vm.warp(vault.eventStartDate());
// This should fail but doesn't
vm.prank(attacker);
vault.joinEvent(0); // Succeeds when it shouldn't
}

Mitigation:

Change the comparison to >=:

function joinEvent(uint256 countryId) public {
// ...
- if (block.timestamp > eventStartDate) {
+ if (block.timestamp >= eventStartDate) {
revert eventStarted();
}
// ...
}
Updates

Appeal created

bube Lead Judge 19 days ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!