Skip to content

chore: fix compilation warnings in Foundry's Solidity test suite #10744

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

knelsondev
Copy link

Motivation

This PR aims to close #10577

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@knelsondev
Copy link
Author

@zerosnacks Please look into this PR and let me know if it resolves #10577

@zerosnacks
Copy link
Member

Hi @knelsondev unfortunately these changes do not resolve the compilation warnings; please see the instructions in the ticket on how to iteratively fix them

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knelsondev please check the ticket comment and how you could reproduce warnings that needs to be fixed, the current changes doesn't address any of these. Thank you

@knelsondev
Copy link
Author

@zerosnacks @grandizzy I need a bit of your help. In the master branch, when I cd testdata and then temporarily comment out solc = "0.8.18 in foundry.toml and run forge build --ignored-error-codes=2018

I get a list of warnings that look like this, and not like the one mentioned in the original issue:

Warning: This is a nightly build of Foundry. It is recommended to use the latest stable version. To mute this warning set `FOUNDRY_DISABLE_NIGHTLY_WARNING` in your environment. 

note[screaming-snake-case-const]: constants should use SCREAMING_SNAKE_CASE
 --> /home/acesif/application/foundry/testdata/default/repros/Issue10586.t.sol:8:17
  |
8 |     Vm constant vm = Vm(HEVM_ADDRESS);
  |                 --
  |
  = help: https://book.getfoundry.sh/reference/forge/forge-lint#screaming-snake-case-const

note[screaming-snake-case-const]: constants should use SCREAMING_SNAKE_CASE
 --> /home/acesif/application/foundry/testdata/default/cheats/Prevrandao.t.sol:8:17
  |
8 |     Vm constant vm = Vm(HEVM_ADDRESS);
  |                 --
  |
  = help: https://book.getfoundry.sh/reference/forge/forge-lint#screaming-snake-case-const

note[mixed-case-variable]: mutable variables should use mixedCase
  --> /home/acesif/application/foundry/testdata/lib/ds-test/src/test.sol:38:17
   |
38 |     bool public IS_TEST = true;
   |                 -------
   |
   = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-variable

note[screaming-snake-case-const]: constants should use SCREAMING_SNAKE_CASE
  --> /home/acesif/application/foundry/testdata/default/cheats/GetCode.t.sol:12:17
   |
12 |     Vm constant vm = Vm(HEVM_ADDRESS);
   |                 --
   |
   = help: https://book.getfoundry.sh/reference/forge/forge-lint#screaming-snake-case-const

note[screaming-snake-case-const]: constants should use SCREAMING_SNAKE_CASE
  --> /home/acesif/application/foundry/testdata/default/cheats/Wallet.t.sol:10:17
   |
10 |     Vm constant vm = Vm(HEVM_ADDRESS);
   |                 --
   |
   = help: https://book.getfoundry.sh/reference/forge/forge-lint#screaming-snake-case-const

note[screaming-snake-case-const]: constants should use SCREAMING_SNAKE_CASE
 --> /home/acesif/application/foundry/testdata/default/cheats/getBlockNumber.t.sol:8:17
  |
8 |     Vm constant vm = Vm(HEVM_ADDRESS);
  |                 --
  |
  = help: https://book.getfoundry.sh/reference/forge/forge-lint#screaming-snake-case-const

note[mixed-case-function]: function names should use mixedCase
  --> /home/acesif/application/foundry/testdata/lib/ds-test/src/test.sol:81:14
   |
81 |     function hasHEVMContext() internal view returns (bool) {
   |              --------------
   |
   = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-function

note[mixed-case-function]: function names should use mixedCase
  --> /home/acesif/application/foundry/testdata/lib/ds-test/src/test.sol:89:14
   |
89 |     modifier logs_gas() {
   |              --------
   |
   = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-function

note[screaming-snake-case-const]: constants should use SCREAMING_SNAKE_CASE
 --> /home/acesif/application/foundry/testdata/default/cheats/Blobhashes.t.sol:8:17
  |
8 |     Vm constant vm = Vm(HEVM_ADDRESS);
  |                 --
  |
  = help: https://book.getfoundry.sh/reference/forge/forge-lint#screaming-snake-case-const

note[screaming-snake-case-const]: constants should use SCREAMING_SNAKE_CASE
  --> /home/acesif/application/foundry/testdata/default/cheats/Mapping.t.sol:22:17
   |
22 |     Vm constant vm = Vm(HEVM_ADDRESS);
   |                 --
   |
   = help: https://book.getfoundry.sh/reference/forge/forge-lint#screaming-snake-case-const

@zerosnacks
Copy link
Member

Hi @knelsondev, ah yes - in the latest nightly we have enabled the running of forge lint by default.

You can disable this by setting:

[lint]
lint_on_build = false

in the foundry.toml

You can ignore these warnings raised by the linting; this PR relates to warnings raised by the Solidity compiler.

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

Successfully merging this pull request may close these issues.

chore: fix compilation warnings in Foundry's Solidity test suite
3 participants