From 377e8bb9f15cef8166702dbdc155b3e00ec4affe Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Mon, 9 Jun 2025 14:51:27 +0800 Subject: [PATCH 1/8] feat(rollup-relayer): support codecv8 --- bridge-history-api/go.mod | 6 +++--- bridge-history-api/go.sum | 8 ++++---- common/version/version.go | 2 +- coordinator/go.mod | 4 ++-- coordinator/go.sum | 8 ++++---- .../logic/provertask/batch_prover_task.go | 2 +- go.work.sum | 6 ++++++ rollup/docker-compose-proposer-tool.yml | 2 +- rollup/go.mod | 4 ++-- rollup/go.sum | 8 ++++---- .../internal/controller/relayer/l2_relayer.go | 20 +++++++++++-------- rollup/proposer-tool-config.json | 4 ++-- rollup/proposer-tool-genesis.json | 3 ++- 13 files changed, 44 insertions(+), 33 deletions(-) diff --git a/bridge-history-api/go.mod b/bridge-history-api/go.mod index 6228dec68e..e8ee455228 100644 --- a/bridge-history-api/go.mod +++ b/bridge-history-api/go.mod @@ -10,15 +10,15 @@ require ( github.com/go-redis/redis/v8 v8.11.5 github.com/pressly/goose/v3 v3.16.0 github.com/prometheus/client_golang v1.19.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250226072559-f8a8d3898f54 - github.com/scroll-tech/go-ethereum v1.10.14-0.20250305084331-57148478e950 + github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd + github.com/scroll-tech/go-ethereum v1.10.14-0.20250616074821-cba908db071d github.com/stretchr/testify v1.9.0 github.com/urfave/cli/v2 v2.25.7 golang.org/x/sync v0.11.0 gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde ) -replace github.com/scroll-tech/go-ethereum => github.com/scroll-tech/go-ethereum v1.10.14-0.20250305084331-57148478e950 // It's a hotfix for the header hash incompatibility issue, pls change this with caution +replace github.com/scroll-tech/go-ethereum => github.com/scroll-tech/go-ethereum v1.10.14-0.20250616074821-cba908db071d // It's a hotfix for the header hash incompatibility issue, pls change this with caution require ( dario.cat/mergo v1.0.0 // indirect diff --git a/bridge-history-api/go.sum b/bridge-history-api/go.sum index 11155638f5..56ccde086c 100644 --- a/bridge-history-api/go.sum +++ b/bridge-history-api/go.sum @@ -309,10 +309,10 @@ 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.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/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/go-ethereum v1.10.14-0.20250305084331-57148478e950 h1:qfOaRflvH1vtnFWloB7BveKlP/VqYgMqLJ6e9TlBJ/8= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250305084331-57148478e950/go.mod h1:OblWe1+QrZwdpwO0j/LY3BSGuKT3YPUFBDQQgvvfStQ= +github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd h1:VKVDPtKJZIaQNQvhXptVhS7O9GLKl1314egD1fln8SA= +github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250616074821-cba908db071d h1:JoEtZN6aCV5MUBjacsrPd2S6fl8sDGZE9Xd4UUhg5Oo= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250616074821-cba908db071d/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= 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/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= diff --git a/common/version/version.go b/common/version/version.go index 3ab70685f6..1061e5cd0c 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -5,7 +5,7 @@ import ( "runtime/debug" ) -var tag = "v4.5.23" +var tag = "v4.5.24" var commit = func() string { if info, ok := debug.ReadBuildInfo(); ok { diff --git a/coordinator/go.mod b/coordinator/go.mod index d99242556e..3f0cd39cb0 100644 --- a/coordinator/go.mod +++ b/coordinator/go.mod @@ -9,8 +9,8 @@ require ( github.com/google/uuid v1.6.0 github.com/mitchellh/mapstructure v1.5.0 github.com/prometheus/client_golang v1.19.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250401062930-9f9f53898493 - github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601 + github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd + github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 github.com/shopspring/decimal v1.3.1 github.com/stretchr/testify v1.10.0 github.com/urfave/cli/v2 v2.25.7 diff --git a/coordinator/go.sum b/coordinator/go.sum index a4777cd1b1..84073192f4 100644 --- a/coordinator/go.sum +++ b/coordinator/go.sum @@ -177,10 +177,10 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/da-codec v0.1.3-0.20250401062930-9f9f53898493 h1:Ioc01J0WEMxuwFvEPGJeBKXdf2KY4Yc3XbFky/IxLlI= -github.com/scroll-tech/da-codec v0.1.3-0.20250401062930-9f9f53898493/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601 h1:NEsjCG6uSvLRBlsP3+x6PL1kM+Ojs3g8UGotIPgJSz8= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601/go.mod h1:OblWe1+QrZwdpwO0j/LY3BSGuKT3YPUFBDQQgvvfStQ= +github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd h1:VKVDPtKJZIaQNQvhXptVhS7O9GLKl1314egD1fln8SA= +github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 h1:rC6eEsAwSG1VzNT48fLM00rqwTGWPckiipmFC8D6D5o= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= 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/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= diff --git a/coordinator/internal/logic/provertask/batch_prover_task.go b/coordinator/internal/logic/provertask/batch_prover_task.go index b598f3bc39..5893a3bdfe 100644 --- a/coordinator/internal/logic/provertask/batch_prover_task.go +++ b/coordinator/internal/logic/provertask/batch_prover_task.go @@ -266,7 +266,7 @@ func (bp *BatchProverTask) getBatchTaskDetail(dbBatch *orm.Batch, chunkInfos []* dbBatchCodecVersion := encoding.CodecVersion(dbBatch.CodecVersion) switch dbBatchCodecVersion { - case encoding.CodecV3, encoding.CodecV4, encoding.CodecV6, encoding.CodecV7: + case encoding.CodecV3, encoding.CodecV4, encoding.CodecV6, encoding.CodecV7, encoding.CodecV8: default: return taskDetail, nil } diff --git a/go.work.sum b/go.work.sum index c09efd6876..ab1270b0e0 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1403,8 +1403,14 @@ github.com/scroll-tech/da-codec v0.1.1-0.20241005172014-aca0bef21638 h1:2KIfClLB github.com/scroll-tech/da-codec v0.1.1-0.20241005172014-aca0bef21638/go.mod h1:6jxEQvNc7GQKMSUi25PthAUY3WnZL8CN0yWivBgAXi0= github.com/scroll-tech/da-codec v0.1.1-0.20241014152913-2703f226fb0b h1:5H6V6ybacXFJ2ti+eFwtf+12Otufod6goxK6/u7Nu1k= github.com/scroll-tech/da-codec v0.1.1-0.20241014152913-2703f226fb0b/go.mod h1:48uxaqVgpD8ulH8p+nrBtfeLHZ9tX82bVVdPNkW3rPE= +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.20250227072756-a1482833595f h1:YYbhuUwjowqI4oyXtECRofck7Fyj18e1tcRjuQlZpJE= github.com/scroll-tech/da-codec v0.1.3-0.20250227072756-a1482833595f/go.mod h1:xECEHZLVzbdUn+tNbRJhRIjLGTOTmnFQuTgUTeVLX58= +github.com/scroll-tech/da-codec v0.1.3-0.20250313120912-344f2d5e33e1/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY= +github.com/scroll-tech/da-codec v0.1.3-0.20250609113414-f33adf0904bd h1:NUol+dPtZ8LzLYrP7CPq9tRI0jAhxFxrYNmKYrTQgKE= +github.com/scroll-tech/da-codec v0.1.3-0.20250609113414-f33adf0904bd/go.mod h1:gz5x3CsLy5htNTbv4PWRPBU9nSAujfx1U2XtFcXoFuk= +github.com/scroll-tech/da-codec v0.1.3-0.20250609154559-8935de62c148 h1:cyK1ifU2fRoMl8YWR9LOsZK4RvJnlG3RODgakj5I8VY= +github.com/scroll-tech/da-codec v0.1.3-0.20250609154559-8935de62c148/go.mod h1:gz5x3CsLy5htNTbv4PWRPBU9nSAujfx1U2XtFcXoFuk= github.com/scroll-tech/go-ethereum v1.10.14-0.20240607130425-e2becce6a1a4/go.mod h1:byf/mZ8jLYUCnUePTicjJWn+RvKdxDn7buS6glTnMwQ= github.com/scroll-tech/go-ethereum v1.10.14-0.20240821074444-b3fa00861e5e/go.mod h1:swB5NSp8pKNDuYsTxfR08bHS6L56i119PBx8fxvV8Cs= github.com/scroll-tech/go-ethereum v1.10.14-0.20241010064814-3d88e870ae22/go.mod h1:r9FwtxCtybMkTbWYCyBuevT9TW3zHmOTHqD082Uh+Oo= diff --git a/rollup/docker-compose-proposer-tool.yml b/rollup/docker-compose-proposer-tool.yml index f54974b591..159a8c76c5 100644 --- a/rollup/docker-compose-proposer-tool.yml +++ b/rollup/docker-compose-proposer-tool.yml @@ -28,7 +28,7 @@ services: "--config", "/app/conf/proposer-tool-config.json", "--genesis", "/app/conf/proposer-tool-genesis.json", "--min-codec-version", "7", - "--start-l2-block", "10000", + "--start-l2-block", "14907015", "--log.debug", "--verbosity", "3" ] volumes: diff --git a/rollup/go.mod b/rollup/go.mod index 5389819115..2671bed4c1 100644 --- a/rollup/go.mod +++ b/rollup/go.mod @@ -15,8 +15,8 @@ require ( github.com/holiman/uint256 v1.3.2 github.com/mitchellh/mapstructure v1.5.0 github.com/prometheus/client_golang v1.16.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250519114140-bfa7133d4ad1 - github.com/scroll-tech/go-ethereum v1.10.14-0.20250610090337-00c5c2bd3e65 + github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd + github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 github.com/smartystreets/goconvey v1.8.0 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 diff --git a/rollup/go.sum b/rollup/go.sum index a8e302dee7..d58d5e0948 100644 --- a/rollup/go.sum +++ b/rollup/go.sum @@ -285,10 +285,10 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/scroll-tech/da-codec v0.1.3-0.20250519114140-bfa7133d4ad1 h1:6aKqJSal+QVdB5HMWMs0JTbAIZ6/iAHJx9qizz0w9dU= -github.com/scroll-tech/da-codec v0.1.3-0.20250519114140-bfa7133d4ad1/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250610090337-00c5c2bd3e65 h1:idsnkl5rwVr7eNUB0HxdkKI0L3zbTm8XSGwMTB5ndws= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250610090337-00c5c2bd3e65/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= +github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd h1:VKVDPtKJZIaQNQvhXptVhS7O9GLKl1314egD1fln8SA= +github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 h1:rC6eEsAwSG1VzNT48fLM00rqwTGWPckiipmFC8D6D5o= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= 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/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= diff --git a/rollup/internal/controller/relayer/l2_relayer.go b/rollup/internal/controller/relayer/l2_relayer.go index 470b8e5d05..240cae5130 100644 --- a/rollup/internal/controller/relayer/l2_relayer.go +++ b/rollup/internal/controller/relayer/l2_relayer.go @@ -466,7 +466,7 @@ func (r *Layer2Relayer) ProcessPendingBatches() { codecVersion := encoding.CodecVersion(firstBatch.CodecVersion) switch codecVersion { - case encoding.CodecV7: + case encoding.CodecV7, encoding.CodecV8: calldata, blobs, maxBlockHeight, totalGasUsed, err = r.constructCommitBatchPayloadCodecV7(batchesToSubmit, firstBatch, lastBatch) if err != nil { log.Error("failed to construct constructCommitBatchPayloadCodecV7 payload for V7", "codecVersion", codecVersion, "start index", firstBatch.Index, "end index", lastBatch.Index, "err", err) @@ -477,7 +477,7 @@ func (r *Layer2Relayer) ProcessPendingBatches() { return } - txHash, blobBaseFee, err := r.commitSender.SendTransaction(r.contextIDFromBatches(batchesToSubmit), &r.cfg.RollupContractAddress, calldata, blobs) + txHash, blobBaseFee, err := r.commitSender.SendTransaction(r.contextIDFromBatches(codecVersion, batchesToSubmit), &r.cfg.RollupContractAddress, calldata, blobs) if err != nil { if errors.Is(err, sender.ErrTooManyPendingBlobTxs) { r.metrics.rollupL2RelayerProcessPendingBatchErrTooManyPendingBlobTxsTotal.Inc() @@ -523,21 +523,25 @@ func (r *Layer2Relayer) ProcessPendingBatches() { log.Info("Sent the commitBatches tx to layer1", "batches count", len(batchesToSubmit), "start index", firstBatch.Index, "start hash", firstBatch.Hash, "end index", lastBatch.Index, "end hash", lastBatch.Hash, "tx hash", txHash.String()) } -func (r *Layer2Relayer) contextIDFromBatches(batches []*dbBatchWithChunksAndParent) string { - contextIDs := []string{"v7"} +func (r *Layer2Relayer) contextIDFromBatches(codecVersion encoding.CodecVersion, batches []*dbBatchWithChunksAndParent) string { + var prefix string + if codecVersion == encoding.CodecV7 { + prefix = "v7" + } else { + prefix = "v8" + } + contextIDs := []string{prefix} for _, batch := range batches { contextIDs = append(contextIDs, batch.Batch.Hash) } - return strings.Join(contextIDs, "-") } func (r *Layer2Relayer) batchHashesFromContextID(contextID string) []string { - if strings.HasPrefix(contextID, "v7-") { + if strings.HasPrefix(contextID, "v7-") || strings.HasPrefix(contextID, "v8-") { return strings.Split(contextID, "-")[1:] } - return []string{contextID} } @@ -693,7 +697,7 @@ func (r *Layer2Relayer) finalizeBundle(bundle *orm.Bundle, withProof bool) error var calldata []byte switch encoding.CodecVersion(bundle.CodecVersion) { - case encoding.CodecV7: + case encoding.CodecV7, encoding.CodecV8: calldata, err = r.constructFinalizeBundlePayloadCodecV7(dbBatch, endChunk, aggProof) if err != nil { return fmt.Errorf("failed to construct finalizeBundle payload codecv7, bundle index: %v, last batch index: %v, err: %w", bundle.Index, dbBatch.Index, err) diff --git a/rollup/proposer-tool-config.json b/rollup/proposer-tool-config.json index 42946a893a..6b7e6018ec 100644 --- a/rollup/proposer-tool-config.json +++ b/rollup/proposer-tool-config.json @@ -2,8 +2,8 @@ "l2_config": { "endpoint": "https://rpc.scroll.io", "chunk_proposer_config": { - "max_block_num_per_chunk": 100, - "max_l2_gas_per_chunk": 20000000, + "max_block_num_per_chunk": 1000, + "max_l2_gas_per_chunk": 200000000000, "chunk_timeout_sec": 72000000000 }, "batch_proposer_config": { diff --git a/rollup/proposer-tool-genesis.json b/rollup/proposer-tool-genesis.json index 34aa53082c..4c2f2dc50d 100644 --- a/rollup/proposer-tool-genesis.json +++ b/rollup/proposer-tool-genesis.json @@ -6,7 +6,8 @@ "darwinTime": 0, "darwinV2Time": 0, "euclidTime": 0, - "euclidV2Time": 0 + "euclidV2Time": 0, + "feynmanTime": 0 }, "nonce": "0x0000000000000033", "timestamp": "0x0", From 60a22801c2dc0cdad3c9e18e13c1df95c3afc32a Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Mon, 16 Jun 2025 18:39:24 +0800 Subject: [PATCH 2/8] address AI's comments --- rollup/internal/controller/relayer/l2_relayer.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/rollup/internal/controller/relayer/l2_relayer.go b/rollup/internal/controller/relayer/l2_relayer.go index 240cae5130..84b61cf3c6 100644 --- a/rollup/internal/controller/relayer/l2_relayer.go +++ b/rollup/internal/controller/relayer/l2_relayer.go @@ -524,14 +524,7 @@ func (r *Layer2Relayer) ProcessPendingBatches() { } func (r *Layer2Relayer) contextIDFromBatches(codecVersion encoding.CodecVersion, batches []*dbBatchWithChunksAndParent) string { - var prefix string - if codecVersion == encoding.CodecV7 { - prefix = "v7" - } else { - prefix = "v8" - } - - contextIDs := []string{prefix} + contextIDs := []string{fmt.Sprintf("v%d", codecVersion)} for _, batch := range batches { contextIDs = append(contextIDs, batch.Batch.Hash) } @@ -539,8 +532,9 @@ func (r *Layer2Relayer) contextIDFromBatches(codecVersion encoding.CodecVersion, } func (r *Layer2Relayer) batchHashesFromContextID(contextID string) []string { - if strings.HasPrefix(contextID, "v7-") || strings.HasPrefix(contextID, "v8-") { - return strings.Split(contextID, "-")[1:] + parts := strings.SplitN(contextID, "-", 2) + if len(parts) == 2 && strings.HasPrefix(parts[0], "v") { + return strings.Split(parts[1], "-") } return []string{contextID} } From d274123c84bd57502028ebeabeff81d97723bb34 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Wed, 18 Jun 2025 23:05:00 +0800 Subject: [PATCH 3/8] revert proposer tool config changes --- rollup/docker-compose-proposer-tool.yml | 2 +- rollup/internal/controller/relayer/l2_relayer.go | 2 +- rollup/proposer-tool-config.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rollup/docker-compose-proposer-tool.yml b/rollup/docker-compose-proposer-tool.yml index 159a8c76c5..f54974b591 100644 --- a/rollup/docker-compose-proposer-tool.yml +++ b/rollup/docker-compose-proposer-tool.yml @@ -28,7 +28,7 @@ services: "--config", "/app/conf/proposer-tool-config.json", "--genesis", "/app/conf/proposer-tool-genesis.json", "--min-codec-version", "7", - "--start-l2-block", "14907015", + "--start-l2-block", "10000", "--log.debug", "--verbosity", "3" ] volumes: diff --git a/rollup/internal/controller/relayer/l2_relayer.go b/rollup/internal/controller/relayer/l2_relayer.go index 22201c4013..cf5f267663 100644 --- a/rollup/internal/controller/relayer/l2_relayer.go +++ b/rollup/internal/controller/relayer/l2_relayer.go @@ -522,7 +522,7 @@ func (r *Layer2Relayer) ProcessPendingBatches() { log.Info("Sent the commitBatches tx to layer1", "batches count", len(batchesToSubmit), "start index", firstBatch.Index, "start hash", firstBatch.Hash, "end index", lastBatch.Index, "end hash", lastBatch.Hash, "tx hash", txHash.String()) } -func (r *Layer2Relayer) contextIDFromBatches(codecVersion encoding.CodecVersion, batches []*dbBatchWithChunksAndParent) string { +func (r *Layer2Relayer) contextIDFromBatches(codecVersion encoding.CodecVersion, batches []*dbBatchWithChunks) string { contextIDs := []string{fmt.Sprintf("v%d", codecVersion)} for _, batch := range batches { contextIDs = append(contextIDs, batch.Batch.Hash) diff --git a/rollup/proposer-tool-config.json b/rollup/proposer-tool-config.json index 6b7e6018ec..42946a893a 100644 --- a/rollup/proposer-tool-config.json +++ b/rollup/proposer-tool-config.json @@ -2,8 +2,8 @@ "l2_config": { "endpoint": "https://rpc.scroll.io", "chunk_proposer_config": { - "max_block_num_per_chunk": 1000, - "max_l2_gas_per_chunk": 200000000000, + "max_block_num_per_chunk": 100, + "max_l2_gas_per_chunk": 20000000, "chunk_timeout_sec": 72000000000 }, "batch_proposer_config": { From 024405f59d597da4142b6a524dd4c90ddba1ce39 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Mon, 23 Jun 2025 06:18:16 +0800 Subject: [PATCH 4/8] update da-codec commit --- rollup/go.mod | 2 +- rollup/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rollup/go.mod b/rollup/go.mod index 2671bed4c1..f6e36b1314 100644 --- a/rollup/go.mod +++ b/rollup/go.mod @@ -15,7 +15,7 @@ require ( github.com/holiman/uint256 v1.3.2 github.com/mitchellh/mapstructure v1.5.0 github.com/prometheus/client_golang v1.16.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd + github.com/scroll-tech/da-codec v0.1.3-0.20250622220508-c89e7e5e42f9 github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 github.com/smartystreets/goconvey v1.8.0 github.com/spf13/viper v1.19.0 diff --git a/rollup/go.sum b/rollup/go.sum index d58d5e0948..599ba42b22 100644 --- a/rollup/go.sum +++ b/rollup/go.sum @@ -285,8 +285,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd h1:VKVDPtKJZIaQNQvhXptVhS7O9GLKl1314egD1fln8SA= -github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= +github.com/scroll-tech/da-codec v0.1.3-0.20250622220508-c89e7e5e42f9 h1:0TsRwqi159i8nMG0O6kgP7q8fF1/eygWTSrT1z5jiO8= +github.com/scroll-tech/da-codec v0.1.3-0.20250622220508-c89e7e5e42f9/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 h1:rC6eEsAwSG1VzNT48fLM00rqwTGWPckiipmFC8D6D5o= github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE= From aa4e5db49d287330eca43b7313c35da048128dab Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Sun, 22 Jun 2025 22:24:20 +0000 Subject: [PATCH 5/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 --- common/version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/version/version.go b/common/version/version.go index 1061e5cd0c..10f0185f78 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -5,7 +5,7 @@ import ( "runtime/debug" ) -var tag = "v4.5.24" +var tag = "v4.5.25" var commit = func() string { if info, ok := debug.ReadBuildInfo(); ok { From c3eafe5168724016939864f5e1c68ed4b0c2ff2e Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Tue, 24 Jun 2025 00:50:10 +0800 Subject: [PATCH 6/8] add max_uncompressed_batch_bytes_size --- rollup/conf/config.json | 6 ++-- rollup/go.mod | 2 +- rollup/go.sum | 4 +-- rollup/internal/config/l2.go | 16 +++++---- .../controller/watcher/batch_proposer.go | 12 ++++--- .../controller/watcher/batch_proposer_test.go | 36 +++++++++++-------- .../watcher/bundle_proposer_test.go | 12 ++++--- .../controller/watcher/chunk_proposer.go | 8 +++-- .../controller/watcher/chunk_proposer_test.go | 14 ++++---- rollup/internal/utils/utils.go | 10 +++--- rollup/proposer-tool-config.json | 6 ++-- rollup/tests/rollup_test.go | 12 ++++--- 12 files changed, 81 insertions(+), 57 deletions(-) diff --git a/rollup/conf/config.json b/rollup/conf/config.json index fbc942f6ee..756bb87b0b 100644 --- a/rollup/conf/config.json +++ b/rollup/conf/config.json @@ -94,12 +94,14 @@ "propose_interval_milliseconds": 100, "max_block_num_per_chunk": 100, "max_l2_gas_per_chunk": 20000000, - "chunk_timeout_sec": 300 + "chunk_timeout_sec": 300, + "max_uncompressed_batch_bytes_size": 4000000 }, "batch_proposer_config": { "propose_interval_milliseconds": 1000, "batch_timeout_sec": 300, - "max_chunks_per_batch": 45 + "max_chunks_per_batch": 45, + "max_uncompressed_batch_bytes_size": 4000000 }, "bundle_proposer_config": { "max_batch_num_per_bundle": 20, diff --git a/rollup/go.mod b/rollup/go.mod index f6e36b1314..d3c68fbc23 100644 --- a/rollup/go.mod +++ b/rollup/go.mod @@ -15,7 +15,7 @@ require ( github.com/holiman/uint256 v1.3.2 github.com/mitchellh/mapstructure v1.5.0 github.com/prometheus/client_golang v1.16.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250622220508-c89e7e5e42f9 + github.com/scroll-tech/da-codec v0.1.3-0.20250623141222-9e6ea1d439fa github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 github.com/smartystreets/goconvey v1.8.0 github.com/spf13/viper v1.19.0 diff --git a/rollup/go.sum b/rollup/go.sum index 599ba42b22..e8fd4dc70c 100644 --- a/rollup/go.sum +++ b/rollup/go.sum @@ -285,8 +285,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/scroll-tech/da-codec v0.1.3-0.20250622220508-c89e7e5e42f9 h1:0TsRwqi159i8nMG0O6kgP7q8fF1/eygWTSrT1z5jiO8= -github.com/scroll-tech/da-codec v0.1.3-0.20250622220508-c89e7e5e42f9/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= +github.com/scroll-tech/da-codec v0.1.3-0.20250623141222-9e6ea1d439fa h1:IwobY81o8LeI1kV4WkbaYFh6oDtAfheFjUO/dapkNlE= +github.com/scroll-tech/da-codec v0.1.3-0.20250623141222-9e6ea1d439fa/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 h1:rC6eEsAwSG1VzNT48fLM00rqwTGWPckiipmFC8D6D5o= github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE= diff --git a/rollup/internal/config/l2.go b/rollup/internal/config/l2.go index a87f77d2c9..26da137ef2 100644 --- a/rollup/internal/config/l2.go +++ b/rollup/internal/config/l2.go @@ -30,17 +30,19 @@ type L2Config struct { // ChunkProposerConfig loads chunk_proposer configuration items. type ChunkProposerConfig struct { - ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"` - MaxBlockNumPerChunk uint64 `json:"max_block_num_per_chunk"` - MaxL2GasPerChunk uint64 `json:"max_l2_gas_per_chunk"` - ChunkTimeoutSec uint64 `json:"chunk_timeout_sec"` + ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"` + MaxBlockNumPerChunk uint64 `json:"max_block_num_per_chunk"` + MaxL2GasPerChunk uint64 `json:"max_l2_gas_per_chunk"` + ChunkTimeoutSec uint64 `json:"chunk_timeout_sec"` + MaxUncompressedBatchBytesSize uint64 `json:"max_uncompressed_batch_bytes_size"` } // BatchProposerConfig loads batch_proposer configuration items. type BatchProposerConfig struct { - ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"` - BatchTimeoutSec uint64 `json:"batch_timeout_sec"` - MaxChunksPerBatch int `json:"max_chunks_per_batch"` + ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"` + BatchTimeoutSec uint64 `json:"batch_timeout_sec"` + MaxChunksPerBatch int `json:"max_chunks_per_batch"` + MaxUncompressedBatchBytesSize uint64 `json:"max_uncompressed_batch_bytes_size"` } // BundleProposerConfig loads bundle_proposer configuration items. diff --git a/rollup/internal/controller/watcher/batch_proposer.go b/rollup/internal/controller/watcher/batch_proposer.go index 5f56bb199a..76d8ea94bf 100644 --- a/rollup/internal/controller/watcher/batch_proposer.go +++ b/rollup/internal/controller/watcher/batch_proposer.go @@ -54,7 +54,7 @@ type BatchProposer struct { // NewBatchProposer creates a new BatchProposer instance. func NewBatchProposer(ctx context.Context, cfg *config.BatchProposerConfig, minCodecVersion encoding.CodecVersion, chainCfg *params.ChainConfig, db *gorm.DB, reg prometheus.Registerer) *BatchProposer { - log.Info("new batch proposer", "batchTimeoutSec", cfg.BatchTimeoutSec, "maxBlobSize", maxBlobSize) + log.Info("new batch proposer", "batchTimeoutSec", cfg.BatchTimeoutSec, "maxBlobSize", maxBlobSize, "maxUncompressedBatchBytesSize", cfg.MaxUncompressedBatchBytesSize) p := &BatchProposer{ ctx: ctx, @@ -294,16 +294,18 @@ func (p *BatchProposer) proposeBatch() error { p.recordTimerBatchMetrics(metrics) - if metrics.L1CommitBlobSize > maxBlobSize { + if metrics.L1CommitBlobSize > maxBlobSize || metrics.L1CommitUncompressedBatchBytesSize > p.cfg.MaxUncompressedBatchBytesSize { if i == 0 { // The first chunk exceeds hard limits, which indicates a bug in the chunk-proposer, manual fix is needed. - return fmt.Errorf("the first chunk exceeds limits; start block number: %v, end block number: %v, limits: %+v, maxChunkNum: %v, maxBlobSize: %v", - dbChunks[0].StartBlockNumber, dbChunks[0].EndBlockNumber, metrics, maxChunksThisBatch, maxBlobSize) + return fmt.Errorf("the first chunk exceeds limits; start block number: %v, end block number: %v, limits: %+v, maxChunkNum: %v, maxBlobSize: %v, maxUncompressedBatchBytesSize: %v", + dbChunks[0].StartBlockNumber, dbChunks[0].EndBlockNumber, metrics, maxChunksThisBatch, maxBlobSize, p.cfg.MaxUncompressedBatchBytesSize) } log.Debug("breaking limit condition in batching", "l1CommitBlobSize", metrics.L1CommitBlobSize, - "maxBlobSize", maxBlobSize) + "maxBlobSize", maxBlobSize, + "L1CommitUncompressedBatchBytesSize", metrics.L1CommitUncompressedBatchBytesSize, + "maxUncompressedBatchBytesSize", p.cfg.MaxUncompressedBatchBytesSize) lastChunk := batch.Chunks[len(batch.Chunks)-1] batch.Chunks = batch.Chunks[:len(batch.Chunks)-1] diff --git a/rollup/internal/controller/watcher/batch_proposer_test.go b/rollup/internal/controller/watcher/batch_proposer_test.go index 3010916800..aab32e25f1 100644 --- a/rollup/internal/controller/watcher/batch_proposer_test.go +++ b/rollup/internal/controller/watcher/batch_proposer_test.go @@ -72,9 +72,10 @@ func testBatchProposerLimitsCodecV7(t *testing.T) { assert.NoError(t, err) cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ - MaxBlockNumPerChunk: 1, - MaxL2GasPerChunk: 20000000, - ChunkTimeoutSec: 300, + MaxBlockNumPerChunk: 1, + MaxL2GasPerChunk: 20000000, + ChunkTimeoutSec: 300, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, ¶ms.ChainConfig{ LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), @@ -88,8 +89,9 @@ func testBatchProposerLimitsCodecV7(t *testing.T) { cp.TryProposeChunk() // chunk2 contains block2 bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ - MaxChunksPerBatch: math.MaxInt32, - BatchTimeoutSec: tt.batchTimeoutSec, + MaxChunksPerBatch: math.MaxInt32, + BatchTimeoutSec: tt.batchTimeoutSec, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, ¶ms.ChainConfig{ LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), @@ -152,9 +154,10 @@ func testBatchProposerBlobSizeLimitCodecV7(t *testing.T) { chainConfig := ¶ms.ChainConfig{LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64), DarwinV2Time: new(uint64), EuclidTime: new(uint64), EuclidV2Time: new(uint64)} cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ - MaxBlockNumPerChunk: math.MaxUint64, - MaxL2GasPerChunk: math.MaxUint64, - ChunkTimeoutSec: 0, + MaxBlockNumPerChunk: math.MaxUint64, + MaxL2GasPerChunk: math.MaxUint64, + ChunkTimeoutSec: 0, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) blockHeight := uint64(0) @@ -172,8 +175,9 @@ func testBatchProposerBlobSizeLimitCodecV7(t *testing.T) { } bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ - MaxChunksPerBatch: math.MaxInt32, - BatchTimeoutSec: math.MaxUint32, + MaxChunksPerBatch: math.MaxInt32, + BatchTimeoutSec: math.MaxUint32, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) for i := 0; i < 2; i++ { @@ -223,9 +227,10 @@ func testBatchProposerMaxChunkNumPerBatchLimitCodecV7(t *testing.T) { chainConfig := ¶ms.ChainConfig{LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64), DarwinV2Time: new(uint64), EuclidTime: new(uint64), EuclidV2Time: new(uint64)} cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ - MaxBlockNumPerChunk: math.MaxUint64, - MaxL2GasPerChunk: math.MaxUint64, - ChunkTimeoutSec: 0, + MaxBlockNumPerChunk: math.MaxUint64, + MaxL2GasPerChunk: math.MaxUint64, + ChunkTimeoutSec: 0, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) block = readBlockFromJSON(t, "../../../testdata/blockTrace_03.json") @@ -238,8 +243,9 @@ func testBatchProposerMaxChunkNumPerBatchLimitCodecV7(t *testing.T) { } bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ - MaxChunksPerBatch: 45, - BatchTimeoutSec: math.MaxUint32, + MaxChunksPerBatch: 45, + BatchTimeoutSec: math.MaxUint32, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) bp.TryProposeBatch() diff --git a/rollup/internal/controller/watcher/bundle_proposer_test.go b/rollup/internal/controller/watcher/bundle_proposer_test.go index fa1b82d087..f631a60a18 100644 --- a/rollup/internal/controller/watcher/bundle_proposer_test.go +++ b/rollup/internal/controller/watcher/bundle_proposer_test.go @@ -93,14 +93,16 @@ func testBundleProposerLimitsCodecV7(t *testing.T) { chainConfig := ¶ms.ChainConfig{LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64), DarwinV2Time: new(uint64), EuclidTime: new(uint64), EuclidV2Time: new(uint64)} cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ - MaxBlockNumPerChunk: 1, - MaxL2GasPerChunk: math.MaxUint64, - ChunkTimeoutSec: math.MaxUint32, + MaxBlockNumPerChunk: 1, + MaxL2GasPerChunk: math.MaxUint64, + ChunkTimeoutSec: math.MaxUint32, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) bap := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ - MaxChunksPerBatch: math.MaxInt32, - BatchTimeoutSec: 0, + MaxChunksPerBatch: math.MaxInt32, + BatchTimeoutSec: 0, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) cp.TryProposeChunk() // chunk1 contains block1 diff --git a/rollup/internal/controller/watcher/chunk_proposer.go b/rollup/internal/controller/watcher/chunk_proposer.go index 79f2467c40..622c27a9a7 100644 --- a/rollup/internal/controller/watcher/chunk_proposer.go +++ b/rollup/internal/controller/watcher/chunk_proposer.go @@ -295,17 +295,19 @@ func (p *ChunkProposer) proposeChunk() error { p.recordTimerChunkMetrics(metrics) - if metrics.L2Gas > p.cfg.MaxL2GasPerChunk || metrics.L1CommitBlobSize > maxBlobSize { + if metrics.L2Gas > p.cfg.MaxL2GasPerChunk || metrics.L1CommitBlobSize > maxBlobSize || metrics.L1CommitUncompressedBatchBytesSize > p.cfg.MaxUncompressedBatchBytesSize { if i == 0 { // The first block exceeds hard limits, which indicates a bug in the sequencer, manual fix is needed. - return fmt.Errorf("the first block exceeds limits; block number: %v, limits: %+v, maxBlobSize: %v", block.Header.Number, metrics, maxBlobSize) + return fmt.Errorf("the first block exceeds limits; block number: %v, limits: %+v, maxBlobSize: %v, maxUncompressedBatchBytesSize: %v", block.Header.Number, metrics, maxBlobSize, p.cfg.MaxUncompressedBatchBytesSize) } log.Debug("breaking limit condition in chunking", "l2Gas", metrics.L2Gas, "maxL2Gas", p.cfg.MaxL2GasPerChunk, "l1CommitBlobSize", metrics.L1CommitBlobSize, - "maxBlobSize", maxBlobSize) + "maxBlobSize", maxBlobSize, + "L1CommitUncompressedBatchBytesSize", metrics.L1CommitUncompressedBatchBytesSize, + "maxUncompressedBatchBytesSize", p.cfg.MaxUncompressedBatchBytesSize) chunk.Blocks = chunk.Blocks[:len(chunk.Blocks)-1] chunk.PostL1MessageQueueHash = previousPostL1MessageQueueHash diff --git a/rollup/internal/controller/watcher/chunk_proposer_test.go b/rollup/internal/controller/watcher/chunk_proposer_test.go index 653e8cf5cd..6b40cf54b0 100644 --- a/rollup/internal/controller/watcher/chunk_proposer_test.go +++ b/rollup/internal/controller/watcher/chunk_proposer_test.go @@ -84,9 +84,10 @@ func testChunkProposerLimitsCodecV7(t *testing.T) { assert.NoError(t, err) cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ - MaxBlockNumPerChunk: tt.maxBlockNum, - MaxL2GasPerChunk: tt.maxL2Gas, - ChunkTimeoutSec: tt.chunkTimeoutSec, + MaxBlockNumPerChunk: tt.maxBlockNum, + MaxL2GasPerChunk: tt.maxL2Gas, + ChunkTimeoutSec: tt.chunkTimeoutSec, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, ¶ms.ChainConfig{LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64), DarwinV2Time: new(uint64), EuclidTime: new(uint64), EuclidV2Time: new(uint64)}, db, nil) cp.TryProposeChunk() @@ -128,9 +129,10 @@ func testChunkProposerBlobSizeLimitCodecV7(t *testing.T) { chainConfig := ¶ms.ChainConfig{LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64), DarwinV2Time: new(uint64), EuclidTime: new(uint64), EuclidV2Time: new(uint64)} cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ - MaxBlockNumPerChunk: 255, - MaxL2GasPerChunk: math.MaxUint64, - ChunkTimeoutSec: math.MaxUint32, + MaxBlockNumPerChunk: 255, + MaxL2GasPerChunk: math.MaxUint64, + ChunkTimeoutSec: math.MaxUint32, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) for i := 0; i < 2; i++ { diff --git a/rollup/internal/utils/utils.go b/rollup/internal/utils/utils.go index 65b92c32c0..82d3f4af90 100644 --- a/rollup/internal/utils/utils.go +++ b/rollup/internal/utils/utils.go @@ -15,7 +15,8 @@ type ChunkMetrics struct { L2Gas uint64 FirstBlockTimestamp uint64 - L1CommitBlobSize uint64 + L1CommitBlobSize uint64 + L1CommitUncompressedBatchBytesSize uint64 // timing metrics EstimateBlobSizeTime time.Duration @@ -41,7 +42,7 @@ func CalculateChunkMetrics(chunk *encoding.Chunk, codecVersion encoding.CodecVer } metrics.EstimateBlobSizeTime, err = measureTime(func() error { - _, metrics.L1CommitBlobSize, err = codec.EstimateChunkL1CommitBatchSizeAndBlobSize(chunk) + metrics.L1CommitUncompressedBatchBytesSize, metrics.L1CommitBlobSize, err = codec.EstimateChunkL1CommitBatchSizeAndBlobSize(chunk) return err }) if err != nil { @@ -56,7 +57,8 @@ type BatchMetrics struct { NumChunks uint64 FirstBlockTimestamp uint64 - L1CommitBlobSize uint64 + L1CommitBlobSize uint64 + L1CommitUncompressedBatchBytesSize uint64 // timing metrics EstimateBlobSizeTime time.Duration @@ -75,7 +77,7 @@ func CalculateBatchMetrics(batch *encoding.Batch, codecVersion encoding.CodecVer } metrics.EstimateBlobSizeTime, err = measureTime(func() error { - _, metrics.L1CommitBlobSize, err = codec.EstimateBatchL1CommitBatchSizeAndBlobSize(batch) + metrics.L1CommitUncompressedBatchBytesSize, metrics.L1CommitBlobSize, err = codec.EstimateBatchL1CommitBatchSizeAndBlobSize(batch) return err }) if err != nil { diff --git a/rollup/proposer-tool-config.json b/rollup/proposer-tool-config.json index 42946a893a..c6a63d0c69 100644 --- a/rollup/proposer-tool-config.json +++ b/rollup/proposer-tool-config.json @@ -4,11 +4,13 @@ "chunk_proposer_config": { "max_block_num_per_chunk": 100, "max_l2_gas_per_chunk": 20000000, - "chunk_timeout_sec": 72000000000 + "chunk_timeout_sec": 72000000000, + "max_uncompressed_batch_bytes_size": 4000000 }, "batch_proposer_config": { "batch_timeout_sec": 72000000000, - "max_chunks_per_batch": 45 + "max_chunks_per_batch": 45, + "max_uncompressed_batch_bytes_size": 4000000 }, "bundle_proposer_config": { "max_batch_num_per_bundle": 45, diff --git a/rollup/tests/rollup_test.go b/rollup/tests/rollup_test.go index 4fa71fd33f..14c1a22b31 100644 --- a/rollup/tests/rollup_test.go +++ b/rollup/tests/rollup_test.go @@ -118,14 +118,16 @@ func testCommitBatchAndFinalizeBundleCodecV7(t *testing.T) { } cp := watcher.NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ - MaxBlockNumPerChunk: 100, - MaxL2GasPerChunk: math.MaxUint64, - ChunkTimeoutSec: 300, + MaxBlockNumPerChunk: 100, + MaxL2GasPerChunk: math.MaxUint64, + ChunkTimeoutSec: 300, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) bap := watcher.NewBatchProposer(context.Background(), &config.BatchProposerConfig{ - MaxChunksPerBatch: math.MaxInt32, - BatchTimeoutSec: 300, + MaxChunksPerBatch: math.MaxInt32, + BatchTimeoutSec: 300, + MaxUncompressedBatchBytesSize: math.MaxUint64, }, encoding.CodecV7, chainConfig, db, nil) bup := watcher.NewBundleProposer(context.Background(), &config.BundleProposerConfig{ From a140d2e94d4639b89e4264aa347c753c74a6a3a1 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Tue, 24 Jun 2025 02:13:12 +0800 Subject: [PATCH 7/8] add unit tests for UncompressedBatchBytesLimit --- .../controller/watcher/batch_proposer_test.go | 99 +++++++++++++++++++ .../controller/watcher/chunk_proposer_test.go | 74 ++++++++++++++ .../controller/watcher/watcher_test.go | 2 + 3 files changed, 175 insertions(+) diff --git a/rollup/internal/controller/watcher/batch_proposer_test.go b/rollup/internal/controller/watcher/batch_proposer_test.go index aab32e25f1..e9ba53b1a4 100644 --- a/rollup/internal/controller/watcher/batch_proposer_test.go +++ b/rollup/internal/controller/watcher/batch_proposer_test.go @@ -256,3 +256,102 @@ func testBatchProposerMaxChunkNumPerBatchLimitCodecV7(t *testing.T) { assert.Equal(t, expectedChunkNum, dbBatch.EndChunkIndex) } + +func testBatchProposerUncompressedBatchBytesLimitCodecV8(t *testing.T) { + db := setupDB(t) + defer database.CloseDB(db) + + // Add genesis batch + genesisBlock := &encoding.Block{ + Header: &gethTypes.Header{ + Number: big.NewInt(0), + }, + } + genesisChunk := &encoding.Chunk{ + Blocks: []*encoding.Block{genesisBlock}, + } + chunkOrm := orm.NewChunk(db) + _, err := chunkOrm.InsertChunk(context.Background(), genesisChunk, encoding.CodecV0, utils.ChunkMetrics{}) + assert.NoError(t, err) + + genesisBatch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{genesisChunk}, + } + batchOrm := orm.NewBatch(db) + _, err = batchOrm.InsertBatch(context.Background(), genesisBatch, encoding.CodecV0, utils.BatchMetrics{}) + assert.NoError(t, err) + + // Create blocks with large calldata + block := readBlockFromJSON(t, "../../../testdata/blockTrace_03.json") + + // Create large calldata (3MB per block) + largeCalldata := make([]byte, 3*1024*1024) // 3MB calldata + for i := range largeCalldata { + largeCalldata[i] = byte(i % 256) + } + + // Modify the block to have a transaction with large calldata + block.Transactions[0].Data = "0x" + common.Bytes2Hex(largeCalldata) + + chainConfig := ¶ms.ChainConfig{ + LondonBlock: big.NewInt(0), + BernoulliBlock: big.NewInt(0), + CurieBlock: big.NewInt(0), + DarwinTime: new(uint64), + DarwinV2Time: new(uint64), + EuclidTime: new(uint64), + EuclidV2Time: new(uint64), + FeynmanTime: new(uint64), + } + + // Create chunk proposer with no uncompressed batch bytes limit for chunks + cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ + MaxBlockNumPerChunk: 1, // One block per chunk + MaxL2GasPerChunk: math.MaxUint64, + ChunkTimeoutSec: math.MaxUint32, + MaxUncompressedBatchBytesSize: math.MaxUint64, + }, encoding.CodecV8, chainConfig, db, nil) + + // Insert 2 blocks with large calldata and create 2 chunks + l2BlockOrm := orm.NewL2Block(db) + for i := uint64(1); i <= 2; i++ { + blockCopy := *block + blockCopy.Header = &gethTypes.Header{} + *blockCopy.Header = *block.Header + blockCopy.Header.Number = new(big.Int).SetUint64(i) + blockCopy.Header.Time = i + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{&blockCopy}) + assert.NoError(t, err) + + cp.TryProposeChunk() // Each call creates one chunk with one block + } + + // Create batch proposer with 4MB uncompressed batch bytes limit + // Each chunk is ~3MB, so 1 chunk (~3MB) should fit, but 2 chunks (~6MB) should exceed limit + bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ + MaxChunksPerBatch: math.MaxInt32, // No chunk count limit + BatchTimeoutSec: math.MaxUint32, // No timeout limit + MaxUncompressedBatchBytesSize: 4 * 1024 * 1024, // 4MB limit + }, encoding.CodecV8, chainConfig, db, nil) + + bp.TryProposeBatch() + + // Check that a batch was created + batches, err := batchOrm.GetBatches(context.Background(), map[string]interface{}{}, []string{}, 0) + assert.NoError(t, err) + assert.Len(t, batches, 2) // genesis batch + 1 new batch + + // Verify that the batch contains only 1 chunk (not 2) due to uncompressed batch bytes limit + newBatch := batches[1] // Skip genesis batch + assert.Equal(t, uint64(1), newBatch.StartChunkIndex) + assert.Equal(t, uint64(1), newBatch.EndChunkIndex) // Should only include chunk 1 + + // Verify that the second chunk is still available for next batch + chunks, err := chunkOrm.GetChunksGEIndex(context.Background(), 2, 0) + assert.NoError(t, err) + assert.Len(t, chunks, 1) // Second chunk should still be available + assert.Equal(t, "", chunks[0].BatchHash) // Should not be assigned to any batch yet +} diff --git a/rollup/internal/controller/watcher/chunk_proposer_test.go b/rollup/internal/controller/watcher/chunk_proposer_test.go index 6b40cf54b0..d2dc1a9d3c 100644 --- a/rollup/internal/controller/watcher/chunk_proposer_test.go +++ b/rollup/internal/controller/watcher/chunk_proposer_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/scroll-tech/da-codec/encoding" + "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/common/math" gethTypes "github.com/scroll-tech/go-ethereum/core/types" "github.com/scroll-tech/go-ethereum/params" @@ -155,3 +156,76 @@ func testChunkProposerBlobSizeLimitCodecV7(t *testing.T) { assert.Equal(t, expected, chunk.EndBlockNumber) } } + +func testChunkProposerUncompressedBatchBytesLimitCodecV8(t *testing.T) { + db := setupDB(t) + defer database.CloseDB(db) + + // Create a block with very large calldata to test uncompressed batch bytes limit + block := readBlockFromJSON(t, "../../../testdata/blockTrace_03.json") + + // Create a transaction with large calldata (around 3MB) + largeCalldata := make([]byte, 3*1024*1024) // 3MB calldata + for i := range largeCalldata { + largeCalldata[i] = byte(i % 256) + } + + // Modify the block to have a transaction with large calldata + block.Transactions[0].Data = "0x" + common.Bytes2Hex(largeCalldata) + + // Insert two identical blocks with large calldata + l2BlockOrm := orm.NewL2Block(db) + for i := uint64(0); i < 2; i++ { + blockCopy := *block + blockCopy.Header = &gethTypes.Header{} + *blockCopy.Header = *block.Header + blockCopy.Header.Number = new(big.Int).SetUint64(i + 1) + blockCopy.Header.Time = i + 1 + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{&blockCopy}) + assert.NoError(t, err) + } + + // Add genesis chunk + chunkOrm := orm.NewChunk(db) + _, err := chunkOrm.InsertChunk(context.Background(), &encoding.Chunk{Blocks: []*encoding.Block{{Header: &gethTypes.Header{Number: big.NewInt(0)}}}}, encoding.CodecV0, utils.ChunkMetrics{}) + assert.NoError(t, err) + + chainConfig := ¶ms.ChainConfig{ + LondonBlock: big.NewInt(0), + BernoulliBlock: big.NewInt(0), + CurieBlock: big.NewInt(0), + DarwinTime: new(uint64), + DarwinV2Time: new(uint64), + EuclidTime: new(uint64), + EuclidV2Time: new(uint64), + FeynmanTime: new(uint64), + } + + // Set max_uncompressed_batch_bytes_size to 4MB (4 * 1024 * 1024) + // One block (~3MB) should fit, but two blocks (~6MB) should exceed the limit + cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ + MaxBlockNumPerChunk: math.MaxUint64, // No block number limit + MaxL2GasPerChunk: math.MaxUint64, // No gas limit + ChunkTimeoutSec: math.MaxUint32, // No timeout limit + MaxUncompressedBatchBytesSize: 4 * 1024 * 1024, // 4MB limit + }, encoding.CodecV8, chainConfig, db, nil) + + // Try to propose chunk + cp.TryProposeChunk() + + // Check that a chunk was created + chunks, err := chunkOrm.GetChunksGEIndex(context.Background(), 1, 0) + assert.NoError(t, err) + assert.Len(t, chunks, 1) + + // Verify that the chunk contains only 1 block (not 2) due to uncompressed batch bytes limit + chunk := chunks[0] + assert.Equal(t, uint64(1), chunk.StartBlockNumber) + assert.Equal(t, uint64(1), chunk.EndBlockNumber) + + // Verify that the second block is still available for next chunk + blockOrm := orm.NewL2Block(db) + blocks, err := blockOrm.GetL2BlocksGEHeight(context.Background(), 2, 0) + assert.NoError(t, err) + assert.Len(t, blocks, 1) // Second block should still be available +} diff --git a/rollup/internal/controller/watcher/watcher_test.go b/rollup/internal/controller/watcher/watcher_test.go index 26e3499f6e..1e76cc0a0e 100644 --- a/rollup/internal/controller/watcher/watcher_test.go +++ b/rollup/internal/controller/watcher/watcher_test.go @@ -103,11 +103,13 @@ func TestFunction(t *testing.T) { // Run chunk proposer test cases. t.Run("TestChunkProposerLimitsCodecV7", testChunkProposerLimitsCodecV7) t.Run("TestChunkProposerBlobSizeLimitCodecV7", testChunkProposerBlobSizeLimitCodecV7) + t.Run("TestChunkProposerUncompressedBatchBytesLimitCodecV8", testChunkProposerUncompressedBatchBytesLimitCodecV8) // Run batch proposer test cases. t.Run("TestBatchProposerLimitsCodecV7", testBatchProposerLimitsCodecV7) t.Run("TestBatchProposerBlobSizeLimitCodecV7", testBatchProposerBlobSizeLimitCodecV7) t.Run("TestBatchProposerMaxChunkNumPerBatchLimitCodecV7", testBatchProposerMaxChunkNumPerBatchLimitCodecV7) + t.Run("TestBatchProposerUncompressedBatchBytesLimitCodecV8", testBatchProposerUncompressedBatchBytesLimitCodecV8) // Run bundle proposer test cases. t.Run("TestBundleProposerLimitsCodecV7", testBundleProposerLimitsCodecV7) From f60c29035b2ab443b382a455beb5ca2271693505 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Tue, 24 Jun 2025 14:32:09 +0800 Subject: [PATCH 8/8] update limits --- bridge-history-api/go.mod | 6 +++--- bridge-history-api/go.sum | 8 ++++---- coordinator/go.mod | 4 ++-- coordinator/go.sum | 8 ++++---- rollup/conf/config.json | 4 ++-- rollup/go.mod | 4 ++-- rollup/go.sum | 8 ++++---- .../controller/watcher/batch_proposer_test.go | 14 +++++++------- .../controller/watcher/chunk_proposer_test.go | 16 ++++++++-------- rollup/proposer-tool-config.json | 4 ++-- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/bridge-history-api/go.mod b/bridge-history-api/go.mod index e8ee455228..7294658039 100644 --- a/bridge-history-api/go.mod +++ b/bridge-history-api/go.mod @@ -10,15 +10,15 @@ require ( github.com/go-redis/redis/v8 v8.11.5 github.com/pressly/goose/v3 v3.16.0 github.com/prometheus/client_golang v1.19.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd - github.com/scroll-tech/go-ethereum v1.10.14-0.20250616074821-cba908db071d + github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6 + github.com/scroll-tech/go-ethereum v1.10.14-0.20250626101020-47bc86cd961c github.com/stretchr/testify v1.9.0 github.com/urfave/cli/v2 v2.25.7 golang.org/x/sync v0.11.0 gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde ) -replace github.com/scroll-tech/go-ethereum => github.com/scroll-tech/go-ethereum v1.10.14-0.20250616074821-cba908db071d // It's a hotfix for the header hash incompatibility issue, pls change this with caution +replace github.com/scroll-tech/go-ethereum => github.com/scroll-tech/go-ethereum v1.10.14-0.20250626101020-47bc86cd961c // It's a hotfix for the header hash incompatibility issue, pls change this with caution require ( dario.cat/mergo v1.0.0 // indirect diff --git a/bridge-history-api/go.sum b/bridge-history-api/go.sum index 56ccde086c..00bc012d6c 100644 --- a/bridge-history-api/go.sum +++ b/bridge-history-api/go.sum @@ -309,10 +309,10 @@ 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.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd h1:VKVDPtKJZIaQNQvhXptVhS7O9GLKl1314egD1fln8SA= -github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250616074821-cba908db071d h1:JoEtZN6aCV5MUBjacsrPd2S6fl8sDGZE9Xd4UUhg5Oo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250616074821-cba908db071d/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= +github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6 h1:vb2XLvQwCf+F/ifP6P/lfeiQrHY6+Yb/E3R4KHXLqSE= +github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6/go.mod h1:Z6kN5u2khPhiqHyk172kGB7o38bH/nj7Ilrb/46wZGg= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250626101020-47bc86cd961c h1:IpEBKM6O+xOK2qZVZztGxcobFXkKMb5hAkBEVzfXjVg= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250626101020-47bc86cd961c/go.mod h1:pDCZ4iGvEGmdIe4aSAGBrb7XSrKEML6/L/wEMmNxOdk= 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/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= diff --git a/coordinator/go.mod b/coordinator/go.mod index 3f0cd39cb0..9cd2f15e1d 100644 --- a/coordinator/go.mod +++ b/coordinator/go.mod @@ -9,8 +9,8 @@ require ( github.com/google/uuid v1.6.0 github.com/mitchellh/mapstructure v1.5.0 github.com/prometheus/client_golang v1.19.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd - github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 + github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6 + github.com/scroll-tech/go-ethereum v1.10.14-0.20250626110859-cc9a1dd82de7 github.com/shopspring/decimal v1.3.1 github.com/stretchr/testify v1.10.0 github.com/urfave/cli/v2 v2.25.7 diff --git a/coordinator/go.sum b/coordinator/go.sum index 84073192f4..e4033978bb 100644 --- a/coordinator/go.sum +++ b/coordinator/go.sum @@ -177,10 +177,10 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd h1:VKVDPtKJZIaQNQvhXptVhS7O9GLKl1314egD1fln8SA= -github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 h1:rC6eEsAwSG1VzNT48fLM00rqwTGWPckiipmFC8D6D5o= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= +github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6 h1:vb2XLvQwCf+F/ifP6P/lfeiQrHY6+Yb/E3R4KHXLqSE= +github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6/go.mod h1:Z6kN5u2khPhiqHyk172kGB7o38bH/nj7Ilrb/46wZGg= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250626110859-cc9a1dd82de7 h1:1rN1qocsQlOyk1VCpIEF1J5pfQbLAi1pnMZSLQS37jQ= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250626110859-cc9a1dd82de7/go.mod h1:pDCZ4iGvEGmdIe4aSAGBrb7XSrKEML6/L/wEMmNxOdk= 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/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= diff --git a/rollup/conf/config.json b/rollup/conf/config.json index 756bb87b0b..b2e365221e 100644 --- a/rollup/conf/config.json +++ b/rollup/conf/config.json @@ -95,13 +95,13 @@ "max_block_num_per_chunk": 100, "max_l2_gas_per_chunk": 20000000, "chunk_timeout_sec": 300, - "max_uncompressed_batch_bytes_size": 4000000 + "max_uncompressed_batch_bytes_size": 4194304 }, "batch_proposer_config": { "propose_interval_milliseconds": 1000, "batch_timeout_sec": 300, "max_chunks_per_batch": 45, - "max_uncompressed_batch_bytes_size": 4000000 + "max_uncompressed_batch_bytes_size": 4194304 }, "bundle_proposer_config": { "max_batch_num_per_bundle": 20, diff --git a/rollup/go.mod b/rollup/go.mod index d3c68fbc23..253defd4ba 100644 --- a/rollup/go.mod +++ b/rollup/go.mod @@ -15,8 +15,8 @@ require ( github.com/holiman/uint256 v1.3.2 github.com/mitchellh/mapstructure v1.5.0 github.com/prometheus/client_golang v1.16.0 - github.com/scroll-tech/da-codec v0.1.3-0.20250623141222-9e6ea1d439fa - github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 + github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6 + github.com/scroll-tech/go-ethereum v1.10.14-0.20250626110859-cc9a1dd82de7 github.com/smartystreets/goconvey v1.8.0 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 diff --git a/rollup/go.sum b/rollup/go.sum index e8fd4dc70c..da885ef408 100644 --- a/rollup/go.sum +++ b/rollup/go.sum @@ -285,10 +285,10 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/scroll-tech/da-codec v0.1.3-0.20250623141222-9e6ea1d439fa h1:IwobY81o8LeI1kV4WkbaYFh6oDtAfheFjUO/dapkNlE= -github.com/scroll-tech/da-codec v0.1.3-0.20250623141222-9e6ea1d439fa/go.mod h1:T+370kLxwACnmWaq4rgtKGyLCd7QSE6iy0JLfCp1qj4= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707 h1:rC6eEsAwSG1VzNT48fLM00rqwTGWPckiipmFC8D6D5o= -github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707/go.mod h1:756YMENiSfx/5pCwKq3+uSTWjXuHTbiCB+TirJjsQT8= +github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6 h1:vb2XLvQwCf+F/ifP6P/lfeiQrHY6+Yb/E3R4KHXLqSE= +github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6/go.mod h1:Z6kN5u2khPhiqHyk172kGB7o38bH/nj7Ilrb/46wZGg= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250626110859-cc9a1dd82de7 h1:1rN1qocsQlOyk1VCpIEF1J5pfQbLAi1pnMZSLQS37jQ= +github.com/scroll-tech/go-ethereum v1.10.14-0.20250626110859-cc9a1dd82de7/go.mod h1:pDCZ4iGvEGmdIe4aSAGBrb7XSrKEML6/L/wEMmNxOdk= 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/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= diff --git a/rollup/internal/controller/watcher/batch_proposer_test.go b/rollup/internal/controller/watcher/batch_proposer_test.go index e9ba53b1a4..c446315d6d 100644 --- a/rollup/internal/controller/watcher/batch_proposer_test.go +++ b/rollup/internal/controller/watcher/batch_proposer_test.go @@ -287,8 +287,8 @@ func testBatchProposerUncompressedBatchBytesLimitCodecV8(t *testing.T) { // Create blocks with large calldata block := readBlockFromJSON(t, "../../../testdata/blockTrace_03.json") - // Create large calldata (3MB per block) - largeCalldata := make([]byte, 3*1024*1024) // 3MB calldata + // Create large calldata (3KiB per block) + largeCalldata := make([]byte, 3*1024) // 3KiB calldata for i := range largeCalldata { largeCalldata[i] = byte(i % 256) } @@ -329,12 +329,12 @@ func testBatchProposerUncompressedBatchBytesLimitCodecV8(t *testing.T) { cp.TryProposeChunk() // Each call creates one chunk with one block } - // Create batch proposer with 4MB uncompressed batch bytes limit - // Each chunk is ~3MB, so 1 chunk (~3MB) should fit, but 2 chunks (~6MB) should exceed limit + // Create batch proposer with 4KiB uncompressed batch bytes limit + // Each chunk is ~3KiB, so 1 chunk (~3KiB) should fit, but 2 chunks (~6KiB) should exceed limit bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ - MaxChunksPerBatch: math.MaxInt32, // No chunk count limit - BatchTimeoutSec: math.MaxUint32, // No timeout limit - MaxUncompressedBatchBytesSize: 4 * 1024 * 1024, // 4MB limit + MaxChunksPerBatch: math.MaxInt32, // No chunk count limit + BatchTimeoutSec: math.MaxUint32, // No timeout limit + MaxUncompressedBatchBytesSize: 4 * 1024, // 4KiB limit }, encoding.CodecV8, chainConfig, db, nil) bp.TryProposeBatch() diff --git a/rollup/internal/controller/watcher/chunk_proposer_test.go b/rollup/internal/controller/watcher/chunk_proposer_test.go index d2dc1a9d3c..218bc4c9f4 100644 --- a/rollup/internal/controller/watcher/chunk_proposer_test.go +++ b/rollup/internal/controller/watcher/chunk_proposer_test.go @@ -164,8 +164,8 @@ func testChunkProposerUncompressedBatchBytesLimitCodecV8(t *testing.T) { // Create a block with very large calldata to test uncompressed batch bytes limit block := readBlockFromJSON(t, "../../../testdata/blockTrace_03.json") - // Create a transaction with large calldata (around 3MB) - largeCalldata := make([]byte, 3*1024*1024) // 3MB calldata + // Create a transaction with large calldata (around 3KiB) + largeCalldata := make([]byte, 3*1024) // 3KiB calldata for i := range largeCalldata { largeCalldata[i] = byte(i % 256) } @@ -201,13 +201,13 @@ func testChunkProposerUncompressedBatchBytesLimitCodecV8(t *testing.T) { FeynmanTime: new(uint64), } - // Set max_uncompressed_batch_bytes_size to 4MB (4 * 1024 * 1024) - // One block (~3MB) should fit, but two blocks (~6MB) should exceed the limit + // Set max_uncompressed_batch_bytes_size to 4KiB (4 * 1024) + // One block (~3KiB) should fit, but two blocks (~6KiB) should exceed the limit cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ - MaxBlockNumPerChunk: math.MaxUint64, // No block number limit - MaxL2GasPerChunk: math.MaxUint64, // No gas limit - ChunkTimeoutSec: math.MaxUint32, // No timeout limit - MaxUncompressedBatchBytesSize: 4 * 1024 * 1024, // 4MB limit + MaxBlockNumPerChunk: math.MaxUint64, // No block number limit + MaxL2GasPerChunk: math.MaxUint64, // No gas limit + ChunkTimeoutSec: math.MaxUint32, // No timeout limit + MaxUncompressedBatchBytesSize: 4 * 1024, // 4KiB limit }, encoding.CodecV8, chainConfig, db, nil) // Try to propose chunk diff --git a/rollup/proposer-tool-config.json b/rollup/proposer-tool-config.json index c6a63d0c69..433f367286 100644 --- a/rollup/proposer-tool-config.json +++ b/rollup/proposer-tool-config.json @@ -5,12 +5,12 @@ "max_block_num_per_chunk": 100, "max_l2_gas_per_chunk": 20000000, "chunk_timeout_sec": 72000000000, - "max_uncompressed_batch_bytes_size": 4000000 + "max_uncompressed_batch_bytes_size": 4194304 }, "batch_proposer_config": { "batch_timeout_sec": 72000000000, "max_chunks_per_batch": 45, - "max_uncompressed_batch_bytes_size": 4000000 + "max_uncompressed_batch_bytes_size": 4194304 }, "bundle_proposer_config": { "max_batch_num_per_bundle": 45,