Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: low
Invalid

The unnecessary first `token.approve` call can be removed from the `LLMOracleRegistry::unregister` function.

Summary

The first token.approve call in the LLMOracleRegistry::unregister function is redundant and can be removed, as it serves no purpose and may introduce security vulnerabilities.

Vulnerability Details

Redundant call `token.approve(msg.sender, amount)`;

function unregister(LLMOracleKind kind) public returns (uint256 amount) {
amount = registrations[msg.sender][kind];
// ensure the user is registered
if (amount == 0) {
revert NotRegistered(msg.sender);
}
// unregister the user
delete registrations[msg.sender][kind];
emit Unregistered(msg.sender, kind);
// approve its stake back
@> token.approve(msg.sender, amount);
token.approve(msg.sender, token.allowance(address(this), msg.sender) + amount);
}

Impact

token.approve call in the LLMOracleRegistry::unregister function is redundant and can be removed, as it serves no purpose and may introduce security vulnerabilities.

Tools Used

Manual Review

Recommendations

function unregister(LLMOracleKind kind) public returns (uint256 amount) {
amount = registrations[msg.sender][kind];
// ensure the user is registered
if (amount == 0) {
revert NotRegistered(msg.sender);
}
// unregister the user
delete registrations[msg.sender][kind];
emit Unregistered(msg.sender, kind);
// approve its stake back
- token.approve(msg.sender, amount);
token.approve(msg.sender, token.allowance(address(this), msg.sender) + amount);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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