Skip to content

Commit

Permalink
debug: gasUsed
Browse files Browse the repository at this point in the history
  • Loading branch information
blindchaser committed Nov 20, 2024
1 parent 79c51b6 commit 92a44bd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions evmrpc/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Check warning on line 94 in evmrpc/tx.go

View check run for this annotation

Codecov / codecov/patch

evmrpc/tx.go#L69-L94

Added lines #L69 - L94 were not covered by tests
}
}
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 92a44bd

Please sign in to comment.