From 5868e380a0bcf2db4e6205348e81734e21f3ae8d Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Thu, 1 Aug 2024 15:36:44 +0400 Subject: [PATCH] ETH RPC: receipts: use correct txtype in receipts (#12332) * fix bug in receipt for txtype for legacy txns * update ChangeLog * Update CHANGELOG.md Co-authored-by: Rod Vagg --------- Co-authored-by: Rod Vagg --- itests/eth_legacy_transactions_test.go | 2 ++ itests/eth_transactions_test.go | 1 + node/impl/full/eth_utils.go | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/itests/eth_legacy_transactions_test.go b/itests/eth_legacy_transactions_test.go index 791f6794d9b..014dacb19b3 100644 --- a/itests/eth_legacy_transactions_test.go +++ b/itests/eth_legacy_transactions_test.go @@ -81,6 +81,7 @@ func TestLegacyValueTransferValidSignature(t *testing.T) { require.EqualValues(t, ethAddr, receipt.From) require.EqualValues(t, ethAddr2, *receipt.To) require.EqualValues(t, hash, receipt.TransactionHash) + require.EqualValues(t, ethtypes.EthLegacyTxType, receipt.Type) // Success. require.EqualValues(t, ethtypes.EthUint64(0x1), receipt.Status) @@ -227,6 +228,7 @@ func TestLegacyEIP155ValueTransferValidSignature(t *testing.T) { require.EqualValues(t, ethAddr, receipt.From) require.EqualValues(t, ethAddr2, *receipt.To) require.EqualValues(t, hash, receipt.TransactionHash) + require.EqualValues(t, ethtypes.EthLegacyTxType, receipt.Type) // Success. require.EqualValues(t, ethtypes.EthUint64(0x1), receipt.Status) diff --git a/itests/eth_transactions_test.go b/itests/eth_transactions_test.go index 3cb11d4a3a6..e717c09554c 100644 --- a/itests/eth_transactions_test.go +++ b/itests/eth_transactions_test.go @@ -97,6 +97,7 @@ func TestValueTransferValidSignature(t *testing.T) { require.EqualValues(t, ethAddr, receipt.From) require.EqualValues(t, ethAddr2, *receipt.To) require.EqualValues(t, hash, receipt.TransactionHash) + require.EqualValues(t, ethtypes.EIP1559TxType, receipt.Type) // Success. require.EqualValues(t, ethtypes.EthUint64(0x1), receipt.Status) diff --git a/node/impl/full/eth_utils.go b/node/impl/full/eth_utils.go index 9e7d88dfa7f..6c453b00261 100644 --- a/node/impl/full/eth_utils.go +++ b/node/impl/full/eth_utils.go @@ -698,7 +698,7 @@ func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLook TransactionIndex: transactionIndex, BlockHash: blockHash, BlockNumber: blockNumber, - Type: ethtypes.EthUint64(2), + Type: tx.Type, Logs: []ethtypes.EthLog{}, // empty log array is compulsory when no logs, or libraries like ethers.js break LogsBloom: ethtypes.NewEmptyEthBloom(), }