Sablier

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

Embedding modifier in private function reduces contract size

Summary

Modifier logic consolidation for optimization.

Vulnerability Details

Redundant modifier logic can lead to bloated contract size and increased gas costs, impacting overall contract performance.

Impact

Larger contract size and higher gas costs.

Tools Used

VSCode

Recommendations

Consider consolidating the logic of a modifier within a private function to optimize contract size. Employing a private visibility, which is more efficient for function calls compared to internal visibility, is advisable since the modifier will exclusively invoke this function internally within the contract.

For example, the modifier referenced below could be refactored as demonstrated:
SablierV2Lockup.sol#L65-L70

- /// @dev Checks that `streamId` does not reference a null stream.
- modifier notNull(uint256 streamId) {
+ function _notNull(uint256 streamId) private view {
if (!_streams[streamId].isStream) {
- revert Errors.SablierV2Lockup_Null(streamId);
+ revert Errors.SablierV2Lockup_Null(streamId);
}
+ }
+
+ /// @dev Checks that `streamId` does not reference a null stream.
+ modifier notNull(uint256 streamId) {
+ _notNull(streamId);
_;
}
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.