报错提示:Error: Source file requires different compiler version (current compiler is 0.8.9+commit.e5eed63a.Linux.g++) – note that nightly builds are considered to be strictly less than the released version
中文翻译:错误:源文件需要不同的编译器版本(当前编译器为0.8.9+commit.e5eed63a.Linux.g++)-请注意,夜间版本被认为严格低于发布版本
本文使用的是trailofbits/eth-security-toolbox的docker镜像。
拉取安装命令为:
拉取镜像:docker pull trailofbits/eth-security-toolbox 挂载硬盘并运行:docker run -it -v /home/share:/share trailofbits/eth-security-toolbox |
查询slither版本:
ethsec@1de8139f5251:~$ slither –version 0.8.3 |
查找solc命令所在位置:
ethsec@1de8139f5251:~$ find -name solc ./.local/bin/solc |
切换到bin目录下
ethsec@1de8139f5251:~$ cd ./.local/bin |
查询bin目录下文件,确认文件夹位置
ethsec@1de8139f5251:~/.local/bin$ ls base58evmasmjsonschemanetaddrslitherslither-check-upgradeabilityslither-formatslither-read-storagesolc-select crytic-compileflaskmanticorenormalizerslither-check-ercslither-find-pathsslither-mutateslither-similwasmdump ethenofuturizemanticore-verifierpasteurizeslither-check-kspecslither-flatslither-propsolcz3 |
查询solc-select帮助
ethsec@1de8139f5251:~/.local/bin$ solc-select -h usage: solc-select [-h] {install,use,versions} … positional arguments: {install,use,versions} Allows users to install and quickly switch between Solidity compiler versions installlist and install available solc versions usechange the version of global solc compiler versionsprints out all installed solc versions optional arguments: -h, –helpshow this help message and exit |
打印所有solc-select版本
ethsec@1de8139f5251:~/.local/bin$ solc-select versions 0.8.9 (current, set by /home/ethsec/.solc-select/global-version) 0.8.8 0.8.7 0.8.6 0.8.5 0.8.4 0.8.3 0.8.2 0.8.13 0.8.12 0.8.11 0.8.10 0.8.1 0.8.0 0.7.6 0.7.5 0.7.4 0.7.3 0.7.2 0.7.1 0.7.0 0.6.9 0.6.8 0.6.7 0.6.6 0.6.5 0.6.4 0.6.3 0.6.2 0.6.12 0.6.11 0.6.10 0.6.1 0.6.0 0.5.9 0.5.8 0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.17 0.5.16 0.5.15 0.5.14 0.5.13 0.5.12 0.5.11 0.5.10 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 0.4.5 0.4.4 0.4.3 0.4.26 0.4.25 0.4.24 0.4.23 0.4.22 0.4.21 0.4.20 0.4.2 0.4.19 0.4.18 0.4.17 0.4.16 0.4.15 0.4.14 0.4.13 0.4.12 0.4.11 0.4.10 0.4.1 0.4.0 lc-select use usage: solc-select use [-h] USE_VERSION solc-select use: error: the following arguments are required: USE_VERSION |
设置solc默认使用版本,例如:
ethsec@1de8139f5251:~/.local/bin$ solc-select use 0.7.1 Switched global version to 0.7.1 |
最后重新执行检测命令:
如何使用:
批量检测:
slither . |
单文件检测:
slither tests/uninitialized.sol |