Skip to content

Commit

Permalink
less convoluted code in prank/startPrank
Browse files Browse the repository at this point in the history
  • Loading branch information
karmacoma-eth committed Aug 13, 2024
1 parent c1c64e6 commit 17eba86
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/halmos/cheatcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,19 @@ def lookup(self, to: Address) -> PrankResult:

return NO_PRANK

def prank(self, sender: Address, origin: Address | None = None) -> bool:
def prank(
self, sender: Address, origin: Address | None = None, _keep: bool = False
) -> bool:
assert_address(sender)
if self.active:
return False

self.active = PrankResult(sender=sender, origin=origin)
self.keep = False
self.keep = _keep
return True

def startPrank(self, sender: Address, origin: Address | None = None) -> bool:
result = self.prank(sender, origin)
self.keep = result if result else self.keep
return result
return self.prank(sender, origin, _keep=True)

def stopPrank(self) -> bool:
# stopPrank calls are allowed even when no active prank exists
Expand Down

0 comments on commit 17eba86

Please sign in to comment.