Skip to content

Commit

Permalink
Always log error on contract calls in fuzz bots
Browse files Browse the repository at this point in the history
  • Loading branch information
slundqui committed Oct 23, 2024
1 parent e560927 commit 8912ab5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from agent0.ethpy.base import set_anvil_account_balance
from agent0.hyperfuzz import FuzzAssertionException
from agent0.hyperfuzz.system_fuzz.invariant_checks import run_invariant_checks
from agent0.hyperlogs.rollbar_utilities import log_rollbar_exception

ONE_HOUR_IN_SECONDS = 60 * 60
ONE_DAY_IN_SECONDS = ONE_HOUR_IN_SECONDS * 24
Expand Down Expand Up @@ -307,15 +308,15 @@ def run_fuzz_bots(
try:
agent_trade = agent.execute_policy_action(pool=pool)
except PypechainCallException as exc:
if raise_error_on_crash:
if ignore_raise_error_func is None or not ignore_raise_error_func(exc):
if ignore_raise_error_func is None or not ignore_raise_error_func(exc):
# To ensure we log all errors, even when not from a trade contract call,
# we log the exception here
log_rollbar_exception(
rollbar_log_prefix="Unexpected error", exception=exc, log_level=logging.ERROR
)

if raise_error_on_crash:
raise exc
else:
# TODO this assumes that the resulting exception is logged to rollbar.
# This is the case when the bot crashes during the trade,
# but if a contract call exception happens that we didn't expect,
# the error here won't get logged.
logging.error("Logged %s, continuing", repr(exc))
# Otherwise, we ignore crashes, we want the bot to keep trading
# These errors will get logged regardless

Expand Down

0 comments on commit 8912ab5

Please sign in to comment.