From 45959cf6083416e9e166edc04579bb3cabea1514 Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Wed, 20 Sep 2023 14:50:29 +1000 Subject: [PATCH] debug logging --- ethers/contract.nim | 7 +++++++ ethers/providers/jsonrpc.nim | 3 +++ 2 files changed, 10 insertions(+) diff --git a/ethers/contract.nim b/ethers/contract.nim index 3218aef..9b9695c 100644 --- a/ethers/contract.nim +++ b/ethers/contract.nim @@ -14,6 +14,9 @@ export basics export provider export events +logScope: + topics = "ethers contract" + type Contract* = ref object of RootObj provider: Provider @@ -256,6 +259,7 @@ proc confirm*(tx: Future[?TransactionResponse], let receipt = await response.confirm(confirmations, timeout) if receipt.status != TransactionStatus.Success: + echo "[ethers contract] transaction failed, status: ", receipt.status trace "transaction failed", status = receipt.status without blockNumber =? receipt.blockNumber: raiseContractError "Transaction reverted with unknown reason" @@ -265,10 +269,13 @@ proc confirm*(tx: Future[?TransactionResponse], raiseContractError "Transaction reverted with unknown reason" try: + echo "[ethers contract] replaying transaction to get revert reason" trace "replaying transaction to get revert reason" await provider.replay(transaction, blockNumber) + echo "transaction replay completed, no revert reason obtained" trace "transaction replay completed, no revert reason obtained" except ProviderError as e: + echo "transaction revert reason obtained, reason: ", e.msg trace "transaction revert reason obtained", reason = e.msg # should contain the revert reason raiseContractError e.msg diff --git a/ethers/providers/jsonrpc.nim b/ethers/providers/jsonrpc.nim index 5aaeb1c..6d359c6 100644 --- a/ethers/providers/jsonrpc.nim +++ b/ethers/providers/jsonrpc.nim @@ -19,6 +19,9 @@ export chronicles push: {.upraises: [].} +logScope: + topics = "ethers jsonrpc" + type JsonRpcProvider* = ref object of Provider client: Future[RpcClient]