|
8 | 8 | "github.com/prometheus/client_golang/prometheus"
|
9 | 9 | "github.com/scroll-tech/da-codec/encoding"
|
10 | 10 | "github.com/scroll-tech/go-ethereum/common"
|
11 |
| - "github.com/scroll-tech/go-ethereum/common/hexutil" |
12 |
| - gethTypes "github.com/scroll-tech/go-ethereum/core/types" |
13 | 11 | "github.com/scroll-tech/go-ethereum/ethclient"
|
14 | 12 | "github.com/scroll-tech/go-ethereum/event"
|
15 | 13 | "github.com/scroll-tech/go-ethereum/log"
|
@@ -86,43 +84,6 @@ func (w *L2WatcherClient) TryFetchRunningMissingBlocks(blockHeight uint64) {
|
86 | 84 | }
|
87 | 85 | }
|
88 | 86 |
|
89 |
| -func txsToTxsData(txs gethTypes.Transactions) []*gethTypes.TransactionData { |
90 |
| - txsData := make([]*gethTypes.TransactionData, len(txs)) |
91 |
| - for i, tx := range txs { |
92 |
| - v, r, s := tx.RawSignatureValues() |
93 |
| - |
94 |
| - nonce := tx.Nonce() |
95 |
| - |
96 |
| - // We need QueueIndex in `NewBatchHeader`. However, `TransactionData` |
97 |
| - // does not have this field. Since `L1MessageTx` do not have a nonce, |
98 |
| - // we reuse this field for storing the queue index. |
99 |
| - if msg := tx.AsL1MessageTx(); msg != nil { |
100 |
| - nonce = msg.QueueIndex |
101 |
| - } |
102 |
| - |
103 |
| - txsData[i] = &gethTypes.TransactionData{ |
104 |
| - Type: tx.Type(), |
105 |
| - TxHash: tx.Hash().String(), |
106 |
| - Nonce: nonce, |
107 |
| - ChainId: (*hexutil.Big)(tx.ChainId()), |
108 |
| - Gas: tx.Gas(), |
109 |
| - GasPrice: (*hexutil.Big)(tx.GasPrice()), |
110 |
| - GasTipCap: (*hexutil.Big)(tx.GasTipCap()), |
111 |
| - GasFeeCap: (*hexutil.Big)(tx.GasFeeCap()), |
112 |
| - To: tx.To(), |
113 |
| - Value: (*hexutil.Big)(tx.Value()), |
114 |
| - Data: hexutil.Encode(tx.Data()), |
115 |
| - IsCreate: tx.To() == nil, |
116 |
| - AccessList: tx.AccessList(), |
117 |
| - AuthorizationList: tx.SetCodeAuthorizations(), |
118 |
| - V: (*hexutil.Big)(v), |
119 |
| - R: (*hexutil.Big)(r), |
120 |
| - S: (*hexutil.Big)(s), |
121 |
| - } |
122 |
| - } |
123 |
| - return txsData |
124 |
| -} |
125 |
| - |
126 | 87 | func (w *L2WatcherClient) getAndStoreBlocks(ctx context.Context, from, to uint64) error {
|
127 | 88 | var blocks []*encoding.Block
|
128 | 89 | for number := from; number <= to; number++ {
|
@@ -150,7 +111,7 @@ func (w *L2WatcherClient) getAndStoreBlocks(ctx context.Context, from, to uint64
|
150 | 111 | }
|
151 | 112 | blocks = append(blocks, &encoding.Block{
|
152 | 113 | Header: block.Header(),
|
153 |
| - Transactions: txsToTxsData(block.Transactions()), |
| 114 | + Transactions: encoding.TxsToTxsData(block.Transactions()), |
154 | 115 | WithdrawRoot: common.BytesToHash(withdrawRoot),
|
155 | 116 | RowConsumption: block.RowConsumption,
|
156 | 117 | })
|
|
0 commit comments