Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
daejunpark committed Dec 12, 2024
2 parents aeedd42 + f4f3185 commit e83956c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/halmos/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,15 @@ 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:
opcode = setup_ex.current_opcode()
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)}'"
)
Expand Down
16 changes: 12 additions & 4 deletions src/halmos/cheatcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,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)
Expand All @@ -656,15 +658,19 @@ 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)
elif funsig == hevm_cheat_code.start_prank_sig:
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)
Expand All @@ -673,7 +679,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()
Expand Down
2 changes: 1 addition & 1 deletion src/halmos/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit e83956c

Please sign in to comment.