diff --git a/src/halmos/__main__.py b/src/halmos/__main__.py index aca2da66..c9b03769 100644 --- a/src/halmos/__main__.py +++ b/src/halmos/__main__.py @@ -453,7 +453,7 @@ def setup( print(f"{setup_sig} trace #{idx+1}:") render_trace(setup_ex.context) - if not setup_ex.context.output.error: + if not (err := setup_ex.context.output.error): setup_exs_no_error.append((setup_ex, setup_ex.path.to_smt2(args))) else: @@ -461,7 +461,7 @@ def setup( if opcode not in [EVM.REVERT, EVM.INVALID]: warn_code( INTERNAL_ERROR, - f"Warning: {setup_sig} execution encountered an issue at {mnemonic(opcode)}: {error}", + f"in {setup_sig}, executing {mnemonic(opcode)} failed with: {err}", ) # only render the trace if we didn't already do it @@ -887,7 +887,7 @@ def run_sequential(run_args: RunArgs) -> list[TestResult]: setup_solver, ) except Exception as err: - error(f"Error: {setup_info.sig} failed: {type(err).__name__}: {err}") + error(f"{setup_info.sig} failed: {type(err).__name__}: {err}") if args.debug: traceback.print_exc() # reset any remaining solver states from the default context @@ -1500,7 +1500,7 @@ def on_signal(signum, frame): if total_found == 0: error( - "Error: No tests with" + "No tests with" + f" --match-contract '{contract_regex(args)}'" + f" --match-test '{test_regex(args)}'" ) diff --git a/src/halmos/cheatcodes.py b/src/halmos/cheatcodes.py index dfd6cd9f..8edaa7be 100644 --- a/src/halmos/cheatcodes.py +++ b/src/halmos/cheatcodes.py @@ -602,7 +602,9 @@ def handle(sevm, ex, arg: ByteVec, stack, step_id) -> ByteVec | None: sender = uint160(arg.get_word(4)) result = ex.context.prank.prank(sender) if not result: - raise HalmosException("You have an active prank already.") + raise HalmosException( + "can not call vm.prank(address) with an active prank" + ) return ret # vm.prank(address sender, address origin) @@ -611,7 +613,9 @@ def handle(sevm, ex, arg: ByteVec, stack, step_id) -> ByteVec | None: origin = uint160(arg.get_word(36)) result = ex.context.prank.prank(sender, origin) if not result: - raise HalmosException("You have an active prank already.") + raise HalmosException( + "can not call vm.prank(address, address) with an active prank" + ) return ret # vm.startPrank(address) @@ -619,7 +623,9 @@ def handle(sevm, ex, arg: ByteVec, stack, step_id) -> ByteVec | None: address = uint160(arg.get_word(4)) result = ex.context.prank.startPrank(address) if not result: - raise HalmosException("You have an active prank already.") + raise HalmosException( + "can not call vm.startPrank(address) with an active prank" + ) return ret # vm.startPrank(address sender, address origin) @@ -628,7 +634,9 @@ def handle(sevm, ex, arg: ByteVec, stack, step_id) -> ByteVec | None: origin = uint160(arg.get_word(36)) result = ex.context.prank.startPrank(sender, origin) if not result: - raise HalmosException("You have an active prank already.") + raise HalmosException( + "can not call vm.startPrank(address, address) with an active prank" + ) return ret # vm.stopPrank() diff --git a/src/halmos/logs.py b/src/halmos/logs.py index 92bc7325..1919e75d 100644 --- a/src/halmos/logs.py +++ b/src/halmos/logs.py @@ -9,7 +9,7 @@ logging.basicConfig( format="%(message)s", - handlers=[RichHandler(level=logging.NOTSET, show_time=False)], + handlers=[RichHandler(level=logging.NOTSET, show_time=False, show_path=False)], ) logger = logging.getLogger("halmos")