Skip to content

Commit

Permalink
address AI's comments: add nil checks
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Oct 21, 2024
1 parent 3284547 commit b8de612
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rollup/da_syncer/da/commitV1.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func NewCommitBatchDAWithBlob(ctx context.Context, db ethdb.Database,
return nil, fmt.Errorf("failed to decode txs from blob: %w", err)
}

if decodedChunks == nil {
return nil, fmt.Errorf("decodedChunks is nil after decoding")
}

v0, err := NewCommitBatchDAV0WithChunks(db, version, batchIndex, parentBatchHeader, decodedChunks, skippedL1MessageBitmap, vLog.BlockNumber)
if err != nil {
return nil, err
Expand Down
3 changes: 3 additions & 0 deletions rollup/rollup_sync_service/rollup_sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ func (s *RollupSyncService) parseAndUpdateRollupEventLogs(logs []types.Log, endB
}

func (s *RollupSyncService) getLocalChunksForBatch(chunkBlockRanges []*rawdb.ChunkBlockRange) ([]*encoding.Chunk, error) {
if len(chunkBlockRanges) == 0 {
return nil, fmt.Errorf("chunkBlockRanges is empty")
}
endBlockNumber := chunkBlockRanges[len(chunkBlockRanges)-1].EndBlockNumber
for i := 0; i < defaultMaxRetries; i++ {
if s.ctx.Err() != nil {
Expand Down

0 comments on commit b8de612

Please sign in to comment.