BriVault

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

Inconsistent start boundary between deposit and join

Inconsistent start boundary between deposit and join

Description

  • Normal behavior: The start boundary should be consistent across all user actions; at eventStartDate, both deposit and join should be disallowed.

  • Issue: deposit reverts when block.timestamp >= eventStartDate, while joinEvent reverts only when block.timestamp > eventStartDate. At exactly eventStartDate, deposit is blocked but join is still allowed if a prior deposit exists, creating a one-block inconsistency.

function deposit(uint256 assets, address receiver) public override returns (uint256) {
...
// @> deposit blocks at t >= eventStartDate
if (block.timestamp >= eventStartDate) {
revert eventStarted();
}
...
}
function joinEvent(uint256 countryId) public {
...
// @> join blocks only at t > eventStartDate
if (block.timestamp >= eventStartDate) {
revert eventStarted();
}
...
}

Risk

Likelihood: Low

  • Happens only at the exact boundary timestamp.

Impact: Low

  • Allows an extra join at the start boundary while new deposits are blocked; minor fairness inconsistency.

  • Can cause confusion on edge cases for the user.

Proof of Concept

Description:

  • Deposit one block before start; at the exact eventStartDate, deposit is blocked but join still succeeds.

function testInconsistentStartBoundaryBetweenDepositAndJoin() public {
// One block before the start event, user can deposit
vm.warp(eventStartDate - 1);
vm.startPrank(user1);
mockToken.approve(address(briVault), 1 ether);
briVault.deposit(1 ether, user1);
vm.stopPrank();
// Warp to the start of the event
vm.warp(eventStartDate);
// At the moment the event starts, deposit reverts but join is allowed
vm.startPrank(user1);
mockToken.approve(address(briVault), 1 ether);
vm.expectRevert(abi.encodeWithSignature("eventStarted()"));
briVault.deposit(1 ether, user1);
briVault.joinEvent(8);
vm.stopPrank();
}

Recommended Mitigation

  • Align both checks to the same boundary by using >= in joinEvent as well.

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

Appeal created

bube Lead Judge 21 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!