smartbugs / smartbugs

SmartBugs: A Framework to Analyze Ethereum Smart Contracts

Home Page:https://smartbugs.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prompts at run time

Astronaut-diode opened this issue · comments

Hi, I've been installing smartbugs on my virtual machine following the readme method, and it's all going pretty well.
But when I ran it with the example in the given usage, I found that the program didn't work. I didn't know if I was being too hasty or if Mythril was running slowly. How do I make sure it was actually running, or if I could give a print prompt while it was running?
Example: I've been stuck down here for a couple of hours now, but I'm afraid to stop the process.

(sb) [root@localhost smartbugs]# ./smartbugs -t mythril -f samples/*.sol --processes 4 --mem-limit 4g
which: no solc in (/root/smartbugs/venv/bin:/root/anaconda3/envs/sb/bin:/root/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
Welcome to SmartBugs 2.0.7!
Collecting files ...
10 files to analyse
Assembling tasks ...
10 tasks to execute
Starting task 1/10: mythril-0.23.15 and samples/ERC20.sol
Starting task 2/10: mythril-0.23.15 and samples/BecToken.sol
Starting task 3/10: mythril-0.23.15 and samples/Rubixi.sol
Starting task 4/10: mythril-0.23.15 and samples/SmartBillions.sol
1/10 completed, ETC 0:02:10
Starting task 5/10: mythril-0.23.15 and samples/OpenAddressLottery.sol
2/10 completed, ETC 0:04:59
Starting task 6/10: mythril-0.23.15 and samples/EtherLotto.sol
3/10 completed, ETC 0:03:04
Starting task 7/10: mythril-0.23.15 and samples/Government.sol
4/10 completed, ETC 0:02:28
Starting task 8/10: mythril-0.23.15 and samples/ReturnValue.sol
5/10 completed, ETC 0:01:42
Starting task 9/10: mythril-0.23.15 and samples/SimpleDAO.sol
6/10 completed, ETC 0:01:14
Starting task 10/10: mythril-0.23.15 and samples/MyToken.sol
7/10 completed, ETC 0:00:49
8/10 completed, ETC 0:02:11
9/10 completed, ETC 0:02:00

I tried to change the amount of parallel execution and the CPU and mem options, and the performance felt better. :)

@Astronaut-diode Try the command top. You should see a process myth running at a CPU load close to 100%. If you don't specify a timeout (option --timeout), some processes may take an indefinite amount of time to finish, depending on how the tool handles the search space, and so will SmartBugs. When setting a timeout, then you can still check, after SmartBugs finished, the results for timeouts and out-of-memory situations, and rerun those tasks with more resources.

The 'estimated time to completion' (ETC) may be off by the maximal amount of time a process takes, since the estimate is based on the processes that have finished so far. If the longest process comes last, it will take that time no matter what ETC says.

Among the sample contracts, it seems that SmartBillions.sol takes a long time to analyze. I will add a timeout option to the sample call in the README.

Thanks for reporting the observation!

yeah, thank you for your answer. 👍

@Astronaut-diode Just for the record: On my laptop, Mythril took almost six hours to finish on SmartBillions.sol. So one either needs a timeout or patience ...