Closed cleanunicorn closed 5 years ago
PS C:\workspace\test> .\node_modules\.bin\mythos analyze ./contracts/index.sol A --mythxEthAddress=a --mythxPassword=b
Reading contract ./contracts/index.sol... done
Compiling with Solidity version: latest
» Warning: ./contracts/i.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding
» "pragma solidity ^0.5.9;"
» contract B {}
» ^ (Relevant source part starts here and spans across multiple lines).
»
» Warning: ./contracts/index.sol:1:1: Warning: Source file does not specify required compiler version! Consider
» adding "pragma solidity ^0.5.9;"
» import "./i.sol";
» ^ (Relevant source part starts here and spans across multiple lines).
»
Compiling contract ./contracts/index.sol... done
Analyzing contract A... !
» Error: MythX login for ethereum address a failed:
» Parse error of JWT login request: Wrong credentials - check your ethAddress and password (HTTP status 400)
I tried this on Windows and it was able to compile a contract that was inheriting another contract:
$ .\node_modules\.bin\mythos analyze ./contracts/index.sol A --mythxEthAddress=a --mythxPassword=b
Reading contract ./contracts/index.sol... done
Compiling with Solidity version: latest
» Warning: ./contracts/i.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding
» "pragma solidity ^0.5.9;"
» contract B {}
» ^ (Relevant source part starts here and spans across multiple lines).
»
» Warning: ./contracts/index.sol:1:1: Warning: Source file does not specify required compiler version! Consider
» adding "pragma solidity ^0.5.9;"
» import "./i.sol";
» ^ (Relevant source part starts here and spans across multiple lines).
»
Compiling contract ./contracts/index.sol... done
Analyzing contract A... !
» Error: MythX login for ethereum address a failed:
» Parse error of JWT login request: Wrong credentials - check your ethAddress and password (HTTP status 400)
The contracts were saved in the contracts/
folder and their contents are:
contracts/i.sol
contract B {}
contracts/index.sol
import "./i.sol";
contract A is B {}
Mythos version: 0.9.0
Can your confirm you still get the error with this version and these files?
Reopen this if you can reproduce the issue.
I believe I am able to reproduce this issue with 0.9.0.
Running in the root of the project:
C:\....\simpleimport>mythos analyze contracts\index.sol A
Reading contract contracts\index.sol... done
Compiling with Solidity version: latest
» Error: contracts\index.sol:1:1: ParserError: Source "i.sol" not found: ENOENT: no such file or directory, stat 'i.sol'
» import "./i.sol";
» ^---------------^
»
Compiling contract contracts\index.sol... failed
Then going into the contracts directory:
C:\....\simpleimport>cd contracts
C:\....\simpleimport\contracts>mythos analyze index.sol A
Reading contract index.sol... done
Compiling with Solidity version: latest
» Warning: i.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.5.9;"
» contract B {}
» ^-----------^
»
» Warning: index.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.5.9;"
» import "./i.sol";
» ^ (Relevant source part starts here and spans across multiple lines).
»
Compiling contract index.sol... done
Analyzing contract A... !
» Error: Sources are provided without `mainSource` field
There still is some kind of error there, but it gets farther. (Also, I got the same experience when I tried this with MetaCoin.sol again.)
(I am not able to reopen this issue.)
I am reopening this issue because it has more information and will mark https://github.com/cleanunicorn/mythos/issues/40 as a duplicate.
I have problems reproducing this bug on Windows. I think I will try with a Windows virtual machine and debug this problem.
@use-strict I see the compilation worked
Compiling contract ./contracts/index.sol... done
The analysis failed because an invalid authentication was specified in the command line. You can replace --mythxEthAddress=a --mythxPassword=b
with your authentication and rerun.
However, if you want to use your environment variables (MYTHX_ETH_ADDRESS
and MYTHX_PASSWORD
) you can just omit the arguments, like this:
PS C:\workspace\test> .\node_modules\.bin\mythos analyze ./contracts/index.sol A
I think I figured out what's going on. I believe that Mythos is expecting UNIX-style forward slashes for paths, even on Windows.
So this fails:
rootofproject>mythos analyze contracts\index.sol A
while this succeeds:
rootofproject>mythos analyze contracts/index.sol A
(And FYI, I'm not using Powershell, I'm using cmd
.)
@bmmpxf Thanks for debugging this :)
Should we close this issue?
If you've got a fix for this, I'm happy to test.
The problem seems to be in the (solc)[https://www.npmjs.com/package/solc] package.
I suggest always using unix paths when specifying files, however it works with windows style paths, as long as they don't contain special characters.
Try with version 0.10.4
. It worked on my local VM. It should work for you too.
@bmmpxf I will close this issue and feel free to reopen it if this problem still happens.
With the MetaCoin project, I run the following in the root of the project:
The error returned is:
But when I move into the contracts directory and run:
The run succeeds:
Presumably the tool is not seeing that the ./ConvertLib.sol is relative to the MetaCoin.col, not the directory that Mythos is running in. That should be fixed.