diff --git a/changelog.md b/changelog.md index 024403d692..09b9f9e887 100644 --- a/changelog.md +++ b/changelog.md @@ -84,6 +84,7 @@ * [2256](https://github.com/zeta-chain/node/pull/2256) - fix rate limiter falsely included reverted non-withdraw cctxs * [2327](https://github.com/zeta-chain/node/pull/2327) - partially cherry picked the fix to Bitcoin outbound dust amount * [2362](https://github.com/zeta-chain/node/pull/2362) - set 1000 satoshis as minimum BTC amount that can be withdrawn from zEVM +* [2382](https://github.com/zeta-chain/node/pull/2382) - add tx input and gas in rpc methods for synthetic eth txs ### CI diff --git a/rpc/backend/backend_suite_test.go b/rpc/backend/backend_suite_test.go index 1abd882fd2..21744e87e3 100644 --- a/rpc/backend/backend_suite_test.go +++ b/rpc/backend/backend_suite_test.go @@ -155,6 +155,7 @@ func (suite *BackendTestSuite) buildSyntheticTxResult(txHash string) ([]byte, ab {Type: evmtypes.EventTypeEthereumTx, Attributes: []abci.EventAttribute{ {Key: "ethereumTxHash", Value: txHash}, {Key: "txIndex", Value: "8888"}, + {Key: "txData", Value: "0x1234"}, {Key: "amount", Value: "1000"}, {Key: "txGasUsed", Value: "21000"}, {Key: "txHash", Value: ""}, diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index c76a26ead8..0ceb0160a6 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -56,6 +56,9 @@ func (suite *BackendTestSuite) TestGetSyntheticTransactionByHash() { suite.Require().Equal(uint64(88), txType) suite.Require().Equal(int64(7001), res.ChainID.ToInt().Int64()) suite.Require().Equal(int64(1000), res.Value.ToInt().Int64()) + gas, _ := hexutil.DecodeUint64(res.Gas.String()) + suite.Require().Equal(uint64(21000), gas) + suite.Require().Equal("0x1234", res.Input.String()) suite.Require().Nil(res.V) suite.Require().Nil(res.R) suite.Require().Nil(res.S) 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),