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]: Running Slither on a multi solc versions project #2651

Open
lopjf opened this issue Jan 30, 2025 · 0 comments
Open

[Bug-Candidate]: Running Slither on a multi solc versions project #2651

lopjf opened this issue Jan 30, 2025 · 0 comments
Labels
bug-candidate Bugs reports that are not yet confirmed

Comments

@lopjf
Copy link

lopjf commented Jan 30, 2025

Describe the issue:

I am running slither as part of a gitlab pipeline which manage several versions from 0.5.0 to 0.8.28 using solc-select.
It iterates through all smart contracts and set solc globally before each slither call.
slither gets the evm-version from the toml but finds 'auto_detect_solc = true' which then default to '--evm-version: cancun'. Creating a mismatch in between the solc and the evm-version during slither execution.

I tried setting the evm-version like so: '--solc-args "--evm-version london"', without success.

Code example to reproduce the issue:

#!/bin/bash
export PATH="/root/.foundry/bin:${PATH}"

solc-select install 0.5.0
solc-select install 0.8.17

solc-select use 0.8.17

slither my_contract.sol
--solc-args "--evm-version $EVM_VERSION" \

Version:

0.10.4

Relevant log output:

Switched global version to 0.8.8
-> Slither on ./apps/NFT/contracts/contract.sol (Solc: 0.8.8 at /root/.crytic/bin/solc / EVM: london)
'forge config --json' running
Could not detect solc version from Foundry config. Falling back to system version...
'solc --version' running
'solc @chainlink/contracts/=dependencies/@chainlink-contracts-1.3.0/ @gnosis.pm/safe-contracts/=dependencies/@gnosis-pm-safe-contracts-1.3.0/ @gnosis.pm/zodiac/=dependencies/gnosisguild-zodiac-4.0.5/ @openzeppelin-contracts/=dependencies/@openzeppelin-contracts-4.9.3/ @openzeppelin/contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-4.9.3/ openzeppelin-contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-4.9.3/ @openzeppelin/contracts/=dependencies/@openzeppelin-contracts-4.9.3/ @rari-capital/solmate/=dependencies/solmate-6.8.0/ @safe-global/safe-contracts/=dependencies/safe-global-safe-smart-account-1.4.1-3/ forge-std/=dependencies/forge-std-1.9.4/src/ operator-filter-registry/=dependencies/projectopensea-operator-filter-registry-1.4.2/ @chainlink-contracts-1.3.0/=dependencies/@chainlink-contracts-1.3.0/src/ @gnosis-pm-safe-contracts-1.3.0/=dependencies/@gnosis-pm-safe-contracts-1.3.0/contracts/ @openzeppelin-contracts-4.9.3/=dependencies/@openzeppelin-contracts-4.9.3/ @openzeppelin-contracts-upgradeable-4.9.3/=dependencies/@openzeppelin-contracts-upgradeable-4.9.3/ @openzeppelin-contracts-upgradeable-5.2.0/=dependencies/@openzeppelin-contracts-upgradeable-5.2.0/ forge-std-1.9.4/=dependencies/forge-std-1.9.4/src/ gnosisguild-zodiac-4.0.5/=dependencies/gnosisguild-zodiac-4.0.5/contracts/ projectopensea-operator-filter-registry-1.4.2/=dependencies/projectopensea-operator-filter-registry-1.4.2/src/ safe-global-safe-smart-account-1.4.1-3/=dependencies/safe-global-safe-smart-account-1.4.1-3/ solmate-6.8.0/=dependencies/solmate-6.8.0/src/ --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes,compact-format --optimize --optimize-runs 200 --evm-version cancun --allow-paths .,~/apps/NFT/contracts' running
Compilation warnings/errors on ./apps/NFT/contracts/contract.sol:
Invalid option for --evm-version: cancun
Traceback (most recent call last):
  File "/root/.crytic/lib/python3.10/site-packages/crytic_compile/platform/solc.py", line 582, in _run_solc
    ret: Dict = json.loads(stdout)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/root/.crytic/bin/slither", line 8, in <module>
    sys.exit(main())
  File "/root/.crytic/lib/python3.10/site-packages/slither/__main__.py", line 776, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/root/.crytic/lib/python3.10/site-packages/slither/__main__.py", line 882, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/root/.crytic/lib/python3.10/site-packages/slither/__main__.py", line 96, in process_all
    compilations = compile_all(target, **vars(args))
  File "/root/.crytic/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 722, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/root/.crytic/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 211, in __init__
    self._compile(**kwargs)
  File "/root/.crytic/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 633, in _compile
    self._platform.compile(self, **kwargs)
  File "/root/.crytic/lib/python3.10/site-packages/crytic_compile/platform/solc.py", line 151, in compile
    targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
  File "/root/.crytic/lib/python3.10/site-packages/crytic_compile/platform/solc.py", line 280, in _get_targets_json
    return _run_solc(
  File "/root/.crytic/lib/python3.10/site-packages/crytic_compile/platform/solc.py", line 586, in _run_solc
    raise InvalidCompilation(f"Invalid solc compilation {stderr}")
crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation Invalid option for --evm-version: cancun
@lopjf lopjf added the bug-candidate Bugs reports that are not yet confirmed label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-candidate Bugs reports that are not yet confirmed
Projects
None yet
Development

No branches or pull requests

1 participant