Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions node/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ var (
}

L1NodeAddr = cli.StringFlag{
Name: "l1.rpc",
Usage: "Address of L1 User JSON-RPC endpoint to use (eth namespace required)",
EnvVar: prefixEnvVar("L1_ETH_RPC"),
Required: true,
Name: "l1.rpc",
Usage: "Address of L1 User JSON-RPC endpoint to use (eth namespace required)",
EnvVar: prefixEnvVar("L1_ETH_RPC"),
}
Comment on lines 63 to 67
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Verify that all usages handle the optional L1 RPC endpoint.

The Required: true field was removed from the L1NodeAddr flag, making the L1 RPC endpoint optional. This is a significant behavioral change that could cause runtime errors if code assumes this value is always present.

Run the following script to verify that all code using the L1NodeAddr flag properly handles the case where it's not provided:

#!/bin/bash
# Description: Find all usages of L1NodeAddr and verify error handling for missing values

# Search for direct references to L1NodeAddr flag
echo "=== Direct references to L1NodeAddr flag ==="
rg -n 'L1NodeAddr' --type=go -C 3

echo -e "\n=== Flag value access via context (l1.rpc) ==="
# Search for code accessing the flag value via CLI context
rg -n 'ctx\.String\("l1\.rpc"\)|ctx\.GlobalString\("l1\.rpc"\)' --type=go -C 5

echo -e "\n=== Environment variable usage ==="
# Search for uses of the environment variable
rg -n 'L1_ETH_RPC|MORPH_NODE_L1_ETH_RPC' --type=go -C 3

echo -e "\n=== L1 client initialization ==="
# Search for L1 client/RPC initialization that might use this flag
rg -nP --type=go -C 5 'L1.*[Cc]lient|NewL1|l1.*[Dd]ial|l1.*[Rr]pc'

Ensure that:

  1. All code paths check if the L1 RPC URL is empty before using it
  2. Appropriate error messages are returned when the flag is required but not provided
  3. There's a fallback mechanism or the flag is genuinely optional for certain node modes
🤖 Prompt for AI Agents
In `@node/flags/flags.go` around lines 63 - 67, The flag L1NodeAddr (Name:
"l1.rpc", EnvVar via prefixEnvVar("L1_ETH_RPC")) was made optional but callers
may still assume a non-empty value; audit all usages of L1NodeAddr and
ctx.String("l1.rpc")/ctx.GlobalString("l1.rpc") and ensure each code path
validates the string before dialing or constructing L1 clients (e.g., in
functions like NewL1Client, l1.Dial, or any L1 client initialization). If the
URL is required for a mode, add explicit checks that return a clear error when
empty; if the flag is legitimately optional, add safe fallbacks / noop behavior
where used and document which node modes allow omission. Also verify any code
relying on the environment variable (L1_ETH_RPC / MORPH_NODE_L1_ETH_RPC) handles
absence identically.


L1BeaconAddr = cli.StringFlag{
Expand Down
Loading