Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

volodya - Users able to deposit at epoch time they are not suppose to #20

Closed
sherlock-admin opened this issue Mar 27, 2023 · 0 comments
Closed
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 27, 2023

volodya

medium

Users able to deposit at epoch time they are not suppose to

Summary

if block.timestamp == epochConfig[_id].epochBegin then both modifiers will not revert which is probably not correct. There is variable _epochEnd in the contract that is not being used and seems like it is supposed to be in those modifiers.

    modifier epochHasNotStarted(uint256 _id) {
        if (block.timestamp > epochConfig[_id].epochBegin)
            revert EpochAlreadyStarted();
        _;
    }

    /** @notice You can only call functions that use this modifier after the epoch has started
     */
    modifier epochHasStarted(uint256 _id) {
        if (block.timestamp < epochConfig[_id].epochBegin)
            revert EpochNotStarted();
        _;
    }

VaultV2.sol#L432

Vulnerability Detail

Impact

Users are able to deposit at epoch times they are not supposed to

Code Snippet

Tool used

Manual Review

Recommendation

    /** @notice You can only call functions that use this modifier before the epoch has started
     */
    modifier epochHasNotStarted(uint256 _id) {
        if (block.timestamp >= epochConfig[_id].epochBegin && block.timestamp <= epochConfig[_id].epochEnd)
            revert EpochAlreadyStarted();
        _;
    }

    /** @notice You can only call functions that use this modifier after the epoch has started
     */
    modifier epochHasStarted(uint256 _id) {
        if (block.timestamp < epochConfig[_id].epochBegin  && block.timestamp > epochConfig[_id].epochEnd)
            revert EpochNotStarted();
        _;
    }

Duplicate of #480

@github-actions github-actions bot closed this as completed Apr 3, 2023
@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Apr 3, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant