The veRAACToken::scheduleEmergencyAction function schadules an emergency withdrawal mechanism that must be executed after 3 days. However in the current implementation of this functionality the users are able to call the enableEmergencyWithdraw not after 3, but after 6 days!
In case of an emergency the contract has a functionality that scadules an emergency withdraw after 3 days.
Consider the following scenario:
The contract owner of veRAACToken needs to envoke the emergency withdraw function. He calls the scheduleEmergencyAction function with id - EMERGENCY_WITHDRAW_ACTION.
Then after 3 days the owner calls the enableEmergencyWithdraw which has the withEmergencyDelay modifier that checks if 3 days have passed. Then enableEmergencyWithdraw as it says should Enable emergency withdrawal functionality. However this function sets emergencyWithdrawDelay to block.timestamp + EMERGENCY_DELAY.
Then when a user tries to call the emergencyWithdraw function and it checks if block.timestamp < emergencyWithdrawDelay. This check will revert if another 3 days have not passed.
This makes the total emergency withdraw duration not 3 but 6 days!
According to the documentation the Emergency actions require 3-day delay, but in current implementation the days are actually 6.
Docs:
https://github.com/Cyfrin/2025-02-raac/blob/main/docs/core/tokens/veRAACToken.md#notes
In case of an emergency withdrawal, the functionality will take longer to be available, which can lead to significant financial losses for users.
Foundry Test:
Manual Review
Set the emergencyWithdrawDelay variable to only block.timestamp as shown:
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.