Skip to content

Commit

Permalink
op-node: Add --l2.engine-rpc-timeout flag
Browse files Browse the repository at this point in the history
Add a new --l2.engine-rpc-timeout flag to configure the timeout duration for L2 Engine RPC calls. This allows for more flexible and explicit control over RPC call timeouts.
  • Loading branch information
pengin7384 authored and protolambda committed Feb 4, 2025
1 parent de17b70 commit aa8f8f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions op-node/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ var (
}(),
Category: RollupCategory,
}
L2EngineRpcTimeout = &cli.DurationFlag{
Name: "l2.engine-rpc-timeout",
Usage: "L2 engine client rpc timeout",
EnvVars: prefixEnvVars("L2_ENGINE_RPC_TIMEOUT"),
Value: time.Second * 10,
Category: RollupCategory,
}
VerifierL1Confs = &cli.Uint64Flag{
Name: "verifier.l1-confs",
Usage: "Number of L1 blocks to keep distance from the L1 head before deriving L2 data from. Reorgs are supported, but may be slow to perform.",
Expand Down Expand Up @@ -459,6 +466,7 @@ var optionalFlags = []cli.Flag{
ConductorRpcTimeoutFlag,
SafeDBPath,
L2EngineKind,
L2EngineRpcTimeout,
InteropSupervisor,
InteropRPCAddr,
InteropRPCPort,
Expand Down
5 changes: 5 additions & 0 deletions op-node/node/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ type L2EndpointConfig struct {
// JWT secrets for L2 Engine API authentication during HTTP or initial Websocket communication.
// Any value for an IPC connection.
L2EngineJWTSecret [32]byte

// L2EngineCallTimeout is the default timeout duration for L2 calls.
// Defines the maximum time a call to the L2 engine is allowed to take before timing out.
L2EngineCallTimeout time.Duration
}

var _ L2EndpointSetup = (*L2EndpointConfig)(nil)
Expand All @@ -67,6 +71,7 @@ func (cfg *L2EndpointConfig) Setup(ctx context.Context, log log.Logger, rollupCf
opts := []client.RPCOption{
client.WithGethRPCOptions(auth),
client.WithDialAttempts(10),
client.WithCallTimeout(cfg.L2EngineCallTimeout),
}
l2Node, err := client.NewRPC(ctx, log, cfg.L2EngineAddr, opts...)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions op-node/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ func NewL2EndpointConfig(ctx *cli.Context, logger log.Logger) (*node.L2EndpointC
if err != nil {
return nil, err
}
l2RpcTimeout := ctx.Duration(flags.L2EngineRpcTimeout.Name)
return &node.L2EndpointConfig{
L2EngineAddr: l2Addr,
L2EngineJWTSecret: secret,
L2EngineAddr: l2Addr,
L2EngineJWTSecret: secret,
L2EngineCallTimeout: l2RpcTimeout,
}, nil
}

Expand Down

0 comments on commit aa8f8f7

Please sign in to comment.