enzymefinance / oyente

An Analysis Tool for Smart Contracts
GNU General Public License v3.0
1.32k stars 311 forks source link

docker: separate CLI and WEB building stages #389

Closed yxliang01 closed 4 years ago

yxliang01 commented 4 years ago

This addresses #383 and fixes #387 .

yxliang01 commented 4 years ago

Hi @anhdungle93 , as I don't have the environment at the moment, would you like to help me test this PR by docker build -t oyente --target CLI . ? If it works, I believe your issue is sort of resolved.

anhdungle93 commented 4 years ago

@yxliang01 sorry for my late response. The command output the following error:

(oyente_env) ➜  oyente docker build -t oyente --target CLI .
Sending build context to Docker daemon  4.096kB
Error response from daemon: failed to reach build target CLI in Dockerfile

I tried to google and this may be the problem https://github.com/moby/moby/issues/36956

anhdungle93 commented 4 years ago

My bad, I didn't take the Dockerfile from the PR. I managed to build now but when I want to run the image I get

python3: can't open file '/oyente/oyente.py': [Errno 2] No such file or directory
yxliang01 commented 4 years ago

@anhdungle93 Fixed, if everything goes well, you should be able to use Oyente CLI in docker. Let me know how it goes. Thanks!

anhdungle93 commented 4 years ago

@yxliang01 The path is stlll not correct

oyente docker run -it oyente
python3: can't open file 'oyente/oyente/oyente.py': [Errno 2] No such file or directory
yxliang01 commented 4 years ago

@anhdungle93 Hmm this is awkward. By the way, why your last error message doesn't have a leading / ? I have rechecked the committed file, it is a absolute path in branch. Anyways, I think I will try to have an environment to test it out myself. Thanks for your help!

anhdungle93 commented 4 years ago

@yxliang01 thanks for the help. I tried to add the / too, but still got the same error

python3: can't open file '/oyente/oyente/oyente.py': [Errno 2] No such file or directory
yxliang01 commented 4 years ago

@anhdungle93 Thanks again. I will try to get a setup on my end, and fix accordingly later. If you wish to use Oyente CLI for now, please run docker run -it --entrypoint bash oyente then and manually locate the correct path of the oyente script (will also be helpful here if you have found it).

anhdungle93 commented 4 years ago

@yxliang01 somehow the only thing in the folder oyente is the Dockerfile

/oyente# ls -a
.  ..  Dockerfile
yxliang01 commented 4 years ago

Hmm @anhdungle93 Then, I am afraid there might be some setup problem at your end. I suggest you try to freshly clone this codebase again and checkout the branch docker-improvement and perform the docker build again (without use of cache).

anhdungle93 commented 4 years ago

@yxliang01 thanks a lot, I managed to run oyente on a smart contract but got

Error: Expected identifier, got 'LParen'

I suspect that oyente only supports old solidity version?

yxliang01 commented 4 years ago

@anhdungle93 Could you file a new issue with the contract used posted?

The officially supported version is 0.4.19 . If I remember correctly, I have successfully run over 0.4.24 or something. Meanwhile, could you confirm that whether the current dockerfile can produce a runnable image?

anhdungle93 commented 4 years ago

@yxliang01 yes the dockerfile produced a runnable image, so we can close issue #388.

yxliang01 commented 4 years ago

Thank you @anhdungle93 again for your help in testing this PR!