Core Contracts

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

[Low]

unused timelock mechanism in RAACMinter contract

Summary

the TIMELOCK_DURATION and timeLocks mapping are declared but not used anywhere. So there's code related to timelocks that's not implemented. This could be a mistake or incomplete code. For example, functions that change critical parameters should have a timelock to prevent sudden changes. But in the current code, functions like setStabilityPool, setLendingPool, etc., can be changed immediately by UPDATER_ROLE. The presence of TIMELOCK_DURATION and the mapping suggests that the intent was to have timelocks, but they're not implemented. This could be a vulnerability if the protocol expects timelocks but they're not present, allowing immediate changes by privileged roles.

Vulnerability Details

The contract declares TIMELOCK_DURATION and timeLocks but never implements them. Critical parameter changes (e.g., setStabilityPool, setLendingPool) lack a timelock, allowing immediate execution.

implemnted but never used in RAACMinter

uint256 public constant TIMELOCK_DURATION = 2 days;
mapping(bytes32 => uint256) public timeLocks; // Unused

Impact

Privillaged roles can make abrupt changes without user notice.

Tools Used

manual review

Recommendations

Implement timelocks for sensitive functions using the declared variables

Emergency shutdown role in RAACMinter contract not used

Summary

In the constructor, the initialOwner is granted DEFAULT_ADMIN_ROLE, PAUSER_ROLE, and UPDATER_ROLE. But EMERGENCY_SHUTDOWN_ROLE is not granted to anyone. However, the emergencyShutdown function is only callable by DEFAULT_ADMIN_ROLE. So the code uses DEFAULT_ADMIN_ROLE for emergency shutdown, not EMERGENCY_SHUTDOWN_ROLE. But the EMERGENCY_SHUTDOWN_ROLE is defined but not used. This is an inconsistency. The emergencyShutdown function should be protected by EMERGENCY_SHUTDOWN_ROLE instead of DEFAULT_ADMIN_ROLE. Currently, it's using onlyRole(DEFAULT_ADMIN_ROLE), which may not be intended.

Vulnerability Details

The emergencyShutdown function checks for DEFAULT_ADMIN_ROLE instead of the defined EMERGENCY_SHUTDOWN_ROLE, creating a role inconsistency.

bytes32 public constant EMERGENCY_SHUTDOWN_ROLE = keccak256("EMERGENCY_SHUTDOWN_ROLE"); --- not used
function emergencyShutdown(...) external onlyRole(DEFAULT_ADMIN_ROLE) { ... }

Impact

creates role inconsistency

Tools Used

manual review

Recommendations

Update the modifier to use EMERGENCY_SHUTDOWN_ROLE and grant the role appropriately.

Natspec contradicting code logic in LendingPool::_repay

Summary

The Natspec comments state that if onBehalfOf is set to address(0), the function should default to repaying the caller's own debt. However, the code logic reverts the transaction if onBehalfOf is address(0). This creates a mismatch between the documented behavior and the actual implementation.

Vulnerability Details

/**
* @notice Internal function to repay borrowed reserve assets
* @param amount The amount to repay
* @param onBehalfOf The address of the user whose debt is being repaid. If address(0), msg.sender's debt is repaid.
* @dev This function allows users to repay their own debt or the debt of another user.
* The caller (msg.sender) provides the funds for repayment in both cases.
* If onBehalfOf is set to address(0), the function defaults to repaying the caller's own debt.
*/
function _repay(uint256 amount, address onBehalfOf) internal {
if (amount == 0) revert InvalidAmount();
if (onBehalfOf == address(0)) revert AddressCannotBeZero(); <==== reverts if onBehalfOf is an address 0

The code reverts if onBehalfOf is address(0), which contradicts the Natspec comment that suggests the function should default to repaying the caller's own debt in such a case.

Impact

Users relying on the Natspec documentation will expect the function to repay their own debt when onBehalfOf is address(0). However, the function will revert instead, leading to confusion

Tools Used

manual review

Recommendations

Update the code logic to match the Natspec documentation. If onBehalfOf is address(0), the function should default to repaying the caller's own debt.

Updates

Lead Judging Commences

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

RAACMinter defines EMERGENCY_SHUTDOWN_ROLE but emergencyShutdown uses DEFAULT_ADMIN_ROLE, and EMERGENCY_SHUTDOWN_ROLE is never granted to any account

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

RAACMinter defines EMERGENCY_SHUTDOWN_ROLE but emergencyShutdown uses DEFAULT_ADMIN_ROLE, and EMERGENCY_SHUTDOWN_ROLE is never granted to any account

Support

FAQs

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

Give us feedback!