Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0xlookman - During a withdraw in L1Staking.sol when a user is not able to claim his amount before the withdrawalLockBlocks, Eth will forever be locked in this contract. #228

Open
sherlock-admin4 opened this issue Sep 23, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link
Contributor

sherlock-admin4 commented Sep 23, 2024

0xlookman

Medium

During a withdraw in L1Staking.sol when a user is not able to claim his amount before the withdrawalLockBlocks, Eth will forever be locked in this contract.

0xlookman

Medium

Summary

When unstaking Eth from the L1Staking contract, users are given a window between the current block(the one they are withdrawing from) upto a period when withdrawalLockBlocks ends.

After this block in case a user has not withdrawn his eth, it will forever be locked in the contract with nothing like a rescue function to withdraw it.

Vulnerability Detail

The withdraw process in L1Staking takes places in two steps, a staker first call L1Staking.sol::Withdraw and then L1Staking.sol::claimWithdrawal.

But calling L1Staking.sol::claimWithdrawal is time limited since after withdrawalLockBlocks number of blocks, the user will nolonger be allowed to call and withdraw his amount.

     require(withdrawals[_msgSender()] < block.number, "withdrawal locked");

The above check ensures that a user won't be able to to withdraw after withdrawalLockBlocks, hence the value will forever remain in the contract.

The problem arises that this contract lacks a function that can help to rescue such tokens or value meaning that this eth will forever be locked in the contract.

Impact

Mishandling of Eth and Loss of tokens

Code Snippet

Tool used

Manual Review

Recommendation

Consider implementing a function that can recover tokens that are stuck in this contract.

@sherlock-admin3 sherlock-admin3 changed the title Damaged Parchment Turkey - During a withdraw in L1Staking.sol when a user is not able to claim his amount before the withdrawalLockBlocks, Eth will forever be locked in this contract. 0xlookman - During a withdraw in L1Staking.sol when a user is not able to claim his amount before the withdrawalLockBlocks, Eth will forever be locked in this contract. Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant