diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index e232ae5206..7d1d8519f0 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -1909,7 +1909,7 @@ func setupTransactionsToApiTest(t *testing.T) (*TransactionAPI, []common.Hash, [ file string }) { config := *params.TestChainConfig - genBlocks := 6 + genBlocks := 5 config.ShanghaiBlock = big.NewInt(0) config.CancunBlock = big.NewInt(0) @@ -1979,20 +1979,6 @@ func setupTransactionsToApiTest(t *testing.T) (*TransactionAPI, []common.Hash, [ StorageKeys: []common.Hash{{0}}, }} tx, err = types.SignTx(types.NewTx(&types.AccessListTx{Nonce: uint64(i), To: nil, Gas: 58100, GasPrice: b.BaseFee(), Data: common.FromHex("0x60806040"), AccessList: accessList}), signer, acc1Key) - case 5: - // blob tx - fee := big.NewInt(500) - fee.Add(fee, b.BaseFee()) - tx, err = types.SignTx(types.NewTx(&types.BlobTx{ - Nonce: uint64(i), - GasTipCap: uint256.NewInt(1), - GasFeeCap: uint256.MustFromBig(fee), - Gas: params.TxGas, - To: acc2Addr, - BlobFeeCap: uint256.NewInt(1), - BlobHashes: []common.Hash{{1}}, - Value: new(uint256.Int), - }), signer, acc1Key) } if err != nil { t.Errorf("failed to sign tx: %v", err) @@ -2044,19 +2030,14 @@ func setupTransactionsToApiTest(t *testing.T) (*TransactionAPI, []common.Hash, [ txHash: common.HexToHash("deadbeef"), file: "txhash-notfound", }, - // 7. blob tx + // 7. state sync tx found { txHash: txHashes[5], - file: "blob-tx", - }, - // 8. state sync tx found - { - txHash: txHashes[6], file: "state-sync-tx", }, } // map sprint 0 to block 6 - backend.ChainConfig().Bor.Sprint["0"] = 6 + backend.ChainConfig().Bor.Sprint["0"] = uint64(genBlocks) api := NewTransactionAPI(backend, new(AddrLocker)) @@ -2128,7 +2109,7 @@ func TestRPCGetBlockTransactionCountByHash(t *testing.T) { cnt := api.GetBlockTransactionCountByHash(context.Background(), api.b.CurrentBlock().Hash()) - // 2 txs: blob tx + state sync tx + // 2 txs: create-contract-with-access-list + state sync tx expected := hexutil.Uint(2) require.Equal(t, expected, *cnt) } @@ -2138,10 +2119,10 @@ func TestRPCGetTransactionByBlockHashAndIndex(t *testing.T) { api, _, _ = setupTransactionsToApiTest(t) ) - blobTx := api.GetTransactionByBlockHashAndIndex(context.Background(), api.b.CurrentBlock().Hash(), 0) + createContractWithAccessList := 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, 0, createContractWithAccessList, "eth_getTransactionByBlockHashAndIndex", "create-contract-with-access-list") testRPCResponseWithFile(t, 1, stateSyncTx, "eth_getTransactionByBlockHashAndIndex", "state-sync-tx") } @@ -2271,9 +2252,9 @@ func setupBlocksToApiTest(t *testing.T) (*BlockChainAPI, rpc.BlockNumberOrHash, backend.ChainConfig().Bor.Sprint["0"] = 1 api := NewBlockChainAPI(backend) - blockHashes := make([]common.Hash, 2) + blockHashes := make([]common.Hash, genBlocks+1) ctx := context.Background() - for i := 0; i < 2; i++ { + for i := 0; i <= genBlocks; i++ { header, err := backend.HeaderByNumber(ctx, rpc.BlockNumber(i)) if err != nil { t.Errorf("failed to get block: %d err: %v", i, err) diff --git a/internal/ethapi/testdata/eth_getBlockReceipts-block-with-blob-tx.json b/internal/ethapi/testdata/eth_getBlockReceipts-block-with-blob-tx.json deleted file mode 100644 index 65c485f09b..0000000000 --- a/internal/ethapi/testdata/eth_getBlockReceipts-block-with-blob-tx.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "blobGasPrice": null, - "blobGasUsed": "0x20000", - "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", - "blockNumber": "0x6", - "contractAddress": null, - "cumulativeGasUsed": "0x5208", - "effectiveGasPrice": "0x1b09d63b", - "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", - "gasUsed": "0x5208", - "logs": [{"address": "0x0000000000000000000000000000000000001010", "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", "blockNumber": "0x6", "data": "0x00000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000de04bce435b746d0000000000000000000000000000000000000000000000000000000000a32f640000000000000000000000000000000000000000000000000de04bce435b22650000000000000000000000000000000000000000000000000000000000a3816c", "logIndex": "0x0", "removed": false, "topics": ["0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x000000000000000000000000703c4b2bd70c169f5717101caee543299fc946c7", "0x0000000000000000000000000000000000000000000000000000000000000000"], "transactionHash": "0xb51ee3d2a89ba5d5623c73133c8d7a6ba9fb41194c17f4302c21b30994a1180f", "transactionIndex": "0x0"}], - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000020000000000000020000000000000000000800000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001800000000000000000000000000000100000000020000000000000000000000000000000000000000020000000000000000000100000", - "status": "0x1", - "to": "0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e", - "transactionHash": "0xb51ee3d2a89ba5d5623c73133c8d7a6ba9fb41194c17f4302c21b30994a1180f", - "transactionIndex": "0x0", - "type": "0x3" - } -] diff --git a/internal/ethapi/testdata/eth_getBlockReceipts-tag-latest.json b/internal/ethapi/testdata/eth_getBlockReceipts-tag-latest.json index 65c485f09b..0ae57519ff 100644 --- a/internal/ethapi/testdata/eth_getBlockReceipts-tag-latest.json +++ b/internal/ethapi/testdata/eth_getBlockReceipts-tag-latest.json @@ -2,14 +2,14 @@ { "blobGasPrice": null, "blobGasUsed": "0x20000", - "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", + "blockHash": "0x4d780246cde52e535f40603d47af8fa1aea807dd3065e1acd97127bea0922b3e", "blockNumber": "0x6", "contractAddress": null, "cumulativeGasUsed": "0x5208", "effectiveGasPrice": "0x1b09d63b", "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", "gasUsed": "0x5208", - "logs": [{"address": "0x0000000000000000000000000000000000001010", "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", "blockNumber": "0x6", "data": "0x00000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000de04bce435b746d0000000000000000000000000000000000000000000000000000000000a32f640000000000000000000000000000000000000000000000000de04bce435b22650000000000000000000000000000000000000000000000000000000000a3816c", "logIndex": "0x0", "removed": false, "topics": ["0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x000000000000000000000000703c4b2bd70c169f5717101caee543299fc946c7", "0x0000000000000000000000000000000000000000000000000000000000000000"], "transactionHash": "0xb51ee3d2a89ba5d5623c73133c8d7a6ba9fb41194c17f4302c21b30994a1180f", "transactionIndex": "0x0"}], + "logs": [{"address": "0x0000000000000000000000000000000000001010", "blockHash": "0x4d780246cde52e535f40603d47af8fa1aea807dd3065e1acd97127bea0922b3e", "blockNumber": "0x6", "data": "0x00000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000de04bce435b746d0000000000000000000000000000000000000000000000000000000000a32f640000000000000000000000000000000000000000000000000de04bce435b22650000000000000000000000000000000000000000000000000000000000a3816c", "logIndex": "0x0", "removed": false, "topics": ["0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x000000000000000000000000703c4b2bd70c169f5717101caee543299fc946c7", "0x0000000000000000000000000000000000000000000000000000000000000000"], "transactionHash": "0xb51ee3d2a89ba5d5623c73133c8d7a6ba9fb41194c17f4302c21b30994a1180f", "transactionIndex": "0x0"}], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000020000000000000020000000000000000000800000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001800000000000000000000000000000100000000020000000000000000000000000000000000000000020000000000000000000100000", "status": "0x1", "to": "0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e", diff --git a/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-blob-tx.json b/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-blob-tx.json deleted file mode 100644 index a933311fdc..0000000000 --- a/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-blob-tx.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "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-create-contract-with-access-list.json b/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-create-contract-with-access-list.json new file mode 100644 index 0000000000..6a8f8f1804 --- /dev/null +++ b/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-create-contract-with-access-list.json @@ -0,0 +1,27 @@ +{ + "blockHash": "0x4d780246cde52e535f40603d47af8fa1aea807dd3065e1acd97127bea0922b3e", + "blockNumber": "0x5", + "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", + "gas": "0xe2f4", + "gasPrice": "0x1ecb3fb4", + "hash": "0xb5a1148819cfdfff9bfe70035524fec940eb735d89b76960b97751d01ae2a9f2", + "input": "0x60806040", + "nonce": "0x4", + "to": null, + "transactionIndex": "0x0", + "value": "0x0", + "type": "0x1", + "accessList": [ + { + "address": "0x0000000000000000000000000000000000031ec7", + "storageKeys": [ + "0x0000000000000000000000000000000000000000000000000000000000000000" + ] + } + ], + "chainId": "0x1", + "v": "0x0", + "r": "0xb4f6dc1e9c3c5904b7b3969e84dd3eefe68cf1b1951039ccf1848f471660671c", + "s": "0x77137b10f51515bcf3268f969a8bee4cb6d0d9521f402b058927071a9cc7e3d8", + "yParity": "0x0" +} \ 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 index 3ac56785a2..e1e290b0ff 100644 --- a/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-state-sync-tx.json +++ b/internal/ethapi/testdata/eth_getTransactionByBlockHashAndIndex-state-sync-tx.json @@ -1,10 +1,10 @@ { - "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", - "blockNumber": "0x6", + "blockHash": "0x4d780246cde52e535f40603d47af8fa1aea807dd3065e1acd97127bea0922b3e", + "blockNumber": "0x5", "from": "0x0000000000000000000000000000000000000000", "gas": "0x0", "gasPrice": "0x0", - "hash": "0xfff9ab54386f3f5c5817e27cf1c8249968c13578c027389c021172d0568ebe12", + "hash": "0x08ce9234678f85834bdf3ebed2d580dbac00a3899f9e7020e36c9a93fd1a610a", "input": "0x", "nonce": "0x0", "to": "0x0000000000000000000000000000000000000000", diff --git a/internal/ethapi/testdata/eth_getTransactionByHash-blob-tx.json b/internal/ethapi/testdata/eth_getTransactionByHash-blob-tx.json deleted file mode 100644 index a933311fdc..0000000000 --- a/internal/ethapi/testdata/eth_getTransactionByHash-blob-tx.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "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_getTransactionByHash-state-sync-tx.json b/internal/ethapi/testdata/eth_getTransactionByHash-state-sync-tx.json index 3ac56785a2..e1e290b0ff 100644 --- a/internal/ethapi/testdata/eth_getTransactionByHash-state-sync-tx.json +++ b/internal/ethapi/testdata/eth_getTransactionByHash-state-sync-tx.json @@ -1,10 +1,10 @@ { - "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", - "blockNumber": "0x6", + "blockHash": "0x4d780246cde52e535f40603d47af8fa1aea807dd3065e1acd97127bea0922b3e", + "blockNumber": "0x5", "from": "0x0000000000000000000000000000000000000000", "gas": "0x0", "gasPrice": "0x0", - "hash": "0xfff9ab54386f3f5c5817e27cf1c8249968c13578c027389c021172d0568ebe12", + "hash": "0x08ce9234678f85834bdf3ebed2d580dbac00a3899f9e7020e36c9a93fd1a610a", "input": "0x", "nonce": "0x0", "to": "0x0000000000000000000000000000000000000000", diff --git a/internal/ethapi/testdata/eth_getTransactionReceipt-blob-tx.json b/internal/ethapi/testdata/eth_getTransactionReceipt-blob-tx.json deleted file mode 100644 index 610cd2c821..0000000000 --- a/internal/ethapi/testdata/eth_getTransactionReceipt-blob-tx.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "blobGasPrice": null, - "blobGasUsed": "0x20000", - "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", - "blockNumber": "0x6", - "contractAddress": null, - "cumulativeGasUsed": "0x5208", - "effectiveGasPrice": "0x1b09d63b", - "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", - "gasUsed": "0x5208", - "logs": [{"address": "0x0000000000000000000000000000000000001010", "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", "blockNumber": "0x6", "data": "0x00000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000de04bce435b746d0000000000000000000000000000000000000000000000000000000000a32f640000000000000000000000000000000000000000000000000de04bce435b22650000000000000000000000000000000000000000000000000000000000a3816c", "logIndex": "0x0", "removed": false, "topics": ["0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x000000000000000000000000703c4b2bd70c169f5717101caee543299fc946c7", "0x0000000000000000000000000000000000000000000000000000000000000000"], "transactionHash": "0xb51ee3d2a89ba5d5623c73133c8d7a6ba9fb41194c17f4302c21b30994a1180f", "transactionIndex": "0x0"}], - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000020000000000000020000000000000000000800000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001800000000000000000000000000000100000000020000000000000000000000000000000000000000020000000000000000000100000", - "status": "0x1", - "to": "0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e", - "transactionHash": "0xb51ee3d2a89ba5d5623c73133c8d7a6ba9fb41194c17f4302c21b30994a1180f", - "transactionIndex": "0x0", - "type": "0x3" -} diff --git a/internal/ethapi/testdata/eth_getTransactionReceipt-state-sync-tx.json b/internal/ethapi/testdata/eth_getTransactionReceipt-state-sync-tx.json index 5096fa818f..a40d454741 100644 --- a/internal/ethapi/testdata/eth_getTransactionReceipt-state-sync-tx.json +++ b/internal/ethapi/testdata/eth_getTransactionReceipt-state-sync-tx.json @@ -1,6 +1,6 @@ { - "blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b", - "blockNumber": "0x6", + "blockHash": "0x4d780246cde52e535f40603d47af8fa1aea807dd3065e1acd97127bea0922b3e", + "blockNumber": "0x5", "contractAddress": null, "cumulativeGasUsed": "0x0", "effectiveGasPrice": "0x0", @@ -10,7 +10,7 @@ "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "status": "0x1", "to": "0x0000000000000000000000000000000000000000", - "transactionHash": "0xfff9ab54386f3f5c5817e27cf1c8249968c13578c027389c021172d0568ebe12", + "transactionHash": "0x08ce9234678f85834bdf3ebed2d580dbac00a3899f9e7020e36c9a93fd1a610a", "transactionIndex": "0x1", "type": "0x0" } \ No newline at end of file