@@ -6,14 +6,12 @@ import (
6
6
"fmt"
7
7
8
8
"github.com/scroll-tech/da-codec/encoding"
9
+
9
10
"github.com/scroll-tech/go-ethereum/accounts/abi"
10
11
"github.com/scroll-tech/go-ethereum/common"
11
- "github.com/scroll-tech/go-ethereum/core/types"
12
12
"github.com/scroll-tech/go-ethereum/ethdb"
13
- "github.com/scroll-tech/go-ethereum/log"
14
13
"github.com/scroll-tech/go-ethereum/rollup/da_syncer/blob_client"
15
14
"github.com/scroll-tech/go-ethereum/rollup/da_syncer/serrors"
16
- "github.com/scroll-tech/go-ethereum/rollup/rollup_sync_service"
17
15
"github.com/scroll-tech/go-ethereum/rollup/l1"
18
16
)
19
17
35
33
36
34
type CalldataBlobSource struct {
37
35
ctx context.Context
38
- l1Reader * l1.Reader
36
+ l1Reader * l1.Reader
39
37
blobClient blob_client.BlobClient
40
38
l1height uint64
41
39
scrollChainABI * abi.ABI
@@ -54,7 +52,7 @@ func NewCalldataBlobSource(ctx context.Context, l1height uint64, l1Reader *l1.Re
54
52
}
55
53
return & CalldataBlobSource {
56
54
ctx : ctx ,
57
- l1Reader : l1Reader ,
55
+ l1Reader : l1Reader ,
58
56
blobClient : blobClient ,
59
57
l1height : l1height ,
60
58
scrollChainABI : scrollChainABI ,
@@ -89,7 +87,7 @@ func (ds *CalldataBlobSource) NextData() (Entries, error) {
89
87
if err != nil {
90
88
return nil , serrors .NewTemporaryError (fmt .Errorf ("cannot get rollup events, l1height: %d, error: %v" , ds .l1height , err ))
91
89
}
92
- da , err := ds .processLogsToDA ( logs )
90
+ da , err := ds .processRollupEventsToDA ( rollupEvents )
93
91
if err != nil {
94
92
return nil , serrors .NewTemporaryError (fmt .Errorf ("failed to process rollup events to DA, error: %v" , err ))
95
93
}
@@ -175,7 +173,7 @@ func (ds *CalldataBlobSource) getCommitBatchDA(batchIndex uint64, commitEvent *l
175
173
176
174
txData , err := ds .l1Reader .FetchTxData (commitEvent .TxHash (), commitEvent .BlockHash ())
177
175
if err != nil {
178
- return nil , fmt .Errorf ("failed to fetch tx data, tx hash: %v, err: %w" , vLog .TxHash .Hex (), err )
176
+ return nil , fmt .Errorf ("failed to fetch tx data, tx hash: %v, err: %w" , commitEvent .TxHash () .Hex (), err )
179
177
}
180
178
if len (txData ) < methodIDLength {
181
179
return nil , fmt .Errorf ("transaction data is too short, length of tx data: %v, minimum length required: %v" , len (txData ), methodIDLength )
@@ -202,9 +200,9 @@ func (ds *CalldataBlobSource) getCommitBatchDA(batchIndex uint64, commitEvent *l
202
200
}
203
201
switch args .Version {
204
202
case 0 :
205
- return NewCommitBatchDAV0 (ds .db , codec , args .Version , batchIndex , args .ParentBatchHeader , args .Chunks , args .SkippedL1MessageBitmap , vLog .BlockNumber )
203
+ return NewCommitBatchDAV0 (ds .db , codec , args .Version , batchIndex , args .ParentBatchHeader , args .Chunks , args .SkippedL1MessageBitmap , commitEvent .BlockNumber () )
206
204
case 1 , 2 :
207
- return NewCommitBatchDAWithBlob (ds .ctx , ds .db , codec , ds .l1Client , ds .blobClient , vLog , args .Version , batchIndex , args .ParentBatchHeader , args .Chunks , args .SkippedL1MessageBitmap )
205
+ return NewCommitBatchDAWithBlob (ds .ctx , ds .db , codec , ds .l1Reader , ds .blobClient , commitEvent , args .Version , batchIndex , args .ParentBatchHeader , args .Chunks , args .SkippedL1MessageBitmap )
208
206
default :
209
207
return nil , fmt .Errorf ("failed to decode DA, codec version is unknown: codec version: %d" , args .Version )
210
208
}
@@ -220,7 +218,7 @@ func (ds *CalldataBlobSource) getCommitBatchDA(batchIndex uint64, commitEvent *l
220
218
}
221
219
switch args .Version {
222
220
case 3 , 4 :
223
- return NewCommitBatchDAWithBlob (ds .ctx , ds .db , codec , ds .l1Client , ds .blobClient , vLog , args .Version , batchIndex , args .ParentBatchHeader , args .Chunks , args .SkippedL1MessageBitmap )
221
+ return NewCommitBatchDAWithBlob (ds .ctx , ds .db , codec , ds .l1Reader , ds .blobClient , commitEvent , args .Version , batchIndex , args .ParentBatchHeader , args .Chunks , args .SkippedL1MessageBitmap )
224
222
default :
225
223
return nil , fmt .Errorf ("failed to decode DA, codec version is unknown: codec version: %d" , args .Version )
226
224
}
0 commit comments