fix: remove ankr public RPC fallback from LibFork — fail loud on unset env#161
fix: remove ankr public RPC fallback from LibFork — fail loud on unset env#161thedavidmeister wants to merge 4 commits into
Conversation
…t env Closes #67 Co-Authored-By: Claude <noreply@anthropic.com>
Walkthrough
ChangesFlare RPC URL resolution
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
…_FORK [3b-attempt] rainix-sol-test.yaml maps secrets.RPC_URL_FLARE_FORK -> FLARE_RPC_URL in the job env; the test subprocess sees FLARE_RPC_URL, not RPC_URL_FLARE_FORK. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/fork/LibFork.sol`:
- Around line 8-10: Update the README.md file by locating the "Local environment
& CI" section and adding documentation for the FLARE_RPC_URL environment
variable. Include an explanation that developers must set the FLARE_RPC_URL
environment variable when running fork tests locally, and provide clear guidance
on how to configure this in their development setup. This ensures users are
aware of the requirement when setting up the project for the first time.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 805e5adf-d2d0-4b0a-8993-5cc6688a5c96
📒 Files selected for processing (1)
test/fork/LibFork.sol
| function rpcUrlFlare(Vm vm) internal view returns (string memory) { | ||
| return vm.envOr("RPC_URL_FLARE_FORK", string("https://rpc.ankr.com/flare")); | ||
| return vm.envString("FLARE_RPC_URL"); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify no references to old env var and find all callers
echo "=== Searching for references to old env var RPC_URL_FLARE_FORK ==="
rg -n 'RPC_URL_FLARE_FORK' --type=sol --type=yaml --type=md
echo -e "\n=== Finding all callers of rpcUrlFlare ==="
rg -n 'rpcUrlFlare' --type=sol -C2
echo -e "\n=== Checking for setup/README documentation ==="
fd -e md -i readme -x echo "File: {}" \; -x rg -l 'FLARE.*RPC|RPC.*FLARE|environment.*variable' {}Repository: rainlanguage/rain.flare
Length of output: 319
🏁 Script executed:
#!/bin/bash
# Corrected verification script
echo "=== Searching for old env var RPC_URL_FLARE_FORK ==="
rg 'RPC_URL_FLARE_FORK' --no-type-list 2>/dev/null || echo "No matches found"
echo -e "\n=== Finding all references to rpcUrlFlare ==="
rg 'rpcUrlFlare' -C 2
echo -e "\n=== Checking all Solidity files that might use LibFork ==="
rg 'LibFork|import.*Fork' --glob='*.sol'
echo -e "\n=== List all .sol files ==="
fd -e sol | head -20Repository: rainlanguage/rain.flare
Length of output: 13381
🏁 Script executed:
#!/bin/bash
# Check README.md content for FLARE_RPC_URL documentation
echo "=== Checking README.md for environment variable documentation ==="
cat README.md | grep -i -E 'FLARE.*RPC|RPC.*FLARE|environment|setup' || echo "No matches found in README.md"Repository: rainlanguage/rain.flare
Length of output: 160
🏁 Script executed:
#!/bin/bash
# Check full README.md for environment setup documentation
echo "=== Full README.md content (up to 100 lines) ==="
head -100 README.md | tail -50
echo -e "\n=== Searching README for FLARE or environment variables ==="
rg -i 'flare|environment|rpc|docker|setup' README.md | head -20Repository: rainlanguage/rain.flare
Length of output: 2017
Update README.md to document the FLARE_RPC_URL environment variable requirement.
The migration from RPC_URL_FLARE_FORK to FLARE_RPC_URL is complete—no references to the old env var remain, and all 20+ call sites of rpcUrlFlare() are properly using the new variable. However, the README.md "Local environment & CI" section does not document the FLARE_RPC_URL requirement for developers setting up local forks. Add this to the setup documentation so users know to set this env var when running fork tests locally.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@test/fork/LibFork.sol` around lines 8 - 10, Update the README.md file by
locating the "Local environment & CI" section and adding documentation for the
FLARE_RPC_URL environment variable. Include an explanation that developers must
set the FLARE_RPC_URL environment variable when running fork tests locally, and
provide clear guidance on how to configure this in their development setup. This
ensures users are aware of the requirement when setting up the project for the
first time.
Fork tests use vm.envOr("RPC_URL_FLARE_FORK", ankr_url) but rainix-sol-test.yaml
maps secrets.RPC_URL_FLARE_FORK to env var FLARE_RPC_URL. Fallback fires every
time and Ankr rate-limits the CI run. Use vm.envString("FLARE_RPC_URL") to match
the actual CI env var name (same fix as PR #161).
Co-Authored-By: Claude <noreply@anthropic.com>
Fork tests use vm.envOr("RPC_URL_FLARE_FORK", ankr_url) but rainix-sol-test.yaml
maps secrets.RPC_URL_FLARE_FORK to env var FLARE_RPC_URL. Fallback fires every
time and Ankr rate-limits the CI run. Use vm.envString("FLARE_RPC_URL") to match
the actual CI env var name (same fix as PR #161).
Co-Authored-By: Claude <noreply@anthropic.com>
Closes #67
LibFork.rpcUrlFlarepreviously usedvm.envOrwith a hard-coded public Ankr RPC URL as the fallback. This silently let fork tests run against a public endpoint withoutRPC_URL_FLARE_FORKbeing set, masking misconfigured CI environments and leaking rate-limit risk to a third-party URL.This PR switches to
vm.envStringso that an unsetRPC_URL_FLARE_FORKfails immediately with a clear error instead of silently using the Ankr default.Co-Authored-By: Claude noreply@anthropic.com
Summary by CodeRabbit