Skip to content

Conversation

@lucacillario
Copy link
Contributor

@lucacillario lucacillario commented Oct 29, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added CLI commands for RPC Router and VRF Oracle
    • Extended platform support to include Linux and macOS binaries for RPC Router and VRF Oracle
  • Chores

    • Bumped package version to 0.2.5
    • Added platform-specific optional dependencies

How to test

npm install -g @magicblock-labs/ephemeral-validator@0.2.5
rpc-router
vrf-oracle

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

Walkthrough

This PR introduces a multi-platform binary distribution system for three CLI tools. It centralizes version management in a new constants module, updates package.json to include CLI entry points and platform-specific optional dependencies, and implements wrapper scripts for rpc-router and vrf-oracle with binary resolution and version validation logic.

Changes

Cohort / File(s) Summary
Version Management
versions.ts, .github/packages/npm-package/ephemeralValidator.ts
Introduces centralized version constants module for three tools (ephemeral-validator 0.2.3, rpc-router 0.0.1, vrf-oracle 0.2.0). Updates ephemeralValidator to import from this module instead of package.json.
Package Configuration
package.json
Bumps version to 0.2.5. Adds CLI entry points for rpc-router and vrf-oracle. Adds platform-specific optional dependencies for VRF Oracle and RPC Router (linux-x64, linux-arm64, darwin-x64, darwin-arm64); preserves Windows Ephemeral Validator.
CLI Wrapper Scripts
rpcRouter.ts, vrfOracle.ts
Introduces two new TypeScript wrapper scripts that locate and execute platform-specific binaries. Both attempt packaged binary resolution first, then fall back to global PATH lookup with version validation against PACKAGE_VERSION. Implement proper signal forwarding and exit code propagation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Wrapper as CLI Wrapper<br/>(rpcRouter/vrfOracle)
    participant Package as Packaged Binary
    participant Global as Global Binary<br/>(PATH)
    
    User->>Wrapper: Invoke CLI with args
    Wrapper->>Package: Attempt to resolve & execute
    
    alt Package Binary Found
        Package->>Wrapper: Execute successfully
        Wrapper->>User: Forward exit code/signal
    else Package Binary Not Found
        Wrapper->>Global: Search PATH for global binary
        alt Global Binary Found
            Wrapper->>Global: Get version
            alt Version Matches PACKAGE_VERSION
                Global->>Wrapper: Execute successfully
                Wrapper->>User: Forward exit code/signal
            else Version Mismatch
                Wrapper->>User: Error: version mismatch
            end
        else Global Binary Not Found
            Wrapper->>User: Error: binary not found
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Binary resolution logic in wrapper scripts: Verify correct OS/architecture detection, path resolution for both packaged and global binaries, and proper error handling for missing binaries
  • Version validation: Confirm version matching logic between global binary and PACKAGE_VERSION constant is correct and handles all edge cases
  • Optional dependencies mapping: Verify package.json optional dependencies correctly target all supported platforms and versions align with versions.ts constants
  • Signal and exit code forwarding: Review SIGINT/SIGTERM handling and exit code propagation in wrapper scripts to ensure clean termination

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: add router and vrf oracle to validator cli" directly and accurately describes the primary changes in the changeset. The PR introduces two new CLI entry points (rpc-router and vrf-oracle) to the npm package's bin configuration, along with wrapper scripts (rpcRouter.ts and vrfOracle.ts) that enable their execution from the command line. The title is concise, specific, and clearly conveys the main objective to someone scanning the repository history. While supporting changes like the version bump and new versions.ts file are present, the title appropriately focuses on the primary feature addition rather than enumeration of all details.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-router-and-vrf-to-cli

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.

@github-actions
Copy link

github-actions bot commented Oct 29, 2025

Manual Deploy Available

You can trigger a manual deploy of this PR branch to testnet:

Deploy to Testnet 🚀

Alternative: Comment /deploy on this PR to trigger deployment directly.

⚠️ Note: Manual deploy requires authorization. Only authorized users can trigger deployments.

Comment updated automatically when the PR is synchronized.

@lucacillario lucacillario force-pushed the feat/add-router-and-vrf-to-cli branch from fd4657e to 099c6bf Compare October 29, 2025 18:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e2d817 and 099c6bf.

📒 Files selected for processing (5)
  • .github/packages/npm-package/ephemeralValidator.ts (1 hunks)
  • .github/packages/npm-package/package.json (3 hunks)
  • .github/packages/npm-package/rpcRouter.ts (1 hunks)
  • .github/packages/npm-package/versions.ts (1 hunks)
  • .github/packages/npm-package/vrfOracle.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
