Skip to content

[Bug-Candidate]: parsing foundry's scoped remapping syntax for conflict resolution #2791

@penandlim

Description

@penandlim

Describe the issue:

Foundry allows scoped remapping in case of sub-dependency conflict
https://getfoundry.sh/guides/project-setup/dependencies/#remapping-conflicts

However slither seems to not be able to recognize this remapping, failing to resolve the contracts from the remapped sub-dependency.

Code example to reproduce the issue:

https://github.com/penandlim/slither-remapping-bug

Steps to repro in the README.md
Check the CI result on master branch for the slither error output.

Version:

0.11.3

Relevant log output:

'forge clean' running (wd: /github/workspace)
'forge config --json' running
'forge build --build-info --skip */test/** */script/** --force' running (wd: /github/workspace)
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:SlitherSolcParsing:crytic-compile returned an empty AST. If you are trying to analyze a contract from etherscan or similar make sure it has source code available.
ERROR:Slither:Failed to resolved name for reference id 2448 in /github/workspace/dependencies/tokenized-strategy-3.0.4/src/BaseStrategy.sol.
ERROR:Slither:Failed to resolved name for reference id 2484 in /github/workspace/dependencies/tokenized-strategy-3.0.4/src/BaseStrategy.sol.
ERROR:Slither:Failed to resolved name for reference id 2280 in /github/workspace/dependencies/tokenized-strategy-3.0.4/src/BaseStrategy.sol.
ERROR:Slither:Failed to resolved name for reference id 2280 in /github/workspace/dependencies/tokenized-strategy-3.0.4/src/interfaces/ITokenizedStrategy.sol.
ERROR:Slither:Failed to resolved name for reference id 2484 in /github/workspace/dependencies/tokenized-strategy-3.0.4/src/interfaces/ITokenizedStrategy.sol.
ERROR:Slither:Failed to resolved name for reference id 2448 in /github/workspace/dependencies/tokenized-strategy-3.0.4/src/interfaces/ITokenizedStrategy.sol.
ERROR:Slither:Failed to resolved name for reference id 2280 in /github/workspace/src/TestStrategy.sol.
ERROR:Slither:Failed to resolved name for reference id 2448 in /github/workspace/src/TestStrategy.sol.
ERROR:Slither:Failed to resolved name for reference id 2484 in /github/workspace/src/TestStrategy.sol.
Traceback (most recent call last):
  File "/opt/slither/bin/slither", line 8, in <module>
    sys.exit(main())
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 776, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 882, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 107, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/slither/lib/python3.9/site-packages/slither/slither.py", line 202, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/opt/slither/lib/python3.9/site-packages/slither/slither.py", line 211, in _init_parsing_and_analyses
    raise e
  File "/opt/slither/lib/python3.9/site-packages/slither/slither.py", line 207, in _init_parsing_and_analyses
    parser.parse_contracts()
  File "/opt/slither/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 508, in parse_contracts
    target = resolve_remapping_and_renaming(contract_parser, i)
  File "/opt/slither/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 494, in resolve_remapping_and_renaming
    assert target, f"Contract {contract_name} not found"
AssertionError: Contract IERC20Permit not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-candidateBugs reports that are not yet confirmed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions