stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: medium
Invalid

SDLPoolPriamary::initiateUnlock condition for elapse check looks incorrect

Summary

In order to initiateUnlock, atleast half the duration must have elapsed. if half the time was elapsed, the unlock can be initiated.

Look at the below condition where start time of the lock + half the duration
should be greater than current block time to qualify an elapse.
But, instead the logic reverts.

The behaviour is valid if the condition was a "require" instead of an if condition. Looks like a replacement of require with custom error leading to this issue.

if (locks[_lockId].startTime + halfDuration > block.timestamp) revert HalfDurationNotElapsed();

Vulnerability Details

The initiateUnlock is not working as expected. Even when half the time has elapsed, the function will revert due to the wrong condition being checked.

Impact

The initiateUnlock will revert even in the cases where the half time has elapsed.

Tools Used

Manual Review

Recommendations

Revise the condition as below.

if (locks[_lockId].startTime + halfDuration < block.timestamp) revert HalfDurationNotElapsed();
Updates

Lead Judging Commences

0kage Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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