.github/packages/npm-package/ephemeralValidator.ts (1)
.github/packages/npm-package/versions.ts (1)
  • VERSIONS (1-5)
.github/packages/npm-package/rpcRouter.ts (1)
.github/packages/npm-package/versions.ts (1)
  • VERSIONS (1-5)
.github/packages/npm-package/vrfOracle.ts (1)
.github/packages/npm-package/versions.ts (1)
  • VERSIONS (1-5)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: run_make_ci_lint
  • GitHub Check: run_make_ci_format
🔇 Additional comments (4)
.github/packages/npm-package/package.json (4)

14-19: Verify wrapper scripts are built and present in package output.

New bin entries reference rpcRouter.js, vrfOracle.js, and mbTestValidator.js (lines 17-18, 16), which should be compiled TypeScript wrapper scripts. Ensure these are:

  1. Present in the src directory as .ts files
  2. Built to the lib directory during npm run build
  3. Included in the published npm package

38-45: Clarify platform coverage gap for new CLI tools.

VRF Oracle and RPC Router optional dependencies only support Linux and Darwin platforms (x64 and arm64), while the Ephemeral Validator includes a Windows x64 binary. This asymmetry may indicate:

  • Windows support for RPC Router and VRF Oracle is intentionally unsupported, or
  • Windows binaries are not yet available and should be added

Clarify the intended platform support matrix for these tools, especially if users on Windows expect feature parity with the Ephemeral Validator.


38-45: Versions are correctly aligned—no action required.

Verification confirms that versions.ts defines VRF_ORACLE: "0.2.0" and RPC_ROUTER: "0.0.1", matching all corresponding optional dependencies in package.json. The wrapper scripts (vrfOracle.ts and rpcRouter.ts) correctly import and use these constants for runtime version validation, so no mismatches exist.


3-3: No sync issue exists—versions are already properly aligned.

The review comment raises concerns about version skew and version synchronization, but verification shows the codebase already implements proper version management:

  • versions.ts contains a VERSIONS constant that is already synchronized with the optional dependencies in package.json:

    • EPHEMERAL_VALIDATOR: "0.2.3" matches all ephemeral-validator-* packages
    • RPC_ROUTER: "0.0.1" matches all rpc-router-* packages
    • VRF_ORACLE: "0.2.0" matches all vrf-oracle-* packages
  • All wrapper scripts (ephemeralValidator.ts, rpcRouter.ts, vrfOracle.ts) properly import and reference the VERSIONS constant for validation and display.

  • The main package version (0.2.5) is intentionally separate from individual tool versions by design—this is not an oversight but an architectural choice where each tool maintains its own version while the umbrella package version tracks overall releases.

The review comment's premise is incorrect; no action is required.

Likely an incorrect or invalid review comment.

Comment on lines +53 to +59
function runRpcRouter(location: string): void {
const args = process.argv.slice(2);
const env = {
...process.env,
};
const ephemeralValidator = spawn(location, args, { stdio: "inherit", env});
runWithForwardedExit(ephemeralValidator);
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Rename the child process handle for clarity.

This wrapper still calls the spawned process ephemeralValidator, which is a leftover from copy/paste. Rename it to rpcRouter so the code reflects what is actually being launched.

Apply this diff to address the issue:

-  const ephemeralValidator = spawn(location, args, { stdio: "inherit", env});
-  runWithForwardedExit(ephemeralValidator);
+  const rpcRouter = spawn(location, args, { stdio: "inherit", env });
+  runWithForwardedExit(rpcRouter);
📝 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.

Suggested change
function runRpcRouter(location: string): void {
const args = process.argv.slice(2);
const env = {
...process.env,
};
const ephemeralValidator = spawn(location, args, { stdio: "inherit", env});
runWithForwardedExit(ephemeralValidator);
function runRpcRouter(location: string): void {
const args = process.argv.slice(2);
const env = {
...process.env,
};
const rpcRouter = spawn(location, args, { stdio: "inherit", env });
runWithForwardedExit(rpcRouter);
🤖 Prompt for AI Agents
In .github/packages/npm-package/rpcRouter.ts around lines 53 to 59, the spawned
child process variable is mistakenly named ephemeralValidator from a copy/paste;
rename that variable to rpcRouter for clarity and to reflect the actual process
being launched, updating its declaration and the subsequent runWithForwardedExit
call to use rpcRouter instead of ephemeralValidator.

@lucacillario lucacillario marked this pull request as draft October 29, 2025 18:26
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.

2 participants