From 987097910b209b32a7a8231e09329085d9e26928 Mon Sep 17 00:00:00 2001 From: Eric Hennenfent Date: Wed, 26 May 2021 13:14:04 -0700 Subject: [PATCH 1/3] Replace Quick mode with Thorough mode Replaces the `quick_mode` flag with `thorough_mode` and inverts the logic. Closes #2424. --- manticore/__main__.py | 6 +++--- manticore/ethereum/cli.py | 2 +- manticore/ethereum/verifier.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manticore/__main__.py b/manticore/__main__.py index 8f3bba29d..7b4313d15 100644 --- a/manticore/__main__.py +++ b/manticore/__main__.py @@ -227,10 +227,10 @@ def positive(value): ) eth_flags.add_argument( - "--quick-mode", + "--thorough-mode", action="store_true", - help="Configure Manticore for quick exploration. Disable gas, generate testcase only for alive states, " - "do not explore constant functions. Disable all detectors.", + help="Configure Manticore for more exhaustive exploration. Evaluate gas, generate testcases for dead states, " + "explore constant functions, and run a small suite of detectors.", ) config_flags = parser.add_argument_group("Constants") diff --git a/manticore/ethereum/cli.py b/manticore/ethereum/cli.py index f48e86a45..93dbf4dff 100644 --- a/manticore/ethereum/cli.py +++ b/manticore/ethereum/cli.py @@ -89,7 +89,7 @@ def choose_detectors(args): def ethereum_main(args, logger): m = ManticoreEVM(workspace_url=args.workspace) - if args.quick_mode: + if not args.thorough_mode: args.avoid_constant = True args.exclude_all = True args.only_alive_testcases = True diff --git a/manticore/ethereum/verifier.py b/manticore/ethereum/verifier.py index c4ce7a075..f400d1f1f 100644 --- a/manticore/ethereum/verifier.py +++ b/manticore/ethereum/verifier.py @@ -398,10 +398,10 @@ def main(): eth_flags = parser.add_argument_group("Ethereum flags") eth_flags.add_argument( - "--quick-mode", + "--thorough-mode", action="store_true", - help="Configure Manticore for quick exploration. Disable gas, generate testcase only for alive states, " - "do not explore constant functions. Disable all detectors.", + help="Configure Manticore for more exhaustive exploration. Evaluate gas, generate testcases for dead states, " + "explore constant functions, and run a small suite of detectors.", ) eth_flags.add_argument( "--contract_name", type=str, help="The target contract name defined in the source code" From 2cda4e5db1adf3d775e8ce1b33d82c68c01aa216 Mon Sep 17 00:00:00 2001 From: Eric Hennenfent Date: Wed, 26 May 2021 13:39:01 -0700 Subject: [PATCH 2/3] Run truffle tests in thorough mode --- scripts/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 7ebeb21b0..1df9ac5c7 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -97,7 +97,7 @@ run_truffle_tests(){ mkdir truffle_tests cd truffle_tests truffle unbox metacoin - coverage run -m manticore . --contract MetaCoin --workspace output --exclude-all --evm.oog ignore --evm.txfail optimistic + coverage run -m manticore . --contract MetaCoin --workspace output --exclude-all --thorough-mode --evm.oog ignore --evm.txfail optimistic # Truffle smoke test. We test if manticore is able to generate states # from a truffle project. count=$(find output/ -name '*tx' -type f | wc -l) From 9f432b00aa579a8ad63a17786b56ef52b1a81ab1 Mon Sep 17 00:00:00 2001 From: Eric Hennenfent Date: Wed, 9 Jun 2021 11:34:21 -0700 Subject: [PATCH 3/3] Use thorough mode for failing test --- tests/ethereum/test_regressions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/ethereum/test_regressions.py b/tests/ethereum/test_regressions.py index f55ff457a..0db87a17b 100644 --- a/tests/ethereum/test_regressions.py +++ b/tests/ethereum/test_regressions.py @@ -235,7 +235,9 @@ def test_regressions_imports(self): def test_1102(self): with tempfile.TemporaryDirectory() as workspace: - self._simple_cli_run("1102.sol", workspace=workspace, testcases=True) + self._simple_cli_run( + "1102.sol", workspace=workspace, testcases=True, args=["--thorough-mode"] + ) with open(os.path.join(workspace, "global.findings")) as gf: global_findings = gf.read().splitlines()