Skip to content

Commit ce8f785

Browse files
committed
address review comments
1 parent b05954d commit ce8f785

File tree

6 files changed

+17
-54
lines changed

6 files changed

+17
-54
lines changed

rollup/da_syncer/batch_queue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,6 @@ func (bq *BatchQueue) deleteBatch(batch da.Entry) {
9898
func (bq *BatchQueue) Reset(height uint64) {
9999
bq.batches.Clear()
100100
bq.batchesMap.Clear()
101+
bq.lastFinalizedBatchIndex = 0
101102
bq.DAQueue.Reset(height)
102103
}

rollup/da_syncer/blob_client/block_native_client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ func (c *BlockNativeClient) GetBlobByVersionedHashAndBlockNumber(ctx context.Con
3030
if err != nil {
3131
return nil, fmt.Errorf("failed to join path, err: %w", err)
3232
}
33-
resp, err := http.Get(path)
33+
req, err := http.NewRequestWithContext(ctx, "GET", path, nil)
34+
if err != nil {
35+
return nil, fmt.Errorf("cannot create request, err: %w", err)
36+
}
37+
resp, err := http.DefaultClient.Do(req)
3438
if err != nil {
3539
return nil, fmt.Errorf("cannot do request, err: %w", err)
3640
}

rollup/da_syncer/da/commitV1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func NewCommitBatchDAWithBlob(ctx context.Context, db ethdb.Database,
5252
// compute blob versioned hash and compare with one from tx
5353
c, err := kzg4844.BlobToCommitment(blob)
5454
if err != nil {
55-
return nil, fmt.Errorf("failed to create blob commitment")
55+
return nil, fmt.Errorf("failed to create blob commitment: %w", err)
5656
}
5757
blobVersionedHash := common.Hash(kzg4844.CalcBlobHashV1(sha256.New(), &c))
5858
if blobVersionedHash != versionedHash {

rollup/da_syncer/da_queue.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ func NewDAQueue(l1height uint64, dataSourceFactory *DataSourceFactory) *DAQueue
2727

2828
func (dq *DAQueue) NextDA(ctx context.Context) (da.Entry, error) {
2929
for len(dq.da) == 0 {
30+
select {
31+
case <-ctx.Done():
32+
return nil, ctx.Err()
33+
default:
34+
}
35+
3036
err := dq.getNextData(ctx)
3137
if err != nil {
3238
return nil, err

rollup/da_syncer/da_syncer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ func (s *DASyncer) SyncOneBlock(block *da.PartialBlock) error {
3737
}
3838

3939
parentBlock := s.blockchain.GetBlockByNumber(currentBlock.Number().Uint64())
40+
if parentBlock == nil {
41+
return fmt.Errorf("parent block not found at height %d", currentBlock.Number().Uint64())
42+
}
43+
4044
if _, err := s.blockchain.BuildAndWriteBlock(parentBlock, block.PartialHeader.ToHeader(), block.Transactions); err != nil {
4145
return fmt.Errorf("failed building and writing block, number: %d, error: %v", block.PartialHeader.Number, err)
4246
}

rollup/da_syncer/modes.go

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)