Skip to content

fix: remove ankr public RPC fallback from LibFork — fail loud on unset env#161

Open
thedavidmeister wants to merge 4 commits into
mainfrom
fix/issue-67-libfork-remove-ankr-default
Open

fix: remove ankr public RPC fallback from LibFork — fail loud on unset env#161
thedavidmeister wants to merge 4 commits into
mainfrom
fix/issue-67-libfork-remove-ankr-default

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Closes #67

LibFork.rpcUrlFlare previously used vm.envOr with a hard-coded public Ankr RPC URL as the fallback. This silently let fork tests run against a public endpoint without RPC_URL_FLARE_FORK being set, masking misconfigured CI environments and leaking rate-limit risk to a third-party URL.

This PR switches to vm.envString so that an unset RPC_URL_FLARE_FORK fails immediately with a clear error instead of silently using the Ankr default.

Co-Authored-By: Claude noreply@anthropic.com

Summary by CodeRabbit

  • Chores
    • Updated Flare RPC URL resolution to require explicit environment variable configuration, removing the previous default fallback behavior.

…t env

Closes #67

Co-Authored-By: Claude <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

LibFork.rpcUrlFlare is changed from vm.envOr("RPC_URL_FLARE_FORK", "https://rpc.ankr.com/flare") to vm.envString("FLARE_RPC_URL"), removing the hardcoded Ankr default and renaming the expected environment variable.

Changes

Flare RPC URL resolution

Layer / File(s) Summary
Replace envOr fallback with required envString
test/fork/LibFork.sol
rpcUrlFlare now calls vm.envString("FLARE_RPC_URL") instead of vm.envOr("RPC_URL_FLARE_FORK", <ankr_url>). The hardcoded Ankr endpoint default is removed and the env var name changes from RPC_URL_FLARE_FORK to FLARE_RPC_URL; an unset variable now reverts immediately rather than silently falling back.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main change: removing the Ankr hardcoded fallback from LibFork and switching to fail on unset environment variables.
Linked Issues check ✅ Passed The code change directly implements the structural fix from issue #67: removing the hardcoded Ankr default and replacing vm.envOr with vm.envString to fail loudly on unset RPC_URL_FLARE_FORK.
Out of Scope Changes check ✅ Passed The change is tightly scoped to the single issue requirement: only the LibFork.sol rpcUrlFlare helper is modified, changing envOr fallback to envString for immediate failure on missing env var.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-67-libfork-remove-ankr-default

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…_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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between f3569f9 and 906b922.

📒 Files selected for processing (1)
  • test/fork/LibFork.sol

Comment thread test/fork/LibFork.sol
Comment on lines 8 to 10
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");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 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 -20

Repository: 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 -20

Repository: 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.

thedavidmeister added a commit that referenced this pull request Jun 18, 2026
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>
thedavidmeister added a commit that referenced this pull request Jun 18, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[F20] [MEDIUM] Public ankr RPC default in LibFork makes the entire fork test suite depend on an unowned, mutable endpoint that no test or CI step pins

1 participant