Skip to content

Commit c5c730a

Browse files
committed
apply suggestions
1 parent 69bd9b7 commit c5c730a

File tree

2 files changed

+16
-41
lines changed

2 files changed

+16
-41
lines changed

playground/components.go

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"io"
7-
"net"
87
"strconv"
98
"strings"
109
"time"
@@ -29,6 +28,7 @@ func (r *RollupBoost) Apply(manifest *Manifest) {
2928
service := manifest.NewService("rollup-boost").
3029
WithImage("docker.io/flashbots/rollup-boost").
3130
WithTag("v0.7.5").
31+
DependsOnHealthy(r.ELNode).
3232
WithArgs(
3333
"--rpc-host", "0.0.0.0",
3434
"--rpc-port", `{{Port "authrpc" 8551}}`,
@@ -220,47 +220,29 @@ func (w *WebsocketProxy) Apply(manifest *Manifest) {
220220
)
221221
}
222222

223-
func (w *WebsocketProxy) Name() string {
224-
return "websocket-proxy"
225-
}
226-
227223
type ChainMonitor struct {
228224
L1RPC string
229-
L2BlockTime string
225+
L2BlockTime uint64
230226
L2BuilderAddress string
231227
L2RPC string
232-
ServerListenAddress string
233228
}
234229

235-
func (c *ChainMonitor) Run(service *Service, ctx *ExContext) {
236-
serverListenAddress := c.ServerListenAddress
237-
if serverListenAddress == "" {
238-
serverListenAddress = "0.0.0.0:{{Port \"metrics\" 8080}}"
239-
}
240-
241-
// we need to extract the port to register this service as exposing metrics
242-
if _, portStr, err := net.SplitHostPort(serverListenAddress); err == nil {
243-
if portNum, err := strconv.Atoi(portStr); err == nil {
244-
service.WithPort("metrics", portNum)
245-
}
246-
}
247-
248-
service.WithImage("ghcr.io/flashbots/chain-monitor").
249-
WithTag("v0.0.54").
230+
func (c *ChainMonitor) Apply(manifest *Manifest) {
231+
manifest.NewService("chain-monitor").
232+
WithPort("metrics", 8080).
233+
WithImage("ghcr.io/flashbots/chain-monitor").
234+
WithTag("v0.0.54").
235+
DependsOnHealthy(c.L1RPC).
236+
DependsOnHealthy(c.L2RPC).
250237
WithArgs(
251238
"serve",
252-
"--l1-rpc", c.L1RPC,
253-
"--l2-block-time", c.L2BlockTime,
239+
"--l1-rpc", Connect(c.L1RPC, "http"),
240+
"--l2-block-time", fmt.Sprintf("%ds", c.L2BlockTime),
254241
"--l2-monitor-builder-address", c.L2BuilderAddress,
255-
"--l2-rpc", c.L2RPC,
256-
"--server-listen-address", serverListenAddress,
242+
"--l2-rpc", Connect(c.L2RPC, "http"),
257243
)
258244
}
259245

260-
func (c *ChainMonitor) Name() string {
261-
return "chain-monitor"
262-
}
263-
264246
type OpBatcher struct {
265247
L1Node string
266248
L2Node string

playground/recipe_opstack.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package playground
22

33
import (
4-
"fmt"
54
flag "github.com/spf13/pflag"
65
)
76

@@ -182,18 +181,12 @@ func (o *OpRecipe) Apply(svcManager *Manifest) {
182181
})
183182

184183
if o.enableChainMonitor {
185-
l2BlockTime := fmt.Sprintf("%ds", o.blockTime)
186-
187-
svcManager.AddService("chain-monitor", &ChainMonitor{
188-
L1RPC: Connect("el", "http"),
189-
L2BlockTime: l2BlockTime,
184+
svcManager.AddService(&ChainMonitor{
185+
L1RPC: "el",
186+
L2BlockTime: o.blockTime,
190187
L2BuilderAddress: defaultL2BuilderAddress,
191-
L2RPC: Connect("op-geth", "http"),
188+
L2RPC: "op-geth",
192189
})
193-
194-
svcManager.MustGetService("chain-monitor").
195-
DependsOnHealthy("el").
196-
DependsOnHealthy("op-geth")
197190
}
198191

199192
if svcManager.ctx.Contender.TargetChain == "" {

0 commit comments

Comments
 (0)