From c374fb35aa212dbd2461ff7f54548c655663df0f Mon Sep 17 00:00:00 2001 From: skosito Date: Tue, 25 Jun 2024 19:25:27 +0200 Subject: [PATCH] fix tx info and gas in rpc methods --- rpc/types/events.go | 4 +++- rpc/types/utils.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rpc/types/events.go b/rpc/types/events.go index 4a265f2c6d..f43270fae3 100644 --- a/rpc/types/events.go +++ b/rpc/types/events.go @@ -169,7 +169,8 @@ func ParseTxResult(result *abci.ResponseDeliverTx, tx sdk.Tx) (*ParsedTxs, error } // some old versions miss some events, fill it with tx result - if len(p.Txs) == 1 { + // txs with type CosmosEVMTxType will always emit GasUsed in events so no need to override for those + if len(p.Txs) == 1 && p.Txs[0].Type != CosmosEVMTxType { // #nosec G701 always positive p.Txs[0].GasUsed = uint64(result.GasUsed) } @@ -240,6 +241,7 @@ func ParseTxIndexerResult( Type: parsedTx.Type, Recipient: parsedTx.Recipient, Sender: parsedTx.Sender, + GasUsed: parsedTx.GasUsed, Data: parsedTx.Data, Nonce: parsedTx.Nonce, }, nil diff --git a/rpc/types/utils.go b/rpc/types/utils.go index dfda689557..7ba3c998da 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -252,7 +252,7 @@ func NewRPCTransactionFromIncompleteMsg( Gas: hexutil.Uint64(txAdditional.GasUsed), GasPrice: (*hexutil.Big)(baseFee), Hash: common.HexToHash(msg.Hash), - Input: []byte{}, + Input: txAdditional.Data, Nonce: hexutil.Uint64(txAdditional.Nonce), // TODO: get nonce for "from" from ethermint To: to, Value: (*hexutil.Big)(txAdditional.Value),