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

Contracts using Solidity version 0.8.3 will not compile

Summary

The version pragma indicates that the library will be valid for versions 0.8.3 or higher and below 0.9.0, but it is not compatible with 0.8.3.

Vulnerability Details

The library is using custom errors, but that functionality was introduced in 0.8.4, so it will not compile with 0.8.3.

// SPDX-License-Identifier: MIT
// @notice We intentionally want to leave this as floating point so others can use it as a library.
pragma solidity ^0.8.3;

Impact

Contracts that require Soldity 0.8.3 will not be able to use this library.

Tools Used

Manual review

Proof of Concept

Set the compiler version to 0.8.3 in the tests and try to run.

MathMasters.t.sol

// SPDX-License-Identifier: MIT
// @notice We intentionally want to leave this as floating point so others can use it as a library.
pragma solidity 0.8.3;
forge test
...
Compiler run failed:
Error (2314): Expected ';' but got '('
--> src/MathMasters.sol:14:41:
|
14 | error MathMasters__FactorialOverflow();
| ^

Recommended Mitigation

Change the version pragma to ^0.8.4 and indicate this change in the documentation.

MathMasters.sol

// SPDX-License-Identifier: MIT
// @notice We intentionally want to leave this as floating point so others can use it as a library.
-pragma solidity ^0.8.3;
+pragma solidity ^0.8.4;
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
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.