Skip to content

Commit

Permalink
Fixing exception checks for fuzz bots
Browse files Browse the repository at this point in the history
  • Loading branch information
slundqui committed Oct 16, 2024
1 parent 9619581 commit bd3e98a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 42 deletions.
22 changes: 5 additions & 17 deletions scripts/fork_fuzz_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,37 +72,25 @@ def _fuzz_ignore_errors(exc: Exception) -> bool:
return False

# Insufficient liquidity error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('InsufficientLiquidity')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "InsufficientLiquidity()":
return True

# Circuit breaker triggered error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('CircuitBreakerTriggered')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "CircuitBreakerTriggered()":
return True

# DistributeExcessIdle error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('DistributeExcessIdleFailed')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "DistributeExcessIdleFailed()":
return True

# MinimumTransactionAmount error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('MinimumTransactionAmount')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "MinimumTransactionAmount()":
return True

# DecreasedPresentValueWhenAddingLiquidity error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('DecreasedPresentValueWhenAddingLiquidity')" in exc.args
and exc.decoded_error == "DecreasedPresentValueWhenAddingLiquidity()"
):
return True

Expand Down
32 changes: 7 additions & 25 deletions scripts/local_fuzz_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,11 @@ def _fuzz_ignore_logging_to_rollbar(exc: Exception) -> bool:
return False

# Insufficient liquidity error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('InsufficientLiquidity')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "InsufficientLiquidity()":
return True

# Circuit breaker triggered error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('CircuitBreakerTriggered')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "CircuitBreakerTriggered()":
return True

return False
Expand Down Expand Up @@ -77,37 +71,25 @@ def _fuzz_ignore_errors(exc: Exception) -> bool:
return False

# Insufficient liquidity error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('InsufficientLiquidity')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "InsufficientLiquidity()":
return True

# Circuit breaker triggered error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('CircuitBreakerTriggered')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "CircuitBreakerTriggered()":
return True

# DistributeExcessIdle error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('DistributeExcessIdleFailed')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "DistributeExcessIdleFailed()":
return True

# MinimumTransactionAmount error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('MinimumTransactionAmount')" in exc.args
):
if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "MinimumTransactionAmount()":
return True

# DecreasedPresentValueWhenAddingLiquidity error
if (
isinstance(orig_exception, ContractCustomError)
and "ContractCustomError('DecreasedPresentValueWhenAddingLiquidity')" in exc.args
and exc.decoded_error == "DecreasedPresentValueWhenAddingLiquidity()"
):
return True

Expand Down

0 comments on commit bd3e98a

Please sign in to comment.