Closed sjkelleyjr closed 1 year ago
Other contracts like 0x009febffa37ee0fd60f2a91743e320294b81840a
are working fine.
@elopez Is this related to https://github.com/crytic/crytic-compile/pull/260
@0xalpharush I don't think so. crytic-compile ends up running the following:
echo '{"language": "Solidity", "sources": {"crytic-export/etherscan-contracts/0x000b132de68df10dda92294e897bdb43d7f5e439-Forwarder.sol": {"urls": ["crytic-export/etherscan-contracts/0x000b132de68df10dda92294e897bdb43d7f5e439-Forwarder.sol"]}}, "settings": {"remappings": [], "optimizer": {"enabled": true, "runs": 200}, "outputSelection": {"*": {"*": ["abi", "metadata", "devdoc", "userdoc", "evm.bytecode", "evm.deployedBytecode"], "": ["ast"]}}}}' | solc --standard-json --allow-paths .
It does so with solc 0.4.16 (as indicated by etherscan) which throws
{"contracts":{},"errors":[{"component":"general","formattedMessage":"Cannot import url (\"crytic-export/etherscan-contracts/0x000b132de68df10dda92294e897bdb43d7f5e439-Forwarder.sol\"): File outside of allowed directories.","message":"Cannot import url (\"crytic-export/etherscan-contracts/0x000b132de68df10dda92294e897bdb43d7f5e439-Forwarder.sol\"): File outside of allowed directories.","severity":"error","type":"IOError"}],"sources":{}}
0.4.17 causes the same error. But if you force 0.4.18, it works fine:
venv/bin/crytic-compile 0x000b132de68df10dda92294e897bdb43d7f5e439 --solc venv/.solc-select/artifacts/solc-0.4.18/solc-0.4.18
WARNING:CryticCompile:Warning: crytic-export/etherscan-contracts/0x000b132de68df10dda92294e897bdb43d7f5e439-Forwarder.sol:9:3: Warning: No visibility specified. Defaulting to "public".
function transfer(address _to, uint256 _value) returns (bool success);
^--------------------------------------------------------------------^
Warning: crytic-export/etherscan-contracts/0x000b132de68df10dda92294e897bdb43d7f5e439-Forwarder.sol:11:3: Warning: No visibility specified. Defaulting to "public".
function balanceOf(address _owner) constant returns (uint256 balance);
^--------------------------------------------------------------------^
(...)
So it looks like the allowed paths handling might have been buggy or behaved differently on earlier solc versions?
I noticed that if you pass a full path (ie an expanded $PWD
) instead of .
. it also works on the earlier solc versions. Maybe we can do that to work around the buggy solc versions?
Yes, --allow-paths
used to be buggy and very inconsistent, especially regarding relative paths. That was fixed only in 0.8.8. See details in https://github.com/ethereum/solidity/pull/11688.
For example with --allow-paths .
the main problem is that the compiler did not always expand paths and even then they were not always properly normalized so relative paths weren't always recognized as matching the pattern.
Any idea what's going on here?
The contract source is in my
crytic-export/etherscan-contracts/
directory.