Skip to content

Commit c4c2718

Browse files
authored
Merge branch 'develop' into refactor-simplify-coordinator
2 parents e36d4d7 + 0d8b00c commit c4c2718

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
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.5.8"
8+
var tag = "v4.5.10"
99

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

rollup/internal/controller/relayer/l1_relayer.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,11 @@ func (r *Layer1Relayer) shouldUpdateGasOracle(baseFee uint64, blobBaseFee uint64
251251
return true
252252
}
253253

254-
expectedBaseFeeDelta := r.lastBaseFee*r.gasPriceDiff/gasPriceDiffPrecision + 1
254+
expectedBaseFeeDelta := r.lastBaseFee * r.gasPriceDiff / gasPriceDiffPrecision
255+
// Allowing a minimum of 0 wei if the gas price diff config is 0, this will be used to let the gas oracle send transactions continuously.
256+
if r.gasPriceDiff > 0 {
257+
expectedBaseFeeDelta += 1
258+
}
255259
if baseFee >= r.minGasPrice && math.Abs(float64(baseFee)-float64(r.lastBaseFee)) >= float64(expectedBaseFeeDelta) {
256260
return true
257261
}
@@ -279,5 +283,7 @@ func (r *Layer1Relayer) commitBatchReachTimeout() (bool, error) {
279283
}
280284
// len(batches) == 0 probably shouldn't ever happen, but need to check this
281285
// Also, we should check if it's a genesis batch. If so, skip the timeout check.
282-
return len(batches) == 0 || (batches[0].Index != 0 && utils.NowUTC().Sub(*batches[0].CommittedAt) > time.Duration(r.cfg.GasOracleConfig.CheckCommittedBatchesWindowMinutes)*time.Minute), nil
286+
// If finalizing/finalized status is updated before committed status, skip the timeout check of this round.
287+
// Because batches[0].CommittedAt is nil in this case, this will only continue for a short time window.
288+
return len(batches) == 0 || (batches[0].Index != 0 && batches[0].CommittedAt != nil && utils.NowUTC().Sub(*batches[0].CommittedAt) > time.Duration(r.cfg.GasOracleConfig.CheckCommittedBatchesWindowMinutes)*time.Minute), nil
283289
}

rollup/internal/orm/batch.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,12 @@ func (o *Batch) UpdateRollupStatus(ctx context.Context, hash string, status type
386386
func (o *Batch) UpdateCommitTxHashAndRollupStatus(ctx context.Context, hash string, commitTxHash string, status types.RollupStatus, dbTX ...*gorm.DB) error {
387387
updateFields := make(map[string]interface{})
388388
updateFields["commit_tx_hash"] = commitTxHash
389-
updateFields["rollup_status"] = int(status)
389+
updateFields["rollup_status"] = gorm.Expr(
390+
`CASE
391+
WHEN rollup_status NOT IN (?, ?) THEN ?
392+
ELSE rollup_status
393+
END`,
394+
types.RollupFinalizing, types.RollupFinalized, int(status))
390395
if status == types.RollupCommitted {
391396
updateFields["committed_at"] = utils.NowUTC()
392397
}
@@ -397,15 +402,6 @@ func (o *Batch) UpdateCommitTxHashAndRollupStatus(ctx context.Context, hash stri
397402
}
398403
db = db.WithContext(ctx)
399404

400-
var currentBatch Batch
401-
if err := db.Where("hash", hash).First(&currentBatch).Error; err != nil {
402-
return fmt.Errorf("Batch.UpdateCommitTxHashAndRollupStatus error when querying current status: %w, batch hash: %v", err, hash)
403-
}
404-
405-
if types.RollupStatus(currentBatch.RollupStatus) == types.RollupFinalizing || types.RollupStatus(currentBatch.RollupStatus) == types.RollupFinalized {
406-
return nil
407-
}
408-
409405
db = db.Model(&Batch{})
410406
db = db.Where("hash", hash)
411407

rollup/internal/orm/orm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func TestBatchOrm(t *testing.T) {
314314
updatedBatch, err = batchOrm.GetLatestBatch(context.Background())
315315
assert.NoError(t, err)
316316
assert.NotNil(t, updatedBatch)
317-
assert.Equal(t, "", updatedBatch.CommitTxHash)
317+
assert.Equal(t, "commitTxHash", updatedBatch.CommitTxHash)
318318
assert.Equal(t, types.RollupFinalized, types.RollupStatus(updatedBatch.RollupStatus))
319319

320320
err = batchOrm.UpdateFinalizeTxHashAndRollupStatus(context.Background(), batchHash2, "finalizeTxHash", types.RollupFinalizeFailed)

0 commit comments

Comments
 (0)