From b93757b87cfe24b728bb6771abf0f1cfce97d143 Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Tue, 29 Apr 2025 09:46:19 +0100 Subject: [PATCH] Add batcher max channel duration --- internal/components.go | 13 +++++++++---- internal/recipe_opstack.go | 12 +++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/internal/components.go b/internal/components.go index 4a87d08..3fcdf82 100644 --- a/internal/components.go +++ b/internal/components.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "strconv" "strings" "time" ) @@ -33,12 +34,16 @@ func (r *RollupBoost) Name() string { } type OpBatcher struct { - L1Node string - L2Node string - RollupNode string + L1Node string + L2Node string + RollupNode string + MaxChannelDuration uint64 } func (o *OpBatcher) Run(service *service, ctx *ExContext) { + if o.MaxChannelDuration == 0 { + o.MaxChannelDuration = 2 + } service. WithImage("us-docker.pkg.dev/oplabs-tools-artifacts/images/op-batcher"). WithTag("v1.12.0-rc.1"). @@ -47,7 +52,7 @@ func (o *OpBatcher) Run(service *service, ctx *ExContext) { "--l1-eth-rpc", Connect(o.L1Node, "http"), "--l2-eth-rpc", Connect(o.L2Node, "http"), "--rollup-rpc", Connect(o.RollupNode, "http"), - "--max-channel-duration=2", + "--max-channel-duration="+strconv.FormatUint(o.MaxChannelDuration, 10), "--sub-safety-margin=4", "--poll-interval=1s", "--num-confirmations=1", diff --git a/internal/recipe_opstack.go b/internal/recipe_opstack.go index e58f24c..4f0febf 100644 --- a/internal/recipe_opstack.go +++ b/internal/recipe_opstack.go @@ -18,6 +18,10 @@ type OpRecipe struct { // blockTime is the block time to use for the rollup // (default is 2 seconds) blockTime uint64 + + // batcherMaxChannelDuration is the maximum channel duration to use for the batcher + // (default is 2 seconds) + batcherMaxChannelDuration uint64 } func (o *OpRecipe) Name() string { @@ -33,6 +37,7 @@ func (o *OpRecipe) Flags() *flag.FlagSet { flags.StringVar(&o.externalBuilder, "external-builder", "", "External builder URL") flags.Var(&nullableUint64Value{&o.enableLatestFork}, "enable-latest-fork", "Enable latest fork isthmus (nil or empty = disabled, otherwise enabled at specified block)") flags.Uint64Var(&o.blockTime, "block-time", defaultOpBlockTimeSeconds, "Block time to use for the rollup") + flags.Uint64Var(&o.batcherMaxChannelDuration, "batcher-max-channel-duration", 2, "Maximum channel duration to use for the batcher") return flags } @@ -79,9 +84,10 @@ func (o *OpRecipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest { UseDeterministicP2PKey: o.externalBuilder != "", }) svcManager.AddService("op-batcher", &OpBatcher{ - L1Node: "el", - L2Node: "op-geth", - RollupNode: "op-node", + L1Node: "el", + L2Node: "op-geth", + RollupNode: "op-node", + MaxChannelDuration: o.batcherMaxChannelDuration, }) return svcManager }