From 5ba74f739b38e8bab4e8fb4e7e14d26c2f4b2fe2 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Thu, 13 Mar 2025 21:32:34 +0800 Subject: [PATCH 1/8] update da-codec to latest version --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ea4204d370ad..1c3397b960a4 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/prometheus/tsdb v0.7.1 github.com/rjeczalik/notify v0.9.1 github.com/rs/cors v1.7.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250226072559-f8a8d3898f54 + github.com/scroll-tech/da-codec v0.1.3-0.20250313120912-344f2d5e33e1 github.com/scroll-tech/zktrie v0.8.4 github.com/shirou/gopsutil v3.21.11+incompatible github.com/sourcegraph/conc v0.3.0 diff --git a/go.sum b/go.sum index 6e028c2e648c..a6c9f2ad2aa8 100644 --- a/go.sum +++ b/go.sum @@ -396,8 +396,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/da-codec v0.1.3-0.20250226072559-f8a8d3898f54 h1:qVpsVu1J91opTn6HYeuzWcBRVhQmPR8g05i+PlOjlI4= -github.com/scroll-tech/da-codec v0.1.3-0.20250226072559-f8a8d3898f54/go.mod h1:xECEHZLVzbdUn+tNbRJhRIjLGTOTmnFQuTgUTeVLX58= +github.com/scroll-tech/da-codec v0.1.3-0.20250313120912-344f2d5e33e1 h1:Dhd58LE1D+dnoxpgLVeQBMF9uweL/fhQfZHWtWSiOlE= +github.com/scroll-tech/da-codec v0.1.3-0.20250313120912-344f2d5e33e1/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY= github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE= github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= From b28554ad5d01b313e369e89293605a1f3b8c1f6a Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:06:24 +0800 Subject: [PATCH 2/8] fix nodes db --- .../rollup_sync_service/rollup_sync_service.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rollup/rollup_sync_service/rollup_sync_service.go b/rollup/rollup_sync_service/rollup_sync_service.go index c0d79d83396d..eb7101b385fc 100644 --- a/rollup/rollup_sync_service/rollup_sync_service.go +++ b/rollup/rollup_sync_service/rollup_sync_service.go @@ -42,6 +42,8 @@ const ( defaultLogInterval = 5 * time.Minute ) +var ErrShouldResetSyncHeight = errors.New("ErrShouldResetSyncHeight") + // RollupSyncService collects ScrollChain batch commit/revert/finalize events and stores metadata into db. type RollupSyncService struct { ctx context.Context @@ -205,6 +207,12 @@ func (s *RollupSyncService) fetchRollupEvents() error { } if err = s.updateRollupEvents(daEntries); err != nil { + if errors.Is(err, ErrShouldResetSyncHeight) { + log.Warn("Resetting sync height to L1 block 7892672 to fix L1 message queue hash calculation") + s.callDataBlobSource.SetL1Height(7892672) + + return nil + } // Reset the L1 height to the previous value to retry fetching the same data. s.callDataBlobSource.SetL1Height(prevL1Height) return fmt.Errorf("failed to parse and update rollup event logs: %w", err) @@ -565,6 +573,16 @@ func validateBatch(batchIndex uint64, event *l1.FinalizeBatchEvent, parentFinali // This check ensures the correctness of all batch hashes in the bundle // due to the parent-child relationship between batch hashes if localBatchHash != event.BatchHash() { + // This is hotfix for the L1 message hash mismatch issue which lead to wrong committedBatchMeta.PostL1MessageQueueHash + // hashes. These in turn lead to a wrongly computed batch hash locally. + // This happened after upgrading to EuclidV2 where da-codec was not updated in l2geth. + // If the batch hash is the same as the hardcoded one, this means the node ran into this issue. + // We need to reset the sync height to the last batch in CodecV6. The node will overwrite the wrongly computed + // message queue hashes. + if localBatchHash == common.HexToHash("0x0b671dc4155c589ffa13dd481271c7b944a778f5ce23d5100546e2b45da61ba6") { + return 0, nil, ErrShouldResetSyncHeight + } + log.Error("Batch hash mismatch", "batch index", event.BatchIndex().Uint64(), "start block", startBlock.Header.Number.Uint64(), "end block", endBlock.Header.Number.Uint64(), "parent batch hash", parentFinalizedBatchMeta.BatchHash.Hex(), "parent TotalL1MessagePopped", parentFinalizedBatchMeta.TotalL1MessagePopped, "l1 finalized batch hash", event.BatchHash().Hex(), "l2 batch hash", localBatchHash.Hex()) chunksJson, err := json.Marshal(chunks) if err != nil { From d0cbdb21c31932d6eaed14abb9bde5f84e849aad Mon Sep 17 00:00:00 2001 From: jonastheis Date: Thu, 13 Mar 2025 14:07:41 +0000 Subject: [PATCH 3/8] =?UTF-8?q?chore:=20auto=20version=20bump=E2=80=89[bot?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- params/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/params/version.go b/params/version.go index 519324c8099a..d085d9e9b840 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 8 // Minor version component of the current release - VersionPatch = 24 // Patch version component of the current release + VersionPatch = 25 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string ) From ff8af9a03b9e68c2e2139e93a9ddbc357f77192f Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:13:37 +0800 Subject: [PATCH 4/8] fix comment --- rollup/rollup_sync_service/rollup_sync_service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rollup/rollup_sync_service/rollup_sync_service.go b/rollup/rollup_sync_service/rollup_sync_service.go index eb7101b385fc..9512066b7c92 100644 --- a/rollup/rollup_sync_service/rollup_sync_service.go +++ b/rollup/rollup_sync_service/rollup_sync_service.go @@ -577,8 +577,8 @@ func validateBatch(batchIndex uint64, event *l1.FinalizeBatchEvent, parentFinali // hashes. These in turn lead to a wrongly computed batch hash locally. // This happened after upgrading to EuclidV2 where da-codec was not updated in l2geth. // If the batch hash is the same as the hardcoded one, this means the node ran into this issue. - // We need to reset the sync height to the last batch in CodecV6. The node will overwrite the wrongly computed - // message queue hashes. + // We need to reset the sync height to 1 block before the L1 block in which the last batch in CodecV6 was committed. + // The node will overwrite the wrongly computed message queue hashes. if localBatchHash == common.HexToHash("0x0b671dc4155c589ffa13dd481271c7b944a778f5ce23d5100546e2b45da61ba6") { return 0, nil, ErrShouldResetSyncHeight } From 8c9a25144273d21c3342702b8ca5c9548055cb98 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:44:02 +0800 Subject: [PATCH 5/8] fix L1 block number --- rollup/rollup_sync_service/rollup_sync_service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup/rollup_sync_service/rollup_sync_service.go b/rollup/rollup_sync_service/rollup_sync_service.go index 9512066b7c92..922b5eb62609 100644 --- a/rollup/rollup_sync_service/rollup_sync_service.go +++ b/rollup/rollup_sync_service/rollup_sync_service.go @@ -209,7 +209,7 @@ func (s *RollupSyncService) fetchRollupEvents() error { if err = s.updateRollupEvents(daEntries); err != nil { if errors.Is(err, ErrShouldResetSyncHeight) { log.Warn("Resetting sync height to L1 block 7892672 to fix L1 message queue hash calculation") - s.callDataBlobSource.SetL1Height(7892672) + s.callDataBlobSource.SetL1Height(7892668) return nil } From 5fe1ed2780e1bc4995d28b5c24739f3c7579b207 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:45:19 +0800 Subject: [PATCH 6/8] fix comment --- rollup/rollup_sync_service/rollup_sync_service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup/rollup_sync_service/rollup_sync_service.go b/rollup/rollup_sync_service/rollup_sync_service.go index 922b5eb62609..6774762afdc6 100644 --- a/rollup/rollup_sync_service/rollup_sync_service.go +++ b/rollup/rollup_sync_service/rollup_sync_service.go @@ -208,7 +208,7 @@ func (s *RollupSyncService) fetchRollupEvents() error { if err = s.updateRollupEvents(daEntries); err != nil { if errors.Is(err, ErrShouldResetSyncHeight) { - log.Warn("Resetting sync height to L1 block 7892672 to fix L1 message queue hash calculation") + log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation") s.callDataBlobSource.SetL1Height(7892668) return nil From 1b4596746b26371aaab53caaf51f51666f1f745f Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:54:33 +0800 Subject: [PATCH 7/8] fix error trigger --- .../rollup_sync_service.go | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rollup/rollup_sync_service/rollup_sync_service.go b/rollup/rollup_sync_service/rollup_sync_service.go index 6774762afdc6..a8a8862d7c5f 100644 --- a/rollup/rollup_sync_service/rollup_sync_service.go +++ b/rollup/rollup_sync_service/rollup_sync_service.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "os" + "strings" "sync" "time" @@ -543,6 +544,15 @@ func validateBatch(batchIndex uint64, event *l1.FinalizeBatchEvent, parentFinali daBatch, err := codec.NewDABatch(batch) if err != nil { + // This is hotfix for the L1 message hash mismatch issue which lead to wrong committedBatchMeta.PostL1MessageQueueHash + // hashes. These in turn lead to a wrongly computed batch hash locally. + // This happened after upgrading to EuclidV2 where da-codec was not updated in l2geth. + // If the batch hash is the same as the hardcoded one, this means the node ran into this issue. + // We need to reset the sync height to 1 block before the L1 block in which the last batch in CodecV6 was committed. + // The node will overwrite the wrongly computed message queue hashes. + if strings.Contains(err.Error(), "0xaa16faf2a1685fe1d7e0f2810b1a0e98c2841aef96596d10456a6d0f00000000") { + return 0, nil, ErrShouldResetSyncHeight + } return 0, nil, fmt.Errorf("failed to create DA batch, batch index: %v, codec version: %v, err: %w", batchIndex, codecVersion, err) } localBatchHash := daBatch.Hash() @@ -573,16 +583,6 @@ func validateBatch(batchIndex uint64, event *l1.FinalizeBatchEvent, parentFinali // This check ensures the correctness of all batch hashes in the bundle // due to the parent-child relationship between batch hashes if localBatchHash != event.BatchHash() { - // This is hotfix for the L1 message hash mismatch issue which lead to wrong committedBatchMeta.PostL1MessageQueueHash - // hashes. These in turn lead to a wrongly computed batch hash locally. - // This happened after upgrading to EuclidV2 where da-codec was not updated in l2geth. - // If the batch hash is the same as the hardcoded one, this means the node ran into this issue. - // We need to reset the sync height to 1 block before the L1 block in which the last batch in CodecV6 was committed. - // The node will overwrite the wrongly computed message queue hashes. - if localBatchHash == common.HexToHash("0x0b671dc4155c589ffa13dd481271c7b944a778f5ce23d5100546e2b45da61ba6") { - return 0, nil, ErrShouldResetSyncHeight - } - log.Error("Batch hash mismatch", "batch index", event.BatchIndex().Uint64(), "start block", startBlock.Header.Number.Uint64(), "end block", endBlock.Header.Number.Uint64(), "parent batch hash", parentFinalizedBatchMeta.BatchHash.Hex(), "parent TotalL1MessagePopped", parentFinalizedBatchMeta.TotalL1MessagePopped, "l1 finalized batch hash", event.BatchHash().Hex(), "l2 batch hash", localBatchHash.Hex()) chunksJson, err := json.Marshal(chunks) if err != nil { From 47da2fd3ecf4a7bf8913994f63a83df7d9576776 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:59:17 +0800 Subject: [PATCH 8/8] adjust comment --- rollup/rollup_sync_service/rollup_sync_service.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rollup/rollup_sync_service/rollup_sync_service.go b/rollup/rollup_sync_service/rollup_sync_service.go index a8a8862d7c5f..8b65d0f8b33e 100644 --- a/rollup/rollup_sync_service/rollup_sync_service.go +++ b/rollup/rollup_sync_service/rollup_sync_service.go @@ -544,10 +544,11 @@ func validateBatch(batchIndex uint64, event *l1.FinalizeBatchEvent, parentFinali daBatch, err := codec.NewDABatch(batch) if err != nil { - // This is hotfix for the L1 message hash mismatch issue which lead to wrong committedBatchMeta.PostL1MessageQueueHash - // hashes. These in turn lead to a wrongly computed batch hash locally. - // This happened after upgrading to EuclidV2 where da-codec was not updated in l2geth. - // If the batch hash is the same as the hardcoded one, this means the node ran into this issue. + // This is hotfix for the L1 message hash mismatch issue which lead to wrong committedBatchMeta.PostL1MessageQueueHash hashes. + // These in turn lead to a wrongly computed batch hash locally. This happened after upgrading to EuclidV2 + // where da-codec was not updated to the latest version in l2geth. + // If the error message due to mismatching PostL1MessageQueueHash contains the same hash as the hardcoded one, + // this means the node ran into this issue. // We need to reset the sync height to 1 block before the L1 block in which the last batch in CodecV6 was committed. // The node will overwrite the wrongly computed message queue hashes. if strings.Contains(err.Error(), "0xaa16faf2a1685fe1d7e0f2810b1a0e98c2841aef96596d10456a6d0f00000000") {