diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 59c16b5178..e232ae5206 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -2085,8 +2085,6 @@ func mockStateSyncTxOnCurrentBlock(t *testing.T, backend *testBackend) common.Ha } func TestRPCGetTransactionReceipt(t *testing.T) { - t.Parallel() - var ( api, _, testSuite = setupTransactionsToApiTest(t) ) @@ -2105,8 +2103,6 @@ func TestRPCGetTransactionReceipt(t *testing.T) { } } func TestRPCGetTransactionByHash(t *testing.T) { - t.Parallel() - var ( api, _, testSuite = setupTransactionsToApiTest(t) ) @@ -2126,8 +2122,6 @@ func TestRPCGetTransactionByHash(t *testing.T) { } func TestRPCGetBlockTransactionCountByHash(t *testing.T) { - t.Parallel() - var ( api, _, _ = setupTransactionsToApiTest(t) ) @@ -2139,6 +2133,18 @@ func TestRPCGetBlockTransactionCountByHash(t *testing.T) { require.Equal(t, expected, *cnt) } +func TestRPCGetTransactionByBlockHashAndIndex(t *testing.T) { + var ( + api, _, _ = setupTransactionsToApiTest(t) + ) + + blobTx := api.GetTransactionByBlockHashAndIndex(context.Background(), api.b.CurrentBlock().Hash(), 0) + stateSyncTx := api.GetTransactionByBlockHashAndIndex(context.Background(), api.b.CurrentBlock().Hash(), 1) + + testRPCResponseWithFile(t, 0, blobTx, "eth_getTransactionByBlockHashAndIndex", "blob-tx") + testRPCResponseWithFile(t, 1, stateSyncTx, "eth_getTransactionByBlockHashAndIndex", "state-sync-tx") +} + func testRPCResponseWithFile(t *testing.T, testid int, result interface{}, rpc string, file string) { data, err := json.MarshalIndent(result, "", " ") if err != nil { @@ -2157,8 +2163,6 @@ func testRPCResponseWithFile(t *testing.T, testid int, result interface{}, rpc s } func TestRPCGetTransactionReceiptsByBlock(t *testing.T) { - t.Parallel() - api, blockNrOrHash, testSuite := setupBlocksToApiTest(t) receipts, err := api.GetTransactionReceiptsByBlock(context.Background(), blockNrOrHash) @@ -2178,8 +2182,6 @@ func TestRPCGetTransactionReceiptsByBlock(t *testing.T) { } func TestRPCGetBlockReceipts(t *testing.T) { - t.Parallel() - api, blockNrOrHash, testSuite := setupBlocksToApiTest(t) receipts, err := api.GetBlockReceipts(context.Background(), blockNrOrHash) diff --git a/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-blob-tx.json b/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-blob-tx.json new file mode 100644 index 0000000000..a933311fdc --- /dev/null +++ b/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-blob-tx.json @@ -0,0 +1,26 @@ +{ + "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", + "blockNumber": "0x6", + "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", + "gas": "0x5208", + "gasPrice": "0x1b09d63b", + "maxFeePerGas": "0x1b09d82e", + "maxPriorityFeePerGas": "0x1", + "maxFeePerBlobGas": "0x1", + "hash": "0xb51ee3d2a89ba5d5623c73133c8d7a6ba9fb41194c17f4302c21b30994a1180f", + "input": "0x", + "nonce": "0x5", + "to": "0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e", + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x3", + "accessList": [], + "chainId": "0x1", + "blobVersionedHashes": [ + "0x0100000000000000000000000000000000000000000000000000000000000000" + ], + "v": "0x1", + "r": "0x38bb9fd000a5c38eab56c1b8ae96556fd58b417d2c8e175d22aadacbdea85d69", + "s": "0x2d50cc6ec19ce8d0736554e740ed7d451ac5e72488c186f87402d28bf301f0a3", + "yParity": "0x1" +} \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-state-sync-tx.json b/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-state-sync-tx.json new file mode 100644 index 0000000000..3ac56785a2 --- /dev/null +++ b/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-state-sync-tx.json @@ -0,0 +1,17 @@ +{ + "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", + "blockNumber": "0x6", + "from": "0x0000000000000000000000000000000000000000", + "gas": "0x0", + "gasPrice": "0x0", + "hash": "0xfff9ab54386f3f5c5817e27cf1c8249968c13578c027389c021172d0568ebe12", + "input": "0x", + "nonce": "0x0", + "to": "0x0000000000000000000000000000000000000000", + "transactionIndex": "0x1", + "value": "0x0", + "type": "0x0", + "v": "0x0", + "r": "0x0", + "s": "0x0" +} \ No newline at end of file