diff --git a/mythril/interfaces/cli.py b/mythril/interfaces/cli.py index bfa5dd1d..e1759915 100644 --- a/mythril/interfaces/cli.py +++ b/mythril/interfaces/cli.py @@ -397,17 +397,11 @@ def validate_args(args: Namespace): "The --query-signature function requires the python package ethereum-input-decoder", ) - if args.enable_iprof: - if args.v < 4: - exit_with_error( - args.outform, - "--enable-iprof must be used with -v LOG_LEVEL where LOG_LEVEL >= 4", - ) - elif not (args.graph or args.fire_lasers or args.statespace_json): - exit_with_error( - args.outform, - "--enable-iprof must be used with one of -g, --graph, -x, --fire-lasers, -j and --statespace-json", - ) + if args.enable_iprof and args.v < 4: + exit_with_error( + args.outform, + "--enable-iprof must be used with -v LOG_LEVEL where LOG_LEVEL >= 4", + ) def set_config(args: Namespace): @@ -512,12 +506,6 @@ def execute_command( """ if args.command == "read-storage": - if not args.address: - exit_with_error( - args.outform, - "To read storage, provide the address of a deployed contract with the -a option.", - ) - storage = disassembler.get_state_variable_from_storage( address=address, params=[a.strip() for a in args.storage_slots.strip().split(",")], diff --git a/tests/cmd_line_test.py b/tests/cmd_line_test.py index 528bbf9a..a3ed1949 100644 --- a/tests/cmd_line_test.py +++ b/tests/cmd_line_test.py @@ -46,6 +46,18 @@ class CommandLineToolTestCase(BaseTestCase): command = "python3 {} analyze {}".format(MYTH, solidity_file) self.assertIn("111", output_of(command)) + def test_analyze_bytecode(self): + solidity_file = str(TESTDATA / "inputs" / "origin.sol.o") + command = "python3 {} analyze --bin-runtime -f {}".format(MYTH, solidity_file) + self.assertIn("111", output_of(command)) + + def test_invalid_args_iprof(self): + solidity_file = str(TESTDATA / "input_contracts" / "origin.sol") + command = "python3 {} analyze {} --enable-iprof -o json".format( + MYTH, solidity_file + ) + self.assertIn(""""success": false""", output_of(command)) + class TruffleTestCase(BaseTestCase): def test_analysis_truffle_project(self):