Cyfrin / 2023-07-foundry-defi-stablecoin

37 stars 32 forks source link

Reduce gas usage by moving to Solidity 0.8.19 or later #1137

Closed codehawks-bot closed 1 year ago

codehawks-bot commented 1 year ago

Reduce gas usage by moving to Solidity 0.8.19 or later

Severity

Gas Optimization / Informational

Relevant GitHub Links

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DSCEngine.sol

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DecentralizedStableCoin.sol

Summary

Reduce gas usage by moving to Solidity 0.8.19 or later

Vulnerability Details

In earlier releases and in the default legacy code generation, when an internal library function or a free function accessed via a module was called only during contract creation, e.g. only in the constructor, a copy of the function still also occurred in the contract's runtime bytecode. This was fixed in the version 0.8.19 and later.

Complete release notes

Instances (2):

File: src/DSCEngine.sol

24: pragma solidity ^0.8.18;

Link to code - https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DSCEngine.sol

File: src/DecentralizedStableCoin.sol

24: pragma solidity ^0.8.18;

Link to code - https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DecentralizedStableCoin.sol

Tools Used

Code Review using VSCode

Recommendations

Move to Solidity 0.8.19 or later

PatrickAlphaC commented 1 year ago

https://github.com/crytic/slither/wiki/Detector-Documentation#recommendation-74