[Informational / Low] Compiler Version Restriction Causes Build Failures
Description
All contracts are strictly pinned to pragma solidity 0.8.20. While this ensures consistency, it prevents compilation when using dependencies (e.g., @Openzeppelin/Contracts) that declare a compatible range (e.g., >=0.6.2 <0.9.0). This strict requirement blocks compilation and reduces flexibility for future compiler updates.
Major Affectees
@> pragma solidity 0.8.20;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract BidBeasts is ERC721, Ownable(msg.sender) {
@> pragma solidity 0.8.20;
import {BidBeasts} from "./BidBeasts_NFT_ERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract BidBeastsNFTMarket is Ownable(msg.sender) {
Impact
-
The codebase cannot be compiled with dependencies that specify ranges.
-
Contracts cannot benefit from Solidity patch updates (e.g., 0.8.21, 0.8.22) that may contain bug or security fixes.
Risk
None
Poc
before:
hsn@DESKTOP-K084JCS:/mnt/d/WORK/selfInvestment/2025-09-bid-beasts$ forge compile
[⠰] Compiling...
Error: Found incompatible versions:
script/BidBeastsNFTMarketPlace.s.sol ^0.8.20 imports:
src/BidBeastsNFTMarketPlace.sol ^0.8.20
src/BidBeasts_NFT_ERC721.sol =0.8.20
lib/forge-std/src/Script.sol >=0.6.2, <0.9.0
lib/forge-std/src/console.sol >=0.4.22, <0.9.0
src/BidBeasts_NFT_ERC721.sol =0.8.20
lib/openzeppelin-contracts/contracts/access/Ownable.sol ^0.8.20
lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol ^0.8.24
After:
hsn@DESKTOP-K084JCS:/mnt/d/WORK/selfInvestment/2025-09-bid-beasts$ forge compile
[⠔] Compiling...
[⠒] Compiling 43 files with Solc 0.8.30
[⠒] Installing Solc version 0.8.30
[⠘] Successfully installed Solc 0.8.30
[⠔] Solc 0.8.30 finished in 10.11s
Compiler run successful!
note[mixed-case-variable]: mutable variables should use mixedCase
--> /mnt/d/WORK/selfInvestment/2025-09-bid-beasts/src/BidBeasts_NFT_ERC721.sol:12:20
|
12 | uint256 public CurrenTokenID;
| -------------
|
= help: https:
Recommended Mitigation
Relax the pragma across all contracts to allow for a safe range:
- pragma solidity 0.8.20;
+ pragma solidity ^0.8.20;