mythril
mythril copied to clipboard
Import has inconsistent behavior when `constructor()` has arguments
Description
Importing a solidity contract having a constructor with arguments returns the error
input files do not contain any valid contracts when running myth -x ./contract.sol
How to Reproduce
I've got 3 examples that I think are relevant for this issue.
1. Import problem
Create test1base.sol
pragma solidity ^0.4.24;
contract Test1Base {
uint256 public a;
constructor(uint256 _a) public {
a = _a;
}
}
And test1.sol
pragma solidity ^0.4.24;
import "./test1base.sol";
contract Test1 is Test1Base {
}
Running mythril on test1.sol outputs an error
$ myth -x ./test1.sol
input files do not contain any valid contracts
Solidity compiler (solc) does not output any error
2. Having all of the code in one file works just fine
Create test2.sol
pragma solidity ^0.4.24;
contract Test2Base {
uint256 public a;
constructor(uint256 _a) public {
a = _a;
}
}
contract Test2 is Test2Base {
}
Running mythril works with no issues
$ myth -x test2.sol
The analysis was completed successfully. No issues were detected.
3. Importing a contract with no arguments works too
Create test3base.sol
pragma solidity ^0.4.24;
contract Test3Base {
uint256 a;
constructor () public {
a = 42;
}
}
And test3.sol
pragma solidity ^0.4.24;
import "./test3base.sol";
contract Test3 is Test3Base {
}
Running mythril works ok
$ myth -x test3.sol
The analysis was completed successfully. No issues were detected.
Expected behavior
Running mythril on example 1 should output
The analysis was completed successfully. No issues were detected.
Environment
- Mythril version:
v0.19.3 - Solidity compiler and version:
0.4.25+commit.59dbf8f1.Linux.g++ - Python version:
3.7.1 - OS and Version:
Arch linux; kernel version: 4.18.16-arch1-1-ARCH
Thats pretty interesting! thanks for reporting the bug.
Just tested this on v0.20.0 and it still happens