Core Contracts

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

veRAAC::emergencyWithdraw does not update boost state and voting power state

Summary

The emergencyWithdraw function in the veRAAC token contract fails to properly update the Boost state and voting power state when executed. This leads to incorrect protocol boost calculations and governance voting power

Vulnerability Details

The emergencyWithdraw function is designed to allow users to withdraw their funds in emergency situations. However, the current implementation lacks crucial state updates:

function emergencyWithdraw() external nonReentrant {
//@audit - does not update the boost state and the voting power state
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];
_burn(msg.sender, currentPower);
raacToken.safeTransfer(msg.sender, amount);
emit EmergencyWithdrawn(msg.sender, amount);
}

When a user performs an emergency withdrawal, the contract should:

  1. Update the Boost state to reflect the reduced staked amount

  2. Adjust the user's voting power accordingly

  3. The absence of these updates means that the system continues to calculate governance weights and boosts based on outdated information, leading to inaccurate voting power distribution and reward calculations.

Impact

This vulnerability causes incorrect voting power allocations in governance decisions, incorrect boost calculations for reward distributions. Some users will face unfair second order effects because of this.

Tools Used

Manual review

Recommendations

Add Boost state update logic in emergencyWithdraw:
boostState.updateBoost(msg.sender);

Also, implement voting power adjustment:
votingPower.adjustVotingPower(msg.sender);

Updates

Lead Judging Commences

inallhonesty Lead Judge 3 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.