Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Pragma solidity 0.8.3 can't manage the error as defined

Summary

As described in the documentation the compatibilities must be:

  • Solc Version: 0.8.3 < 0.9.0

But The Pragma solidity v0.8.3 can't manage the error as defined in the smart contract. This is a features added from the Solidity v0.8.4.

Vulnerability Details

The Pragma solidity v0.8.3 can't manage the error as defined in the smart contract. This is a features added from the starting from Solidity v0.8.4 as descirbed in their blog (https://soliditylang.org/blog/2021/04/21/custom-errors/):
"Starting from Solidity v0.8.4, there is a convenient and gas-efficient way to explain to users why an operation failed through the use of custom errors. Until now, you could already use strings to give more information about failures (e.g., revert("Insufficient funds.");), but they are rather expensive, especially when it comes to deploy cost, and it is difficult to use dynamic information in them.
Custom errors are defined using the error statement, which can be used inside and outside of contracts (including interfaces and libraries)."

library MathMasters {
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
@> error MathMasters__FactorialOverflow();
@> error MathMasters__MulWadFailed();
@ error MathMasters__DivWadFailed();
@> error MathMasters__FullMulDivFailed();
...

Impact

The Solidity version 0.8.3 does not support the custom error feature introduced in version 0.8.4. This limits the library's ability to efficiently handle errors. Without the ability to define custom errors, there is a risk of using generic or misleading error messages.

Tools Used

Manual review

Recommendations

Restrict the use of the library from the 0.8.4 or define the error with a require statement (accepted by the v0.8.3)

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Project that use pragma=0.8.3 won't be able to use the library due to custom errors not being supported in that Solidity version.

Support

FAQs

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