From 33375bdcacea657eda697098d67a6e3a24f52959 Mon Sep 17 00:00:00 2001 From: Nikita P Date: Mon, 23 Dec 2024 14:53:01 +0100 Subject: [PATCH] fix: more logging for set balance --- utils/balance.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/balance.py b/utils/balance.py index d2635ed3..e58e23c8 100644 --- a/utils/balance.py +++ b/utils/balance.py @@ -6,17 +6,20 @@ def set_balance_in_wei(address, balance): account = accounts.at(address, force=True) providers = ["evm_setAccountBalance", "hardhat_setBalance", "anvil_setBalance"] + log_string = "" + for provider in providers: if account.balance() == balance: break try: - web3.provider.make_request(provider, [address, hex(balance)]) + resp = web3.provider.make_request(provider, [address, hex(balance)]) except ValueError as e: + log_string += f"ERR1: {provider}: {e.args[0].get('message')}, RESP: {resp}" if e.args[0].get("message") != f"Method {provider} is not supported": raise e - assert account.balance() == balance, f"FSB: EXP: {balance} ACT: {account.balance()} ADDR: {address}" + assert account.balance() == balance, f"FSB: EXP: {balance} ACT: {account.balance()} ADDR: {address}, ERR: {log_string}" return account