diff --git a/jsonrpc/endpoints_eth_test.go b/jsonrpc/endpoints_eth_test.go index cca3e76d79..2f4d1848b9 100644 --- a/jsonrpc/endpoints_eth_test.go +++ b/jsonrpc/endpoints_eth_test.go @@ -1046,11 +1046,11 @@ func TestGetL2BlockByHash(t *testing.T) { []*ethTypes.Transaction{ethTypes.NewTransaction(1, common.Address{}, big.NewInt(1), 1, big.NewInt(1), []byte{})}, nil, []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, - &trie.StackTrie{}, + trie.NewStackTrie(nil), ), ExpectedError: nil, SetupMocks: func(m *mocksWrapper, tc *testCase) { - block := ethTypes.NewBlock(ethTypes.CopyHeader(tc.ExpectedResult.Header()), tc.ExpectedResult.Transactions(), tc.ExpectedResult.Uncles(), []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, &trie.StackTrie{}) + block := ethTypes.NewBlock(ethTypes.CopyHeader(tc.ExpectedResult.Header()), tc.ExpectedResult.Transactions(), tc.ExpectedResult.Uncles(), []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, trie.NewStackTrie(nil)) m.DbTx. On("Commit", context.Background()). @@ -1145,12 +1145,12 @@ func TestGetL2BlockByNumber(t *testing.T) { []*ethTypes.Transaction{ethTypes.NewTransaction(1, common.Address{}, big.NewInt(1), 1, big.NewInt(1), []byte{})}, nil, []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, - &trie.StackTrie{}, + trie.NewStackTrie(nil), ), ExpectedError: nil, SetupMocks: func(m *mocksWrapper, tc *testCase) { block := ethTypes.NewBlock(ethTypes.CopyHeader(tc.ExpectedResult.Header()), tc.ExpectedResult.Transactions(), - tc.ExpectedResult.Uncles(), []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, &trie.StackTrie{}) + tc.ExpectedResult.Uncles(), []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, trie.NewStackTrie(nil)) m.DbTx. On("Commit", context.Background()). @@ -1183,7 +1183,7 @@ func TestGetL2BlockByNumber(t *testing.T) { []*ethTypes.Transaction{ethTypes.NewTransaction(1, common.Address{}, big.NewInt(1), 1, big.NewInt(1), []byte{})}, nil, []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, - &trie.StackTrie{}, + trie.NewStackTrie(nil), ), ExpectedError: nil, SetupMocks: func(m *mocksWrapper, tc *testCase) { @@ -1267,16 +1267,16 @@ func TestGetL2BlockByNumber(t *testing.T) { { Name: "get pending block successfully", Number: big.NewInt(-1), - ExpectedResult: ethTypes.NewBlock(ðTypes.Header{Number: big.NewInt(2)}, nil, nil, nil, &trie.StackTrie{}), + ExpectedResult: ethTypes.NewBlock(ðTypes.Header{Number: big.NewInt(2)}, nil, nil, nil, trie.NewStackTrie(nil)), ExpectedError: nil, SetupMocks: func(m *mocksWrapper, tc *testCase) { lastBlockHeader := ethTypes.CopyHeader(tc.ExpectedResult.Header()) lastBlockHeader.Number.Sub(lastBlockHeader.Number, big.NewInt(1)) - lastBlock := ethTypes.NewBlock(lastBlockHeader, nil, nil, nil, &trie.StackTrie{}) + lastBlock := ethTypes.NewBlock(lastBlockHeader, nil, nil, nil, trie.NewStackTrie(nil)) expectedResultHeader := ethTypes.CopyHeader(tc.ExpectedResult.Header()) expectedResultHeader.ParentHash = lastBlock.Hash() - tc.ExpectedResult = ethTypes.NewBlock(expectedResultHeader, nil, nil, nil, &trie.StackTrie{}) + tc.ExpectedResult = ethTypes.NewBlock(expectedResultHeader, nil, nil, nil, trie.NewStackTrie(nil)) m.DbTx. On("Commit", context.Background()). diff --git a/jsonrpc/endpoints_zkevm_test.go b/jsonrpc/endpoints_zkevm_test.go index 15f8e044f2..929082a821 100644 --- a/jsonrpc/endpoints_zkevm_test.go +++ b/jsonrpc/endpoints_zkevm_test.go @@ -1230,11 +1230,11 @@ func TestGetL2FullBlockByHash(t *testing.T) { []*ethTypes.Transaction{ethTypes.NewTransaction(1, common.Address{}, big.NewInt(1), 1, big.NewInt(1), []byte{})}, nil, []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, - &trie.StackTrie{}, + trie.NewStackTrie(nil), ), ExpectedError: nil, SetupMocks: func(m *mocksWrapper, tc *testCase) { - block := ethTypes.NewBlock(ethTypes.CopyHeader(tc.ExpectedResult.Header()), tc.ExpectedResult.Transactions(), tc.ExpectedResult.Uncles(), []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, &trie.StackTrie{}) + block := ethTypes.NewBlock(ethTypes.CopyHeader(tc.ExpectedResult.Header()), tc.ExpectedResult.Transactions(), tc.ExpectedResult.Uncles(), []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, trie.NewStackTrie(nil)) m.DbTx. On("Commit", context.Background()). @@ -1337,12 +1337,12 @@ func TestGetL2FullBlockByNumber(t *testing.T) { []*ethTypes.Transaction{ethTypes.NewTransaction(1, common.Address{}, big.NewInt(1), 1, big.NewInt(1), []byte{})}, nil, []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, - &trie.StackTrie{}, + trie.NewStackTrie(nil), ), ExpectedError: nil, SetupMocks: func(m *mocksWrapper, tc *testCase) { block := ethTypes.NewBlock(ethTypes.CopyHeader(tc.ExpectedResult.Header()), tc.ExpectedResult.Transactions(), - tc.ExpectedResult.Uncles(), []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, &trie.StackTrie{}) + tc.ExpectedResult.Uncles(), []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, trie.NewStackTrie(nil)) m.DbTx. On("Commit", context.Background()). @@ -1375,7 +1375,7 @@ func TestGetL2FullBlockByNumber(t *testing.T) { []*ethTypes.Transaction{ethTypes.NewTransaction(1, common.Address{}, big.NewInt(1), 1, big.NewInt(1), []byte{})}, nil, []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, - &trie.StackTrie{}, + trie.NewStackTrie(nil), ), ExpectedError: nil, SetupMocks: func(m *mocksWrapper, tc *testCase) { @@ -1461,16 +1461,16 @@ func TestGetL2FullBlockByNumber(t *testing.T) { { Name: "get pending block successfully", Number: "pending", - ExpectedResult: ethTypes.NewBlock(ðTypes.Header{Number: big.NewInt(2)}, nil, nil, nil, &trie.StackTrie{}), + ExpectedResult: ethTypes.NewBlock(ðTypes.Header{Number: big.NewInt(2)}, nil, nil, nil, trie.NewStackTrie(nil)), ExpectedError: nil, SetupMocks: func(m *mocksWrapper, tc *testCase) { lastBlockHeader := ethTypes.CopyHeader(tc.ExpectedResult.Header()) lastBlockHeader.Number.Sub(lastBlockHeader.Number, big.NewInt(1)) - lastBlock := ethTypes.NewBlock(lastBlockHeader, nil, nil, nil, &trie.StackTrie{}) + lastBlock := ethTypes.NewBlock(lastBlockHeader, nil, nil, nil, trie.NewStackTrie(nil)) expectedResultHeader := ethTypes.CopyHeader(tc.ExpectedResult.Header()) expectedResultHeader.ParentHash = lastBlock.Hash() - tc.ExpectedResult = ethTypes.NewBlock(expectedResultHeader, nil, nil, nil, &trie.StackTrie{}) + tc.ExpectedResult = ethTypes.NewBlock(expectedResultHeader, nil, nil, nil, trie.NewStackTrie(nil)) m.DbTx. On("Commit", context.Background()). diff --git a/jsonrpc/server_test.go b/jsonrpc/server_test.go index f4dc76e201..3961b7a357 100644 --- a/jsonrpc/server_test.go +++ b/jsonrpc/server_test.go @@ -233,7 +233,7 @@ func TestBatchRequests(t *testing.T) { []*ethTypes.Transaction{ethTypes.NewTransaction(1, common.Address{}, big.NewInt(1), 1, big.NewInt(1), []byte{})}, nil, []*ethTypes.Receipt{ethTypes.NewReceipt([]byte{}, false, uint64(0))}, - &trie.StackTrie{}, + trie.NewStackTrie(nil), ) testCases := []testCase{ diff --git a/state/genesis.go b/state/genesis.go index b30c5a908b..7613308574 100644 --- a/state/genesis.go +++ b/state/genesis.go @@ -174,7 +174,7 @@ func (s *State) SetGenesis(ctx context.Context, block Block, genesis Genesis, db log.Info("Genesis root ", rootHex) receipts := []*types.Receipt{} - l2Block := types.NewBlock(header, []*types.Transaction{}, []*types.Header{}, receipts, &trie.StackTrie{}) + l2Block := types.NewBlock(header, []*types.Transaction{}, []*types.Header{}, receipts, trie.NewStackTrie(nil)) l2Block.ReceivedAt = block.ReceivedAt storeTxsEGPData := []StoreTxEGPData{} diff --git a/state/pgstatestorage_test.go b/state/pgstatestorage_test.go index 89f48b0d47..d873d1dbc8 100644 --- a/state/pgstatestorage_test.go +++ b/state/pgstatestorage_test.go @@ -83,7 +83,7 @@ func TestGetBatchByL2BlockNumber(t *testing.T) { receipts := []*types.Receipt{receipt} // Create block to be able to calculate its hash - l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, &trie.StackTrie{}) + l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, trie.NewStackTrie(nil)) receipt.BlockHash = l2Block.Hash() storeTxsEGPData := []state.StoreTxEGPData{} @@ -785,7 +785,7 @@ func TestGetLogs(t *testing.T) { Time: uint64(time.Unix()), } - l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, &trie.StackTrie{}) + l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, trie.NewStackTrie(nil)) for _, receipt := range receipts { receipt.BlockHash = l2Block.Hash() } @@ -908,7 +908,7 @@ func TestGetNativeBlockHashesInRange(t *testing.T) { Time: uint64(time.Unix()), } - l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, &trie.StackTrie{}) + l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, trie.NewStackTrie(nil)) for _, receipt := range receipts { receipt.BlockHash = l2Block.Hash() } diff --git a/state/state_test.go b/state/state_test.go index 224df066af..cab45e54a5 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -884,7 +884,7 @@ func TestExecutorRevert(t *testing.T) { transactions := []*types.Transaction{signedTx0, signedTx1} // Create block to be able to calculate its hash - l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, &trie.StackTrie{}) + l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, trie.NewStackTrie(nil)) l2Block.ReceivedAt = time.Now() receipt.BlockHash = l2Block.Hash() @@ -1733,7 +1733,7 @@ func TestAddGetL2Block(t *testing.T) { receipts := []*types.Receipt{receipt} // Create block to be able to calculate its hash - l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, &trie.StackTrie{}) + l2Block := types.NewBlock(header, transactions, []*types.Header{}, receipts, trie.NewStackTrie(nil)) l2Block.ReceivedAt = time receipt.BlockHash = l2Block.Hash() diff --git a/state/transaction.go b/state/transaction.go index cf05c34379..9dbc0bf3e4 100644 --- a/state/transaction.go +++ b/state/transaction.go @@ -181,7 +181,7 @@ func (s *State) StoreTransactions(ctx context.Context, batchNumber uint64, proce receipts := []*types.Receipt{receipt} // Create block to be able to calculate its hash - block := types.NewBlock(header, transactions, []*types.Header{}, receipts, &trie.StackTrie{}) + block := types.NewBlock(header, transactions, []*types.Header{}, receipts, trie.NewStackTrie(nil)) block.ReceivedAt = processingContext.Timestamp receipt.BlockHash = block.Hash() @@ -954,7 +954,7 @@ func (s *State) StoreTransaction(ctx context.Context, batchNumber uint64, proces receipts := []*types.Receipt{receipt} // Create block to be able to calculate its hash - block := types.NewBlock(header, transactions, []*types.Header{}, receipts, &trie.StackTrie{}) + block := types.NewBlock(header, transactions, []*types.Header{}, receipts, trie.NewStackTrie(nil)) block.ReceivedAt = time.Unix(int64(timestamp), 0) receipt.BlockHash = block.Hash()