|
6 | 6 | "errors"
|
7 | 7 | "fmt"
|
8 | 8 | "os"
|
| 9 | + "strings" |
9 | 10 | "sync"
|
10 | 11 | "time"
|
11 | 12 |
|
@@ -42,6 +43,8 @@ const (
|
42 | 43 | defaultLogInterval = 5 * time.Minute
|
43 | 44 | )
|
44 | 45 |
|
| 46 | +var ErrShouldResetSyncHeight = errors.New("ErrShouldResetSyncHeight") |
| 47 | + |
45 | 48 | // RollupSyncService collects ScrollChain batch commit/revert/finalize events and stores metadata into db.
|
46 | 49 | type RollupSyncService struct {
|
47 | 50 | ctx context.Context
|
@@ -205,6 +208,12 @@ func (s *RollupSyncService) fetchRollupEvents() error {
|
205 | 208 | }
|
206 | 209 |
|
207 | 210 | if err = s.updateRollupEvents(daEntries); err != nil {
|
| 211 | + if errors.Is(err, ErrShouldResetSyncHeight) { |
| 212 | + log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation") |
| 213 | + s.callDataBlobSource.SetL1Height(7892668) |
| 214 | + |
| 215 | + return nil |
| 216 | + } |
208 | 217 | // Reset the L1 height to the previous value to retry fetching the same data.
|
209 | 218 | s.callDataBlobSource.SetL1Height(prevL1Height)
|
210 | 219 | return fmt.Errorf("failed to parse and update rollup event logs: %w", err)
|
@@ -535,6 +544,16 @@ func validateBatch(batchIndex uint64, event *l1.FinalizeBatchEvent, parentFinali
|
535 | 544 |
|
536 | 545 | daBatch, err := codec.NewDABatch(batch)
|
537 | 546 | if err != nil {
|
| 547 | + // This is hotfix for the L1 message hash mismatch issue which lead to wrong committedBatchMeta.PostL1MessageQueueHash hashes. |
| 548 | + // These in turn lead to a wrongly computed batch hash locally. This happened after upgrading to EuclidV2 |
| 549 | + // where da-codec was not updated to the latest version in l2geth. |
| 550 | + // If the error message due to mismatching PostL1MessageQueueHash contains the same hash as the hardcoded one, |
| 551 | + // this means the node ran into this issue. |
| 552 | + // We need to reset the sync height to 1 block before the L1 block in which the last batch in CodecV6 was committed. |
| 553 | + // The node will overwrite the wrongly computed message queue hashes. |
| 554 | + if strings.Contains(err.Error(), "0xaa16faf2a1685fe1d7e0f2810b1a0e98c2841aef96596d10456a6d0f00000000") { |
| 555 | + return 0, nil, ErrShouldResetSyncHeight |
| 556 | + } |
538 | 557 | return 0, nil, fmt.Errorf("failed to create DA batch, batch index: %v, codec version: %v, err: %w", batchIndex, codecVersion, err)
|
539 | 558 | }
|
540 | 559 | localBatchHash := daBatch.Hash()
|
|
0 commit comments