-
Notifications
You must be signed in to change notification settings - Fork 70
fix: remove L1 eth rpc flag check #860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughReformatting of the L1NodeAddr flag definition in the flags configuration file with whitespace and indentation adjustments. The flag name and value remain functionally identical with no behavior changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@node/flags/flags.go`:
- Around line 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.
| 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"), | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
- All code paths check if the L1 RPC URL is empty before using it
- Appropriate error messages are returned when the flag is required but not provided
- 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.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.