code-423n4 / 2021-07-sherlock-findings

0 stars 0 forks source link

Inconsistent block number comparison when deciding an unstaking entry is active #139

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

shw

Vulnerability details

The getInitialUnstakeEntry function of PoolBase returns the first active unstaking entry of a staker, which requires the current block to be strictly before the last block in the unstaking window. However, the unstake function allows the current block to be exactly the same as the last block (same logic in unstakeWindowExpiry).

Proof of Concept

Referenced code: PoolBase.sol#L136 PoolBase.sol#L344 PoolBase.sol#L364

Recommended Mitigation Steps

Change the <= comparison at line 136 to < for consistency.