Raisebox Faucet

First Flight #50
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

floating pragma

Floating pragma

Description:

The Protocol uses a floating pragma (e.g., pragma solidity ^0.8.30;),
which allows the contract to be compiled with any compatible compiler version within a range.
This can lead to unpredictable behavior,
as different compiler versions may introduce breaking changes, optimizations,
or bugs that alter the contract's functionality or security.

Risk

Likelihood:

  • Reason 1 // Describe WHEN this will occur (avoid using "if" statements)

  • Reason

Impact:

Using a floating pragma increases the risk of deploying a contract with a compiler version
that introduces unintended behavior, vulnerabilities, or incompatibilities.
This could lead to incorrect execution of the contract, potential exploits,
or failure to compile in future environments, impacting the contract's reliability and security.

Proof of Concept:

pragma solidity ^0.8.0;
contract Example {
function doSomething() public pure returns (uint256) {
return 42;
}
}

-The ^0.8.0 allows compilation with any version from 0.8.0 to <0.9.0.

-A newer compiler version (e.g., 0.8.3) might optimize code differently or introduce a bug that changes the contract's behavior.

-For example, a known issue in some Solidity versions (e.g., 0.8.4) could lead to incorrect handling of certain operations, such as inline assembly, potentially introducing vulnerabilities.

Recommended Mitigation:

pragma solidity 0.8.20;
contract Example {
function doSomething() public pure returns (uint256) {
return 42;
}
}

-Specify the exact compiler version used during development and testing (e.g., 0.8.20).

-Document the chosen compiler version in the project’s documentation.

-Ensure all development and deployment pipelines use the same compiler version to avoid discrepancies.

-Regularly review the Solidity changelog for updates and vulnerabilities in newer versions before upgrading.

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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