diff --git a/testing/src/runner/runner.py b/testing/src/runner/runner.py index 12a15cf..adadf22 100644 --- a/testing/src/runner/runner.py +++ b/testing/src/runner/runner.py @@ -148,7 +148,8 @@ class TestRunner: comp_id = expected_component.id.lower() if comp_id not in components_by_id: return TestResult.Failed( - f"'{comp_id}' not found in protocol components." + f"'{comp_id}' not found in protocol components. " + f"Available components: {set(components_by_id.keys())}" ) diff = ProtocolComponentExpectation( @@ -265,32 +266,33 @@ class TestRunner: if not pool_state.balances: raise ValueError(f"Missing balances for pool {pool_id}") for sell_token, buy_token in itertools.permutations(pool_state.tokens, 2): - # Try to sell 0.1% of the protocol balance - sell_amount = Decimal("0.001") * pool_state.balances[sell_token.address] - try: - amount_out, gas_used, _ = pool_state.get_amount_out( - sell_token, sell_amount, buy_token - ) - print( - f"Amount out for {pool_id}: {sell_amount} {sell_token} -> {amount_out} {buy_token} - " - f"Gas used: {gas_used}" - ) - except Exception as e: - print( - f"Error simulating get_amount_out for {pool_id}: {sell_token} -> {buy_token}. " - f"Error: {e}" - ) - if pool_id not in failed_simulations: - failed_simulations[pool_id] = [] - failed_simulations[pool_id].append( - SimulationFailure( - pool_id=pool_id, - sell_token=str(sell_token), - buy_token=str(buy_token), - error=str(e), + for prctg in ["0.001", "0.01", "0.1"]: + # Try to sell 0.1% of the protocol balance + sell_amount = Decimal(prctg) * pool_state.balances[sell_token.address] + try: + amount_out, gas_used, _ = pool_state.get_amount_out( + sell_token, sell_amount, buy_token ) - ) - continue + print( + f"Amount out for {pool_id}: {sell_amount} {sell_token} -> {amount_out} {buy_token} - " + f"Gas used: {gas_used}" + ) + except Exception as e: + print( + f"Error simulating get_amount_out for {pool_id}: {sell_token} -> {buy_token} at block {block_number}. " + f"Error: {e}" + ) + if pool_id not in failed_simulations: + failed_simulations[pool_id] = [] + failed_simulations[pool_id].append( + SimulationFailure( + pool_id=pool_id, + sell_token=str(sell_token), + buy_token=str(buy_token), + error=str(e), + ) + ) + continue return failed_simulations @staticmethod