Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSCEngineTest name re-used #946

Closed
codehawks-bot opened this issue Aug 5, 2023 · 1 comment
Closed

DSCEngineTest name re-used #946

codehawks-bot opened this issue Aug 5, 2023 · 1 comment

Comments

@codehawks-bot
Copy link

DSCEngineTest name re-used

Severity

Low Risk

Summary

As per the Documentation whereby these contracts should be able to be re-used with different collateral this finding should be pointed out that not using Foundry can result in compilation artefacts not containing one of the contracts that share the duplicate name of DSCEngineTest, and the tests possibly not running against the code in the src folder in scope

DSCEngineTest is re-used as a Contract Name in the two files mentioned below:

  • DSCEngineTest (test/unit/DSCEngineTest.t.sol) on line 18
  • DSCEngineTest (test/unit/OracleLibTest.t.sol) on line 10

Vulnerability Details

The tests do run and are effective in the current version of Foundry
Foundry outputs are folder based, as per the filename used, including the artefacts within, saved as the Contract Name.

https://github.com/crytic/slither/wiki/Detector-Documentation#name-reused

Impact

forge displays results of only the first test case, older version of Forge, not current
foundry-rs/foundry#392
script duplicate names and compilation issues
foundry-rs/foundry#3177

Tools Used

forge 0.2.0 (2d87c0c 2023-08-04T00:27:04.410646000Z)
Slither

Recommendations

Rename the Contract:

Edit Line 10 of OracleLibTest.sol as follows:

  • contract DSCEngineTest is StdCheats, Test {
  • contract OracleLibTest is StdCheats, Test {
@PatrickAlphaC
Copy link
Member

Out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants