Skip to content

Commit

Permalink
removed blob tx tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucca30 committed Jan 14, 2025
1 parent 31e7d4a commit b0bba24
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 128 deletions.
35 changes: 8 additions & 27 deletions internal/ethapi/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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)
}
Expand All @@ -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")
}

Expand Down Expand Up @@ -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)
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions internal/ethapi/testdata/eth_getBlockReceipts-tag-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
26 changes: 0 additions & 26 deletions internal/ethapi/testdata/eth_getTransactionByHash-blob-tx.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 0 additions & 18 deletions internal/ethapi/testdata/eth_getTransactionReceipt-blob-tx.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"blockHash": "0x4446b1498499cab37cfec330097fadf285c703444d431756940528d32fe0e97b",
"blockNumber": "0x6",
"blockHash": "0x4d780246cde52e535f40603d47af8fa1aea807dd3065e1acd97127bea0922b3e",
"blockNumber": "0x5",
"contractAddress": null,
"cumulativeGasUsed": "0x0",
"effectiveGasPrice": "0x0",
Expand All @@ -10,7 +10,7 @@
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x0000000000000000000000000000000000000000",
"transactionHash": "0xfff9ab54386f3f5c5817e27cf1c8249968c13578c027389c021172d0568ebe12",
"transactionHash": "0x08ce9234678f85834bdf3ebed2d580dbac00a3899f9e7020e36c9a93fd1a610a",
"transactionIndex": "0x1",
"type": "0x0"
}

0 comments on commit b0bba24

Please sign in to comment.