feat: add chainbench grpc subcommand for Solana Yellowstone gRPC benchmarks#121
feat: add chainbench grpc subcommand for Solana Yellowstone gRPC benchmarks#121CSFeo wants to merge 1 commit into
chainbench grpc subcommand for Solana Yellowstone gRPC benchmarks#121Conversation
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughChangesThe PR adds gRPC benchmark integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant grpc_wrapper
participant chainbench_grpc
CLI->>grpc_wrapper: invoke grpc mode with arguments
grpc_wrapper->>grpc_wrapper: locate chainbench-grpc on PATH
grpc_wrapper->>chainbench_grpc: execute mode and forwarded arguments
chainbench_grpc-->>grpc_wrapper: return exit code
grpc_wrapper-->>CLI: exit with binary return code
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
chainbench/grpc.py (1)
31-31: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valueCatch
OSErrorfor robust binary execution.While
shutil.whichensures the binary exists and is marked as executable,subprocess.runcan still raise anOSError(e.g.,ENOEXECdue to a CPU architecture mismatch if a user downloads the wrong local binary). Catching this exception and raising aclick.ClickExceptionprovides a cleaner user experience than a raw Python traceback.🛠️ Proposed refactor to handle execution errors gracefully
- completed = subprocess.run([exe, mode, *args]) + try: + completed = subprocess.run([exe, mode, *args]) + except OSError as e: + raise click.ClickException(f"Failed to execute `{exe}`: {e}")🤖 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 `@chainbench/grpc.py` at line 31, Update the subprocess.run invocation in the binary execution flow to catch OSError, including execution failures such as incompatible binaries, and raise a click.ClickException with a clear error message instead of exposing the raw traceback. Preserve the existing command arguments and successful execution behavior.
🤖 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.
Nitpick comments:
In `@chainbench/grpc.py`:
- Line 31: Update the subprocess.run invocation in the binary execution flow to
catch OSError, including execution failures such as incompatible binaries, and
raise a click.ClickException with a clear error message instead of exposing the
raw traceback. Preserve the existing command arguments and successful execution
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e2d0096b-3629-490d-81d8-a08a120d0d99
📒 Files selected for processing (4)
DockerfileREADME.mdchainbench/grpc.pychainbench/main.py
…nchmarks Integrate the chainbench-grpc tool as a CLI invocation inside the ChainBench Docker image (per the Solana gRPC benchmarking initiative). - chainbench/grpc.py: `chainbench grpc <race|latency|throughput|slots|full>` Click subgroup. Thin pass-through — shells out to the bundled `chainbench-grpc` binary, forwards stdout/stderr + exit code; flags after the mode go straight to the binary (it owns its own validation and --help). Clear error if not on PATH. - chainbench/main.py: register the subgroup. - Dockerfile: Rust build stage builds chainbench-grpc from a pinned tag (v0.4.0) and copies the binary onto PATH in the prod image (protoc is vendored). - README: document the new `grpc` command. Tested: black/isort/flake8/mypy clean; the subcommand shells out to the real binary end to end (verified locally), with correct exit codes and a graceful "binary not found" message.
64da86e to
7e40a12
Compare
What
Adds a
chainbench grpcsubcommand for benchmarking Solana Yellowstone (Geyser)gRPC endpoints, and bundles the
chainbench-grpctool into the Docker image so it works out of the box.
How it works
chainbench/grpc.py— a Click subgroup with the five modes (race,latency,throughput,slots,full). It's a thin pass-through: itsubprocess-invokes the bundledchainbench-grpcbinary, forwards stdout /stderr and the exit code, and passes flags after the mode straight to the
binary (which owns its own validation and
--help). If the binary isn't onPATHit raises a clearClickException.chainbench/main.py— registers the subgroup (+4lines).Dockerfile— a Rust build stage compileschainbench-grpcfrom a pinnedtag (
v0.4.0;protocis vendored by the crate) and copies the binary to/usr/local/binin the prod image.README.md— documents the new command.Testing
black --check,isort --check,flake8,mypy— clean on the changed files.chainbench-grpcbinary onPATH, and confirmedchainbench grpc <mode>shells out to it (correct output + exit codes; graceful "not found" message
when the binary is absent).
Notes for maintainers
CSFeo/chainbench-grpcrepo, pinned to tag
v0.4.0via theCHAINBENCH_GRPC_REFbuild arg.chainbench-grpcunder thechainstacklabsorg, and the published image / Docker Hub ownership.
grpccommand output is the tool's own (console/JSON/CSV/HTML); it is notnormalized into the Locust report format.
Summary by CodeRabbit
New Features
chainbench grpccommands for race, latency, throughput, slots, and full benchmarking modes.chainbench-grpcexecutable.Documentation