Sablier

Sablier
DeFiFoundry
53,440 USDC
View results
Submission Details
Severity: low
Invalid

Inefficient Gas Usage in "_preventDelegateCall" Function

[L-2] Inefficient Gas Usage in _preventDelegateCall Function
Description:
The _preventDelegateCall function uses a private view function to check for delegate calls. While this reduces contract size, it still introduces gas overhead due to the additional function call.

Impact:
The gas usage for each call to functions using the noDelegateCall modifier is slightly increased, impacting overall gas efficiency, especially in high-frequency scenarios.

Proof of Concept:
Deploy and interact with the NoDelegateCall contract, measuring the gas usage for functions using the noDelegateCall modifier.

Recommended Mitigation:
Inline the logic within the modifier to avoid the function call overhead.

Mitigation Code:

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22;
import { Errors } from "../libraries/Errors.sol";
/// @title NoDelegateCall
/// @notice This contract implements logic to prevent delegate calls.
abstract contract NoDelegateCall {
/// @dev The address of the original contract that was deployed.
address private immutable ORIGINAL;
/// @dev Sets the original contract address.
constructor() {
ORIGINAL = address(this);
}
/// @notice Prevents delegate calls.
modifier noDelegateCall() {
- _preventDelegateCall();
+ if (address(this) != ORIGINAL) {
+ revert Errors.DelegateCall();
+ }
_;
}
- function _preventDelegateCall() private view {
- if (address(this) != ORIGINAL) {
- revert Errors.DelegateCall();
- }
- }
}
Updates

Lead Judging Commences

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

Info/Gas/Invalid as per Docs

https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity

Support

FAQs

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