DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Lack of Conditional Check in addAuthorizedSablierSender Function Leading to Potential Gas Wastage

Summary

The addAuthorizedSablierSender function in the smart contract lacks a conditional check before adding an address to the authorizedSablierSenders mapping. This could lead to redundant state changes and unnecessary gas consumption if the address is already authorized.

Vulnerability Details

Issue:

The function addAuthorizedSablierSender directly sets the _address in the authorizedSablierSenders mapping to true, regardless of whether the address was previously authorized. Without a conditional check, the function may result in unnecessary gas costs due to redundant state writes.

Code Snippet:

function addAuthorizedSablierSender(address _address) external onlyOwner {
authorizedSablierSenders[_address] = true;
}

Vulnerability:

This function doesn't check if the address is already authorized (authorizedSablierSenders[_address] == true). If the address is already authorized, writing the same value again wastes gas unnecessarily.

Impact

  • Gas Inefficiency: Repeatedly setting an already authorized address to true incurs unnecessary gas costs, especially in scenarios where this function is called frequently or in bulk operations.

  • State Redundancy: The function increases state redundancy by not distinguishing between new authorizations and repeated authorizations.

Tools Used

  • Manual code review

Recommendations

Add a conditional check before updating the authorizedSablierSenders mapping to ensure that only new authorizations are added:

function addAuthorizedSablierSender(address _address) external onlyOwner {
if (!authorizedSablierSenders[_address]) {
authorizedSablierSenders[_address] = true;
}
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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