diff --git a/scripts/fork_fuzz_bots.py b/scripts/fork_fuzz_bots.py index 75af21a27..ef4fb360c 100644 --- a/scripts/fork_fuzz_bots.py +++ b/scripts/fork_fuzz_bots.py @@ -24,13 +24,7 @@ # Note that if a token is missing in this mapping, we will try to # call `mint` on the trading token to fund. SEPOLIA_WHALE_ADDRESSES = { - # We ignore DAI since the underlying base token is mintable - # EZETH - "0xDD0D63E304F3D9d9E54d8945bE95011867c80E4f": "0x54A93937EE00838d659795b9bbbe904a00DdF278", - # RETH - "0x4713c86d0e467064A4CD2a974b7fDA79F7efc338": "0x8DFc7c74331162FE2FCc2Ee83173d806E4Ca2CE8", - # STETH - "0x7c485f458aD1F32FF66BC45306fd32974C963c32": "0xb59b98209e82Fc0549Bb2572809B7CD10289Bb91", + # Note all base tokens are mintable up to 500, so we don't need whales here } # TODO set the static block we fork at, in case whales change @@ -49,6 +43,19 @@ def _fuzz_ignore_errors(exc: Exception) -> bool: ): 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. + if ( + # Only ignore steth pools + "STETH" in exc.exception_data["pool_name"] + and len(exc.args) >= 2 + and exc.args[0] == "Continuous Fuzz Bots Invariant Checks" + and "actual_vault_shares=" in exc.args[1] + and "is expected to be greater than expected_vault_shares=" in exc.args[1] + ): + return True + # Contract call exceptions elif isinstance(exc, ContractCallException): orig_exception = exc.orig_exception @@ -189,7 +196,9 @@ def main(argv: Sequence[str] | None = None) -> None: random_advance_time=False, random_variable_rate=False, lp_share_price_test=False, - base_budget_per_bot=FixedPoint(1000), + # TODO all base tokens are mintable up to 500 base + # If we want more, we need to put minting in a loop. + base_budget_per_bot=FixedPoint(500), whale_accounts=SEPOLIA_WHALE_ADDRESSES, ) except Exception as e: # pylint: disable=broad-except diff --git a/src/agent0/core/hyperdrive/interactive/hyperdrive_agent.py b/src/agent0/core/hyperdrive/interactive/hyperdrive_agent.py index 57320b8b6..89abe0a8f 100644 --- a/src/agent0/core/hyperdrive/interactive/hyperdrive_agent.py +++ b/src/agent0/core/hyperdrive/interactive/hyperdrive_agent.py @@ -226,6 +226,7 @@ def add_funds( the token contract. Defaults to an empty mapping. """ # pylint: disable=too-many-arguments + # pylint: disable=too-many-branches if whale_accounts is None: whale_accounts = {} @@ -256,6 +257,10 @@ def add_funds( # Impersonate + transfer to agent here whale_account_addr = whale_accounts[base_token_contract.address] + # Ensure the whale account used here isn't the hyperdrive pool itself + if whale_account_addr == pool.interface.hyperdrive_address: + raise ValueError(f"Cannot use the hyperdrive pool itself as the whale for {pool.name}.") + # Ensure whale has enough base to transfer whale_balance = base_token_contract.functions.balanceOf(whale_account_addr).call() if whale_balance < base.scaled_value: diff --git a/src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py b/src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py index 7a786e5e2..bbbf6f810 100644 --- a/src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py +++ b/src/agent0/hyperfuzz/system_fuzz/run_fuzz_bots.py @@ -322,6 +322,7 @@ def run_fuzz_bots( lp_share_price_test=lp_share_price_test, crash_report_additional_info=hyperdrive_pool._crash_report_additional_info, log_anvil_state_dump=chain.config.log_anvil_state_dump, + pool_name=hyperdrive_pool.name, ) if len(fuzz_exceptions) > 0 and raise_error_on_failed_invariance_checks: # If we have an ignore function, we filter exceptions