-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add router and vrf oracle to validator cli #599
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThis 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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 |
Manual Deploy AvailableYou can trigger a manual deploy of this PR branch to testnet: Alternative: Comment
Comment updated automatically when the PR is synchronized. |
fd4657e to
099c6bf
Compare
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 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:
- Present in the src directory as .ts files
- Built to the lib directory during
npm run build- 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.tsdefinesVRF_ORACLE: "0.2.0"andRPC_ROUTER: "0.0.1", matching all corresponding optional dependencies inpackage.json. The wrapper scripts (vrfOracle.tsandrpcRouter.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.tscontains aVERSIONSconstant that is already synchronized with the optional dependencies inpackage.json:
EPHEMERAL_VALIDATOR: "0.2.3"matches allephemeral-validator-*packagesRPC_ROUTER: "0.0.1"matches allrpc-router-*packagesVRF_ORACLE: "0.2.0"matches allvrf-oracle-*packagesAll wrapper scripts (
ephemeralValidator.ts,rpcRouter.ts,vrfOracle.ts) properly import and reference theVERSIONSconstant 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.
| 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); |
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.
🧹 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.
| 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.
Summary by CodeRabbit
Release Notes
New Features
Chores
How to test