Skip to content

Commit 60a2280

Browse files
author
colinlyguo
committed
address AI's comments
1 parent 377e8bb commit 60a2280

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

rollup/internal/controller/relayer/l2_relayer.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -524,23 +524,17 @@ func (r *Layer2Relayer) ProcessPendingBatches() {
524524
}
525525

526526
func (r *Layer2Relayer) contextIDFromBatches(codecVersion encoding.CodecVersion, batches []*dbBatchWithChunksAndParent) string {
527-
var prefix string
528-
if codecVersion == encoding.CodecV7 {
529-
prefix = "v7"
530-
} else {
531-
prefix = "v8"
532-
}
533-
534-
contextIDs := []string{prefix}
527+
contextIDs := []string{fmt.Sprintf("v%d", codecVersion)}
535528
for _, batch := range batches {
536529
contextIDs = append(contextIDs, batch.Batch.Hash)
537530
}
538531
return strings.Join(contextIDs, "-")
539532
}
540533

541534
func (r *Layer2Relayer) batchHashesFromContextID(contextID string) []string {
542-
if strings.HasPrefix(contextID, "v7-") || strings.HasPrefix(contextID, "v8-") {
543-
return strings.Split(contextID, "-")[1:]
535+
parts := strings.SplitN(contextID, "-", 2)
536+
if len(parts) == 2 && strings.HasPrefix(parts[0], "v") {
537+
return strings.Split(parts[1], "-")
544538
}
545539
return []string{contextID}
546540
}

0 commit comments

Comments
 (0)