Skip to content

Commit

Permalink
Adding large circuit breaker trip to list of ignored errors in fuzz (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
slundqui authored Oct 8, 2024
1 parent ae56ff7 commit 0aecf21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions scripts/fork_fuzz_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
def _fuzz_ignore_errors(exc: Exception) -> bool:
"""Function defining errors to ignore for pausing chain during fuzzing."""
# pylint: disable=too-many-return-statements
# pylint: disable=too-many-branches
# Ignored fuzz exceptions
if isinstance(exc, FuzzAssertionException):
# LP rate invariance check
Expand All @@ -43,6 +44,14 @@ def _fuzz_ignore_errors(exc: Exception) -> bool:
):
return True

# Large circuit breaker check
if (
len(exc.args) >= 2
and exc.args[0] == "Continuous Fuzz Bots Invariant Checks"
and "Large trade has caused the rate circuit breaker to trip." in exc.args[1]
):
return True

# There's a known issue with the underlying steth pool on sepolia,
# due to the deployed mock steth. Hence, we ignore the LP rate invariance check
# for sepolia when fuzzing.
Expand Down
8 changes: 8 additions & 0 deletions scripts/local_fuzz_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def _fuzz_ignore_errors(exc: Exception) -> bool:
):
return True

# Large circuit breaker check
if (
len(exc.args) >= 2
and exc.args[0] == "Continuous Fuzz Bots Invariant Checks"
and "Large trade has caused the rate circuit breaker to trip." in exc.args[1]
):
return True

# Contract call exceptions
elif isinstance(exc, ContractCallException):
orig_exception = exc.orig_exception
Expand Down
2 changes: 1 addition & 1 deletion src/agent0/hyperfuzz/system_fuzz/invariant_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def _check_price_spike(interface: HyperdriveReadInterface, pool_state: PoolState
)
failed = True
exception_message = (
"Large trade has caused the a rate circuit breaker to trip. "
"Large trade has caused the rate circuit breaker to trip. "
f"{current_spot_rate=}, {previous_weighted_spot_rate=}. "
"Difference: "
f"{current_spot_rate- previous_weighted_spot_rate}."
Expand Down

0 comments on commit 0aecf21

Please sign in to comment.