The unstake
function in the Vyper smart contract uses the send
method to transfer Ether to the specified address. However, send
is subject to a 2300 gas limit which may not be sufficient for complex operations in the recipient contract. Additionally, there is no check to ensure that the send
operation was successful, which could lead to Ether being sent unsuccessfully without any notification.
In the unstake
function:
The send
function is used to transfer Ether to the _to
address. The send
method forwards only 2300 gas, which may not be sufficient for contracts that require more gas to process received Ether. Moreover, if the send
operation fails, it does not revert the transaction or provide any indication of failure, which could lead to loss of funds or incorrect contract behavior.
The current implementation can lead to failed Ether transfers when the recipient contract requires more than 2300 gas, causing potential loss of funds or incorrect state updates. The lack of failure handling in the send
function can also result in funds being lost without any notification to the users or the contract.
Manual review
To address the issue, replace the send
function with raw_call
to gain more control over the gas limit and ensure successful Ether transfers. Additionally, include error handling to ensure that the transaction reverts if the Ether transfer fails.
Here is the revised unstake
function using raw_call
:
This modification uses raw_call
to send Ether with a specified gas limit and checks if the transfer was successful, ensuring the contract can handle failures appropriately and avoid potential loss of funds.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.