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

[Bug-Candidate]: Slither errors out on latest version of foundry #581

Open
chad-js opened this issue Jan 14, 2025 · 2 comments
Open

[Bug-Candidate]: Slither errors out on latest version of foundry #581

chad-js opened this issue Jan 14, 2025 · 2 comments

Comments

@chad-js
Copy link

chad-js commented Jan 14, 2025

Describe the issue:

On the latest nightly version of Foundry at time of writing, Slither errors out for me (see attached log snippet).

Using a previous version of Foundry (e.g. the most recent one before the latest), slither works fine.

I wonder if the error is related to this fix included in the most recent release of Foundry? foundry-rs/foundry#9673.

As a side note: This issue is more relevant to / compounded for me because I'm also using slither-action in my ci, which currently only supports using the latest nightly version AFAIK.

Apologies if this is the wrong repo to open this issue in. Not sure if this is something Foundry needs to fix or slither

Code example to reproduce the issue:

My foundry.toml configuration:

[profile.default]
solc = "0.8.26"
via_ir = true
evm_version = "cancun"
src = "src"
out = "out"
libs = ["lib"]

Version:

0.10.4

Relevant log output:

$ slither .
'forge clean' running (wd: /Users/cf/Development/project)
'forge config --json' running
'forge build --build-info --skip */test/** */script/** --force' running (wd: /Users/cf/Development/project)
Traceback (most recent call last):
  File "/Users/cf/Library/Python/3.8/bin/slither", line 8, in <module>
    sys.exit(main())
  File "/Users/cf/Library/Python/3.8/lib/python/site-packages/slither/__main__.py", line 776, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/Users/cf/Library/Python/3.8/lib/python/site-packages/slither/__main__.py", line 882, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/Users/cf/Library/Python/3.8/lib/python/site-packages/slither/__main__.py", line 96, in process_all
    compilations = compile_all(target, **vars(args))
  File "/Users/cf/Library/Python/3.8/lib/python/site-packages/crytic_compile/crytic_compile.py", line 722, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/Users/cf/Library/Python/3.8/lib/python/site-packages/crytic_compile/crytic_compile.py", line 211, in __init__
    self._compile(**kwargs)
  File "/Users/cf/Library/Python/3.8/lib/python/site-packages/crytic_compile/crytic_compile.py", line 633, in _compile
    self._platform.compile(self, **kwargs)
  File "/Users/cf/Library/Python/3.8/lib/python/site-packages/crytic_compile/platform/foundry.py", line 86, in compile
    hardhat_like_parsing(crytic_compile, self._target, build_directory, self._target)
  File "/Users/cf/Library/Python/3.8/lib/python/site-packages/crytic_compile/platform/hardhat.py", line 77, in hardhat_like_parsing
    optimized = input_json["settings"]["optimizer"]["enabled"]
KeyError: 'enabled'
@elopez
Copy link
Member

elopez commented Jan 14, 2025

@chad-js thanks for the detailed report! it indeed looks like that Foundry PR introduced the change that is causing the failure. I've let the Foundry team know on the PR. In the meantime and as a workaround, you can add an explicit optimizer setting to your foundry.toml (e.g. optimizer = false) and that might restore things to working order.

It also looks like the newer foundryup now tracks a stable release by default, so I'll make an issue to update that on the Slither action.

@DraveeCertora
Copy link

Hey there! Got the issue today and found this issue by chance.
Indeed, setting optimizer = false made Slither run correctly.
Thank you for the temporary workaround

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

3 participants