Skip to content

Commit bceec6b

Browse files
committed
apply suggestions
1 parent 69bd9b7 commit bceec6b

File tree

2 files changed

+17
-33
lines changed

2 files changed

+17
-33
lines changed

playground/components.go

Lines changed: 11 additions & 27 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,31 @@ 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
229225
L2BlockTime string
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-
}
230+
func (c *ChainMonitor) Apply(manifest *Manifest) {
231+
l1rpc := Connect(c.L1RPC, "http")
247232

248-
service.WithImage("ghcr.io/flashbots/chain-monitor").
249-
WithTag("v0.0.54").
233+
manifest.NewService("chain-monitor").
234+
WithPort("metrics", 8080).
235+
WithImage("ghcr.io/flashbots/chain-monitor").
236+
WithTag("v0.0.54").
237+
DependsOnHealthy(l1rpc).
238+
DependsOnHealthy(c.L2RPC).
250239
WithArgs(
251240
"serve",
252-
"--l1-rpc", c.L1RPC,
241+
"--l1-rpc", l1rpc,
253242
"--l2-block-time", c.L2BlockTime,
254243
"--l2-monitor-builder-address", c.L2BuilderAddress,
255-
"--l2-rpc", c.L2RPC,
256-
"--server-listen-address", serverListenAddress,
244+
"--l2-rpc", Connect(c.L2RPC, "http"),
257245
)
258246
}
259247

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

playground/recipe_opstack.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,16 @@ func (o *OpRecipe) Apply(svcManager *Manifest) {
184184
if o.enableChainMonitor {
185185
l2BlockTime := fmt.Sprintf("%ds", o.blockTime)
186186

187-
svcManager.AddService("chain-monitor", &ChainMonitor{
188-
L1RPC: Connect("el", "http"),
187+
svcManager.AddService(&ChainMonitor{
188+
L1RPC: "el",
189189
L2BlockTime: l2BlockTime,
190190
L2BuilderAddress: defaultL2BuilderAddress,
191-
L2RPC: Connect("op-geth", "http"),
191+
L2RPC: "op-geth",
192192
})
193193

194-
svcManager.MustGetService("chain-monitor").
195-
DependsOnHealthy("el").
196-
DependsOnHealthy("op-geth")
194+
// svcManager.MustGetService("chain-monitor").
195+
// DependsOnHealthy("el").
196+
// DependsOnHealthy("op-geth")
197197
}
198198

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

0 commit comments

Comments
 (0)