Skip to content

[Bug-Candidate]: Unable to use slither-check-erc in foundry project with mapping imports #1726

@varunsrin

Description

@varunsrin

Repro Steps

Environment: OSX M1 with slither 0.9.2 and forge 0.2.0 (0453ac8 2023-02-28T00:14:39.246801Z)

  1. Try to run slither-check-erc src/IdRegistry.sol IdRegistry on the Farcaster Contracts repo
slither.exceptions.SlitherError: Invalid compilation:
Invalid solc compilation Error: Source "openzeppelin/contracts/utils/Context.sol" not found: File not found. Searched the following locations: "".
 --> src/IdRegistry.sol:4:1:
  |
4 | import {Context} from "openzeppelin/contracts/utils/Context.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error: Source "openzeppelin/contracts/access/Ownable.sol" not found: File not found. Searched the following locations: "".
 --> src/IdRegistry.sol:5:1:
  |
5 | import {Ownable} from "openzeppelin/contracts/access/Ownable.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error: Source "openzeppelin-contracts/contracts/metatx/ERC2771Context.sol" not found: File not found. Searched the following locations: "".
 --> src/IdRegistry.sol:6:1:
  |
6 | import {ERC2771Context} from "openzeppelin-contracts/contracts/metatx/ERC2771Context.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Issue does not occur with the slither . command, which handles the imports correctly. Issue is resolved by changing the mapped imports to relative imports that do not use the mappings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions