Skip to content

Commit bc8f9db

Browse files
authored
fix(rollup-relayer): wrong l1 messages popped num (#1550)
1 parent cc2441d commit bc8f9db

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

common/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"runtime/debug"
66
)
77

8-
var tag = "v4.4.69"
8+
var tag = "v4.4.70"
99

1010
var commit = func() string {
1111
if info, ok := debug.ReadBuildInfo(); ok {

coordinator/internal/orm/batch.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,15 @@ func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...
260260
if err != nil {
261261
log.Error("failed to create new DA batch",
262262
"index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
263-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
263+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
264264
return nil, err
265265
}
266266

267267
var startChunkIndex uint64
268268
parentBatch, err := o.GetLatestBatch(ctx)
269269
if err != nil {
270270
log.Error("failed to get latest batch", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
271-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
271+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
272272
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
273273
}
274274

@@ -282,14 +282,14 @@ func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...
282282
startDAChunk, err := codec.NewDAChunk(batch.Chunks[0], batch.TotalL1MessagePoppedBefore)
283283
if err != nil {
284284
log.Error("failed to create start DA chunk", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
285-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
285+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
286286
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
287287
}
288288

289289
startDAChunkHash, err := startDAChunk.Hash()
290290
if err != nil {
291291
log.Error("failed to get start DA chunk hash", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
292-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
292+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
293293
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
294294
}
295295

@@ -300,14 +300,14 @@ func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...
300300
endDAChunk, err := codec.NewDAChunk(batch.Chunks[numChunks-1], totalL1MessagePoppedBeforeEndDAChunk)
301301
if err != nil {
302302
log.Error("failed to create end DA chunk", "index", batch.Index, "total l1 message popped before", totalL1MessagePoppedBeforeEndDAChunk,
303-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
303+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
304304
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
305305
}
306306

307307
endDAChunkHash, err := endDAChunk.Hash()
308308
if err != nil {
309309
log.Error("failed to get end DA chunk hash", "index", batch.Index, "total l1 message popped before", totalL1MessagePoppedBeforeEndDAChunk,
310-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
310+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
311311
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
312312
}
313313

rollup/internal/orm/batch.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, codecVer
265265
parentBatch, getErr := o.GetBatchByIndex(ctx, batch.Index-1)
266266
if getErr != nil {
267267
log.Error("failed to get batch by index", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
268-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", getErr)
268+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", getErr)
269269
return nil, fmt.Errorf("Batch.InsertBatch error: %w", getErr)
270270
}
271271
startChunkIndex = parentBatch.EndChunkIndex + 1
@@ -274,14 +274,14 @@ func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, codecVer
274274
batchMeta, err := rutils.GetBatchMetadata(batch, codecVersion)
275275
if err != nil {
276276
log.Error("failed to get batch metadata", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
277-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
277+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
278278
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
279279
}
280280

281281
enableCompress, err := encoding.GetBatchEnableCompression(codecVersion, batch)
282282
if err != nil {
283283
log.Error("failed to get batch enable compress", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
284-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
284+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
285285
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
286286
}
287287

rollup/internal/utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func GetBatchMetadata(batch *encoding.Batch, codecVersion encoding.CodecVersion)
199199
return nil, fmt.Errorf("failed to get start DA chunk hash, version: %v, err: %w", codecVersion, err)
200200
}
201201

202-
var totalL1MessagePoppedBeforeEndDAChunk uint64
202+
totalL1MessagePoppedBeforeEndDAChunk := batch.TotalL1MessagePoppedBefore
203203
for i := 0; i < len(batch.Chunks)-1; i++ {
204204
totalL1MessagePoppedBeforeEndDAChunk += batch.Chunks[i].NumL1Messages(totalL1MessagePoppedBeforeEndDAChunk)
205205
}

tests/integration-test/orm/batch.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...
106106
if err != nil {
107107
log.Error("failed to create new DA batch",
108108
"index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
109-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
109+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
110110
return nil, err
111111
}
112112

113113
var startChunkIndex uint64
114114
parentBatch, err := o.GetLatestBatch(ctx)
115115
if err != nil {
116116
log.Error("failed to get latest batch", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
117-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
117+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
118118
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
119119
}
120120

@@ -128,14 +128,14 @@ func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...
128128
startDAChunk, err := codec.NewDAChunk(batch.Chunks[0], batch.TotalL1MessagePoppedBefore)
129129
if err != nil {
130130
log.Error("failed to create start DA chunk", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
131-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
131+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
132132
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
133133
}
134134

135135
startDAChunkHash, err := startDAChunk.Hash()
136136
if err != nil {
137137
log.Error("failed to get start DA chunk hash", "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore,
138-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
138+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
139139
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
140140
}
141141

@@ -146,14 +146,14 @@ func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...
146146
endDAChunk, err := codec.NewDAChunk(batch.Chunks[numChunks-1], totalL1MessagePoppedBeforeEndDAChunk)
147147
if err != nil {
148148
log.Error("failed to create end DA chunk", "index", batch.Index, "total l1 message popped before", totalL1MessagePoppedBeforeEndDAChunk,
149-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
149+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
150150
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
151151
}
152152

153153
endDAChunkHash, err := endDAChunk.Hash()
154154
if err != nil {
155155
log.Error("failed to get end DA chunk hash", "index", batch.Index, "total l1 message popped before", totalL1MessagePoppedBeforeEndDAChunk,
156-
"parent hash", batch.ParentBatchHash, "number of chunks", numChunks, "err", err)
156+
"parent hash", batch.ParentBatchHash.Hex(), "number of chunks", numChunks, "err", err)
157157
return nil, fmt.Errorf("Batch.InsertBatch error: %w", err)
158158
}
159159

0 commit comments

Comments
 (0)