Skip to content

Commit 9973d99

Browse files
authored
Add batcher max channel duration (#118)
1 parent a9447a1 commit 9973d99

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

internal/components.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"io"
7+
"strconv"
78
"strings"
89
"time"
910
)
@@ -33,12 +34,16 @@ func (r *RollupBoost) Name() string {
3334
}
3435

3536
type OpBatcher struct {
36-
L1Node string
37-
L2Node string
38-
RollupNode string
37+
L1Node string
38+
L2Node string
39+
RollupNode string
40+
MaxChannelDuration uint64
3941
}
4042

4143
func (o *OpBatcher) Run(service *service, ctx *ExContext) {
44+
if o.MaxChannelDuration == 0 {
45+
o.MaxChannelDuration = 2
46+
}
4247
service.
4348
WithImage("us-docker.pkg.dev/oplabs-tools-artifacts/images/op-batcher").
4449
WithTag("v1.12.0-rc.1").
@@ -47,7 +52,7 @@ func (o *OpBatcher) Run(service *service, ctx *ExContext) {
4752
"--l1-eth-rpc", Connect(o.L1Node, "http"),
4853
"--l2-eth-rpc", Connect(o.L2Node, "http"),
4954
"--rollup-rpc", Connect(o.RollupNode, "http"),
50-
"--max-channel-duration=2",
55+
"--max-channel-duration="+strconv.FormatUint(o.MaxChannelDuration, 10),
5156
"--sub-safety-margin=4",
5257
"--poll-interval=1s",
5358
"--num-confirmations=1",

internal/recipe_opstack.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ type OpRecipe struct {
1818
// blockTime is the block time to use for the rollup
1919
// (default is 2 seconds)
2020
blockTime uint64
21+
22+
// batcherMaxChannelDuration is the maximum channel duration to use for the batcher
23+
// (default is 2 seconds)
24+
batcherMaxChannelDuration uint64
2125
}
2226

2327
func (o *OpRecipe) Name() string {
@@ -33,6 +37,7 @@ func (o *OpRecipe) Flags() *flag.FlagSet {
3337
flags.StringVar(&o.externalBuilder, "external-builder", "", "External builder URL")
3438
flags.Var(&nullableUint64Value{&o.enableLatestFork}, "enable-latest-fork", "Enable latest fork isthmus (nil or empty = disabled, otherwise enabled at specified block)")
3539
flags.Uint64Var(&o.blockTime, "block-time", defaultOpBlockTimeSeconds, "Block time to use for the rollup")
40+
flags.Uint64Var(&o.batcherMaxChannelDuration, "batcher-max-channel-duration", 2, "Maximum channel duration to use for the batcher")
3641
return flags
3742
}
3843

@@ -79,9 +84,10 @@ func (o *OpRecipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest {
7984
UseDeterministicP2PKey: o.externalBuilder != "",
8085
})
8186
svcManager.AddService("op-batcher", &OpBatcher{
82-
L1Node: "el",
83-
L2Node: "op-geth",
84-
RollupNode: "op-node",
87+
L1Node: "el",
88+
L2Node: "op-geth",
89+
RollupNode: "op-node",
90+
MaxChannelDuration: o.batcherMaxChannelDuration,
8591
})
8692
return svcManager
8793
}

0 commit comments

Comments
 (0)