crytic / slither

Static Analyzer for Solidity and Vyper
https://blog.trailofbits.com/2018/10/19/slither-a-solidity-static-analysis-framework/
GNU Affero General Public License v3.0
5.33k stars 967 forks source link

How to remap multiple imports? #1061

Closed sjkelleyjr closed 7 months ago

sjkelleyjr commented 2 years ago

I'm trying to run slither on some contracts, but need to remap multiple imports, when I try separating them with a semicolon, it doesn't pick up the second remapping. What is the appropriate syntax for remapping multiple imports using slither?

montyly commented 2 years ago

Hi @sjkelleyjr,

Can you give a bit more context? Are you using a compilation framework (truffe/hardhat/...), or are you doing everything through solc directly?

sjkelleyjr commented 2 years ago

I was using brownie. I ended up getting help and fixing a small bug in crytic-compile, but I'm still curious as to why this wasn't working, so I left the issue open. It might also be related to the other issue I opened that you responded to.

PatrickAlphaC commented 2 years ago

I am also running into this error:

slither ./contracts/Lending.sol --solc-remaps @openzeppelin/contracts=./node_modules/@openzeppelin/contracts;@chainlink/contracts=./node_modules/@chainlink/contracts --exclude naming-convention

and

slither ./contracts/Lending.sol --solc-remaps @openzeppelin/contracts=./node_modules/@openzeppelin/contracts,@chainlink/contracts=./node_modules/@chainlink/contracts --exclude naming-convention

Both miss the multiple imports

elopez commented 2 years ago

Hi @PatrickAlphaC. From looking at the code, --solc-remaps expects space-separated remaps (so --solc-remaps "@foo=./bar @baz=./xyz")

Alternatively, you can use the slither config file and add a list of remappings there (solc_remaps: ["...", "..."])

PatrickAlphaC commented 2 years ago

This was perfect, thank you!!

slither ./contracts/ --solc-remaps '@openzeppelin/contracts=./node_modules/@openzeppelin/contracts @chainlink/contracts=./node_modules/@chainlink/contracts' --exclude naming-convention