From 0fd7a877cebc3be74aa4d5d2e1592a83f45ed75a Mon Sep 17 00:00:00 2001 From: colin <102356659+colinlyguo@users.noreply.github.com> Date: Fri, 19 Jul 2024 21:07:30 +0800 Subject: [PATCH] feat(rollup-relayer): make chunk & batch proposal intervals configurable (#1459) --- common/version/version.go | 2 +- rollup/cmd/rollup_relayer/app/app.go | 4 ++-- rollup/conf/config.json | 2 ++ rollup/internal/config/l2.go | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/version/version.go b/common/version/version.go index 4ba6218c09..33cdcf1494 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -5,7 +5,7 @@ import ( "runtime/debug" ) -var tag = "v4.4.33" +var tag = "v4.4.34" var commit = func() string { if info, ok := debug.ReadBuildInfo(); ok { diff --git a/rollup/cmd/rollup_relayer/app/app.go b/rollup/cmd/rollup_relayer/app/app.go index 547be11d1b..0a208a88d3 100644 --- a/rollup/cmd/rollup_relayer/app/app.go +++ b/rollup/cmd/rollup_relayer/app/app.go @@ -106,9 +106,9 @@ func action(ctx *cli.Context) error { l2watcher.TryFetchRunningMissingBlocks(number) }) - go utils.Loop(subCtx, 2*time.Second, chunkProposer.TryProposeChunk) + go utils.Loop(subCtx, time.Duration(cfg.L2Config.ChunkProposerConfig.ProposeIntervalMilliseconds)*time.Millisecond, chunkProposer.TryProposeChunk) - go utils.Loop(subCtx, 10*time.Second, batchProposer.TryProposeBatch) + go utils.Loop(subCtx, time.Duration(cfg.L2Config.BatchProposerConfig.ProposeIntervalMilliseconds)*time.Millisecond, batchProposer.TryProposeBatch) go utils.Loop(subCtx, 2*time.Second, l2relayer.ProcessPendingBatches) diff --git a/rollup/conf/config.json b/rollup/conf/config.json index 8f14a34498..9d0c79aff8 100644 --- a/rollup/conf/config.json +++ b/rollup/conf/config.json @@ -61,6 +61,7 @@ "l1_commit_gas_limit_multiplier": 1.2 }, "chunk_proposer_config": { + "propose_interval_milliseconds": 100, "max_block_num_per_chunk": 100, "max_tx_num_per_chunk": 100, "max_l1_commit_gas_per_chunk": 11234567, @@ -71,6 +72,7 @@ "max_uncompressed_batch_bytes_size": 634880 }, "batch_proposer_config": { + "propose_interval_milliseconds": 1000, "max_l1_commit_gas_per_batch": 11234567, "max_l1_commit_calldata_size_per_batch": 112345, "batch_timeout_sec": 300, diff --git a/rollup/internal/config/l2.go b/rollup/internal/config/l2.go index 2b8cf6542c..f77187a445 100644 --- a/rollup/internal/config/l2.go +++ b/rollup/internal/config/l2.go @@ -26,6 +26,7 @@ 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"` MaxTxNumPerChunk uint64 `json:"max_tx_num_per_chunk"` MaxL1CommitGasPerChunk uint64 `json:"max_l1_commit_gas_per_chunk"` @@ -38,6 +39,7 @@ type ChunkProposerConfig struct { // BatchProposerConfig loads batch_proposer configuration items. type BatchProposerConfig struct { + ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"` MaxL1CommitGasPerBatch uint64 `json:"max_l1_commit_gas_per_batch"` MaxL1CommitCalldataSizePerBatch uint64 `json:"max_l1_commit_calldata_size_per_batch"` BatchTimeoutSec uint64 `json:"batch_timeout_sec"`