From 92a44bd860e2b145c33a0eebd39e48429afb8b9b Mon Sep 17 00:00:00 2001 From: blindchaser Date: Wed, 20 Nov 2024 16:30:59 -0500 Subject: [PATCH] debug: gasUsed --- evmrpc/tx.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/evmrpc/tx.go b/evmrpc/tx.go index d28b7d30ef..eb6aa6eb2c 100644 --- a/evmrpc/tx.go +++ b/evmrpc/tx.go @@ -8,6 +8,8 @@ import ( "strings" "time" + "log" + "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts" @@ -54,6 +56,7 @@ func (t *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common. return nil, err } // Fill in the receipt if the transaction has failed and used 0 gas + log.Printf("[DEBUG] receipt info: %+v", receipt) if receipt.TxType == 0 && receipt.GasUsed == 0 { // Get the block height := int64(receipt.BlockNumber) @@ -86,7 +89,8 @@ func (t *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common. } receipt.TxType = uint32(etx.Type()) receipt.Status = uint32(ethtypes.ReceiptStatusFailed) - + receipt.GasUsed = 0 + log.Printf("[DEBUG] GetTransactionReceipt gasUsed: %d", receipt.GasUsed) break } } @@ -316,7 +320,7 @@ func encodeReceipt(receipt *types.Receipt, decoder sdk.TxDecoder, block *coretyp } bloom := ethtypes.Bloom{} bloom.SetBytes(receipt.LogsBloom) - + log.Printf("[DEBUG] encodeReceipt gasUsed: %d", receipt.GasUsed) fields := map[string]interface{}{ "blockHash": bh, "blockNumber": hexutil.Uint64(receipt.BlockNumber),