Add prod deployment tests for MetaBoard on all supported networks#95
Add prod deployment tests for MetaBoard on all supported networks#95thedavidmeister merged 1 commit intomainfrom
Conversation
Fork each supported network and verify MetaBoard exists at the expected address with the correct code hash. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThis PR adds environment variable definitions to the CI workflow for multiple blockchain network RPC URLs and introduces production deployment validation tests that verify the MetaBoard contract is correctly deployed on Arbitrum, Base, Base Sepolia, Flare, and Polygon networks. Changes
Sequence DiagramsequenceDiagram
participant Test as Test Function
participant Fork as Network Fork
participant Env as Environment
participant Contract as Smart Contract
Test->>Env: Read RPC URL from CI_FORK_*_RPC_URL
Test->>Fork: Fork network using RPC URL
Env->>Test: Provide METABOARD_DEPLOYED_ADDRESS
Test->>Contract: Request code at address
Contract->>Test: Return code
Test->>Test: Assert code exists
Test->>Contract: Request code hash
Contract->>Test: Return code hash
Test->>Test: Assert hash matches METABOARD_DEPLOYED_CODEHASH
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/rainix.yaml (1)
50-60:⚠️ Potential issue | 🟠 MajorScope the new fork RPC URLs to
rainix-sol-testonly.Lines 54-58 inject five more network endpoints into a step that also runs Rust and static-analysis tasks. Those jobs do not need fork access, so this broadens the exposure of private/paid RPC credentials for no test benefit. Split the step or otherwise gate these env vars to the Solidity test task only.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/rainix.yaml around lines 50 - 60, The step "Run ${{ matrix.task }}" is exporting the CI_FORK_* RPC env vars for every matrix task; restrict those sensitive vars to only the Solidity test task by splitting the workflow: keep the existing generic step named Run ${{ matrix.task }} without the CI_FORK_* env vars for Rust/static-analysis, and add a separate step (e.g., Run solidity tests) that runs nix develop -c ${{ matrix.task }} but only for the solidity test (use if: matrix.task == 'sol-test' or a dedicated matrix entry) and include the five CI_FORK_* env variables (CI_FORK_ETH_RPC_URL, CI_FORK_ARB_RPC_URL, CI_FORK_BASE_RPC_URL, CI_FORK_BASE_SEPOLIA_RPC_URL, CI_FORK_FLARE_RPC_URL, CI_FORK_POLYGON_RPC_URL) and ETH_RPC_URL/ETHERSCAN_API_KEY there so only the Solidity test receives the fork RPC credentials.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/lib/deploy/LibMetaBoardDeploy.t.sol`:
- Around line 28-30: checkProdDeployment currently calls
vm.createSelectFork(vm.envString(envVar)) directly which will pass an empty
string in CI and produce a low-signal fork error; first read the env via
vm.envString(envVar) into a local, assert it is non-empty (e.g.
require(bytes(rpcUrl).length > 0, "missing RPC env: " + envVar) or revert with a
clear message) and only then call vm.createSelectFork(rpcUrl); reference the
function checkProdDeployment and the calls to vm.envString and
vm.createSelectFork to locate where to add the pre-check.
---
Outside diff comments:
In @.github/workflows/rainix.yaml:
- Around line 50-60: The step "Run ${{ matrix.task }}" is exporting the
CI_FORK_* RPC env vars for every matrix task; restrict those sensitive vars to
only the Solidity test task by splitting the workflow: keep the existing generic
step named Run ${{ matrix.task }} without the CI_FORK_* env vars for
Rust/static-analysis, and add a separate step (e.g., Run solidity tests) that
runs nix develop -c ${{ matrix.task }} but only for the solidity test (use if:
matrix.task == 'sol-test' or a dedicated matrix entry) and include the five
CI_FORK_* env variables (CI_FORK_ETH_RPC_URL, CI_FORK_ARB_RPC_URL,
CI_FORK_BASE_RPC_URL, CI_FORK_BASE_SEPOLIA_RPC_URL, CI_FORK_FLARE_RPC_URL,
CI_FORK_POLYGON_RPC_URL) and ETH_RPC_URL/ETHERSCAN_API_KEY there so only the
Solidity test receives the fork RPC credentials.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 251387ca-bd9e-4330-9c7e-2b48700634f8
📒 Files selected for processing (2)
.github/workflows/rainix.yamltest/lib/deploy/LibMetaBoardDeploy.t.sol
| function checkProdDeployment(string memory envVar) internal { | ||
| vm.createSelectFork(vm.envString(envVar)); | ||
| address deployed = LibMetaBoardDeploy.METABOARD_DEPLOYED_ADDRESS; |
There was a problem hiding this comment.
Fail fast on an unset RPC URL before calling createSelectFork.
Line 29 forks whatever comes back from vm.envString(envVar). In CI these vars are wired with '' fallbacks, so a missing secret turns into createSelectFork("") and surfaces as a low-signal fork error instead of naming the misconfigured env key.
Proposed fix
function checkProdDeployment(string memory envVar) internal {
- vm.createSelectFork(vm.envString(envVar));
+ string memory rpcUrl = vm.envString(envVar);
+ require(bytes(rpcUrl).length > 0, string.concat("Missing RPC URL: ", envVar));
+ vm.createSelectFork(rpcUrl);
address deployed = LibMetaBoardDeploy.METABOARD_DEPLOYED_ADDRESS;
assertTrue(deployed.code.length > 0, string.concat("MetaBoard not deployed: ", envVar));
assertEq(📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| function checkProdDeployment(string memory envVar) internal { | |
| vm.createSelectFork(vm.envString(envVar)); | |
| address deployed = LibMetaBoardDeploy.METABOARD_DEPLOYED_ADDRESS; | |
| function checkProdDeployment(string memory envVar) internal { | |
| string memory rpcUrl = vm.envString(envVar); | |
| require(bytes(rpcUrl).length > 0, string.concat("Missing RPC URL: ", envVar)); | |
| vm.createSelectFork(rpcUrl); | |
| address deployed = LibMetaBoardDeploy.METABOARD_DEPLOYED_ADDRESS; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@test/lib/deploy/LibMetaBoardDeploy.t.sol` around lines 28 - 30,
checkProdDeployment currently calls vm.createSelectFork(vm.envString(envVar))
directly which will pass an empty string in CI and produce a low-signal fork
error; first read the env via vm.envString(envVar) into a local, assert it is
non-empty (e.g. require(bytes(rpcUrl).length > 0, "missing RPC env: " + envVar)
or revert with a clear message) and only then call vm.createSelectFork(rpcUrl);
reference the function checkProdDeployment and the calls to vm.envString and
vm.createSelectFork to locate where to add the pre-check.
|
@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment: S/M/L PR Classification Guidelines:This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed. Small (S)Characteristics:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
|
Tip For best results, initiate chat on the files or code changes. SIZE=S |
Fork each supported network and verify MetaBoard exists at the expected address with the correct code hash.
Motivation
Solution
Checks
By submitting this for review, I'm confirming I've done the following:
Summary by CodeRabbit
Tests
Chores