From d09bb99c786669a8390180f81f5c41d59fc23fb4 Mon Sep 17 00:00:00 2001 From: Sheng Lundquist Date: Thu, 31 Oct 2024 13:16:26 -0700 Subject: [PATCH 1/4] Adding whale for sxdai pool --- scripts/fork_fuzz_bots.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/fork_fuzz_bots.py b/scripts/fork_fuzz_bots.py index cb48b00a05..6745904dc8 100644 --- a/scripts/fork_fuzz_bots.py +++ b/scripts/fork_fuzz_bots.py @@ -45,6 +45,8 @@ "0xdC035D45d973E3EC169d2276DDab16f1e407384F": "0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD", # sUSDe "0x9D39A5DE30e57443BfF2A8307A4256c8797A3497": "0xb99a2c4C1C4F1fc27150681B740396F6CE1cBcF5", + # WXDAI + "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", } GNOSIS_WHALE_ADDRESSES = { From d6f1cd5e16ed9ec24e1219c8095034ac4df09e82 Mon Sep 17 00:00:00 2001 From: Sheng Lundquist Date: Thu, 31 Oct 2024 13:40:33 -0700 Subject: [PATCH 2/4] Padding max long due to overestimation --- src/agent0/core/hyperdrive/policies/random.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/agent0/core/hyperdrive/policies/random.py b/src/agent0/core/hyperdrive/policies/random.py index 2f9c7da4af..dc81fab7b5 100644 --- a/src/agent0/core/hyperdrive/policies/random.py +++ b/src/agent0/core/hyperdrive/policies/random.py @@ -283,7 +283,11 @@ def open_long_with_random_amount( # TODO fix all crashes in calc_max_short and calc_max_long and instead return 0 for max short try: - maximum_trade_amount = interface.calc_max_long(wallet.balance.amount, interface.current_pool_state) + # There's an issue around calc_max_long where it overestimates the max trade amount + # Hence, we multiply it by 0.9 to go under + maximum_trade_amount = interface.calc_max_long( + wallet.balance.amount, interface.current_pool_state + ) * FixedPoint(0.9) # TODO pyo3 throws a PanicException here, which is derived from BaseException # Ideally, we would import the exact exception in python here, but pyo3 doesn't # expose this exception. Need to (1) fix the underlying calc_max_short bug, or From b1d06d897d0a56cb530926edb64b1e9bf954e01d Mon Sep 17 00:00:00 2001 From: Sheng Lundquist Date: Thu, 31 Oct 2024 13:42:21 -0700 Subject: [PATCH 3/4] tmp removing insufficient liquidity rollbar ignore --- scripts/fork_fuzz_bots.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/fork_fuzz_bots.py b/scripts/fork_fuzz_bots.py index 6745904dc8..576fe04467 100644 --- a/scripts/fork_fuzz_bots.py +++ b/scripts/fork_fuzz_bots.py @@ -103,9 +103,9 @@ def _fuzz_ignore_logging_to_rollbar(exc: Exception) -> bool: if orig_exception is None: return False - # Insufficient liquidity error - if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "InsufficientLiquidity()": - return True + # # Insufficient liquidity error + # if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "InsufficientLiquidity()": + # return True # Circuit breaker triggered error if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "CircuitBreakerTriggered()": From ff113e913d5762b2bc1beb779c93dc568a687a80 Mon Sep 17 00:00:00 2001 From: Sheng Lundquist Date: Thu, 31 Oct 2024 13:45:58 -0700 Subject: [PATCH 4/4] Undoing not reporting insufficient liquidity --- scripts/fork_fuzz_bots.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/fork_fuzz_bots.py b/scripts/fork_fuzz_bots.py index 576fe04467..6745904dc8 100644 --- a/scripts/fork_fuzz_bots.py +++ b/scripts/fork_fuzz_bots.py @@ -103,9 +103,9 @@ def _fuzz_ignore_logging_to_rollbar(exc: Exception) -> bool: if orig_exception is None: return False - # # Insufficient liquidity error - # if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "InsufficientLiquidity()": - # return True + # Insufficient liquidity error + if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "InsufficientLiquidity()": + return True # Circuit breaker triggered error if isinstance(orig_exception, ContractCustomError) and exc.decoded_error == "CircuitBreakerTriggered()":