Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Valid

Emergency withdrawal does not store the withdrawer's checkpoint

Summary

Emergency withdrawal does not store the withdrawer's checkpoint

Vulnerability Details

Upon withdrawing (and pretty much all other operations), we have the following code:

function withdraw() external nonReentrant {
...
_checkpointState.writeCheckpoint(msg.sender, 0);
...
}

The checkpoint writing is extremely important for proper state management. However, upon emergency withdrawing:

function emergencyWithdraw() external nonReentrant {
if (emergencyWithdrawDelay == 0 || block.timestamp < emergencyWithdrawDelay) revert EmergencyWithdrawNotEnabled();
LockManager.Lock memory userLock = _lockState.locks[msg.sender];
if (userLock.amount == 0) revert NoTokensLocked();
uint256 amount = userLock.amount;
uint256 currentPower = balanceOf(msg.sender);
delete _lockState.locks[msg.sender];
delete _votingState.points[msg.sender];
// @audit doesn't do the writeCheckpoint call done on regular withdrawals
_burn(msg.sender, currentPower);
raacToken.safeTransfer(msg.sender, amount);
emit EmergencyWithdrawn(msg.sender, amount);
}

We do not store the checkpoint here at all.

Impact

Checkpoint is not stored, state will be incorrect.

Tools Used

Manual Review

Recommendations

Store a checkpoint upon emergency withdrawing too

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

veRAACToken::emergencyWithdraw doesn't update checkpoint - innacurate historical voting power, inconsistent state

Support

FAQs

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

Give us feedback!