4
4
"encoding/binary"
5
5
"fmt"
6
6
"io"
7
- "math/big"
8
7
9
8
"github.com/scroll-tech/da-codec/encoding"
10
9
"github.com/scroll-tech/da-codec/encoding/codecv0"
@@ -84,20 +83,13 @@ func (c *CommitBatchDAV0) BatchIndex() uint64 {
84
83
return c .batchIndex
85
84
}
86
85
87
- func (c * CommitBatchDAV0 ) Blocks () ([]* types. Block , error ) {
88
- var blocks []* types. Block
86
+ func (c * CommitBatchDAV0 ) Blocks () ([]* PartialBlock , error ) {
87
+ var blocks []* PartialBlock
89
88
l1TxPointer := 0
90
89
91
90
curL1TxIndex := c .parentTotalL1MessagePopped
92
91
for _ , chunk := range c .chunks {
93
92
for blockId , daBlock := range chunk .Blocks {
94
- // create header
95
- header := types.Header {
96
- Number : big .NewInt (0 ).SetUint64 (daBlock .BlockNumber ),
97
- Time : daBlock .Timestamp ,
98
- BaseFee : daBlock .BaseFee ,
99
- GasLimit : daBlock .GasLimit ,
100
- }
101
93
// create txs
102
94
// var txs types.Transactions
103
95
txs := make (types.Transactions , 0 , daBlock .NumTransactions )
@@ -110,7 +102,17 @@ func (c *CommitBatchDAV0) Blocks() ([]*types.Block, error) {
110
102
curL1TxIndex += uint64 (daBlock .NumL1Messages )
111
103
// insert l2 txs
112
104
txs = append (txs , chunk .Transactions [blockId ]... )
113
- block := types .NewBlockWithHeader (& header ).WithBody (txs , make ([]* types.Header , 0 ))
105
+
106
+ block := NewPartialBlock (
107
+ & PartialHeader {
108
+ Number : daBlock .BlockNumber ,
109
+ Time : daBlock .Timestamp ,
110
+ BaseFee : daBlock .BaseFee ,
111
+ GasLimit : daBlock .GasLimit ,
112
+ //TODO: Difficulty: new(big.Int).SetUint64(10),
113
+ //TODO: ExtraData: []byte{1, 2, 3, 4, 5, 6, 7, 8},
114
+ },
115
+ txs )
114
116
blocks = append (blocks , block )
115
117
}
116
118
}
0 commit comments