Skip to content

chore(grpc): depend on sentrix-proto crate, drop vendored proto#23

Merged
satyakwok merged 3 commits into
mainfrom
chore/depend-on-sentrix-proto-crate
May 13, 2026
Merged

chore(grpc): depend on sentrix-proto crate, drop vendored proto#23
satyakwok merged 3 commits into
mainfrom
chore/depend-on-sentrix-proto-crate

Conversation

@satyakwok
Copy link
Copy Markdown
Member

@satyakwok satyakwok commented May 13, 2026

🚧 Draft — blocked on `cargo publish -p sentrix-proto` from sentrix-labs/sentrix. CI will fail until the publish lands. Mark ready-for-review once the chain repo's sentrix-proto v0.1.0 is on crates.io.

Why

The proto schema currently lives in three places (sdk-rs vendored copy, chain server's vendored copy, sentrix-grpc-wasm's vendored copy). Drift had already started — sdk-rs's proto was 8897 bytes, the chain server's 8979 bytes as of 2026-05-13.

Cosmos solved this exact problem with `ibc-proto` on crates.io. The sentrix-labs/sentrix repo now ships a sibling `sentrix-proto` crate (PR sentrix-labs/sentrix#667 merged) that becomes the single source of truth.

What

  • Drop `proto/sentrix.proto` (vendored copy)
  • Drop `src/grpc/pb.rs` (~560 lines of pre-generated prost code)
  • Drop `tonic-prost` + `prost` from `[dependencies]` (now transitive via sentrix-proto)
  • Add `sentrix-proto = "0.1"` under the `grpc` feature
  • `src/grpc/mod.rs` keeps `pub mod pb { pub use sentrix_proto::; }` so existing consumers that path-into `sentrix_chain::grpc::pb::` don't break

Net diff: -821 / +13 lines.

Test plan

  • Local: `cargo build --features grpc` clean (with path-dep)
  • Local: `cargo test --doc --features grpc` clean
  • Local: `cargo clippy --features grpc --all-targets -- -D warnings` clean
  • CI: blocks on sentrix-proto publish

After publish

  1. CI re-runs and goes green
  2. Bump `sentrix-chain` 0.1.0-alpha.0 → 0.2.0-alpha.0 (follow-up commit on this branch)
  3. Merge
  4. Re-publish `sentrix-chain` 0.2.0-alpha.0 to crates.io

The `sentrix-grpc-wasm` and `sentrix-explorer-v2` repos get equivalent migration PRs in parallel.

Summary by CodeRabbit

  • Refactor
    • Switched gRPC protobuf types to a published external package, replacing local generated protobufs and simplifying dependency wiring.
  • Chores
    • CI now installs the protobuf compiler to ensure protobuf tooling is available during builds and checks.

Replace the vendored proto/sentrix.proto + the pre-generated src/grpc/pb.rs
(~560 lines) with a dependency on the standalone `sentrix-proto` crate
that the chain repo (sentrix-labs/sentrix) publishes to crates.io.

This is the Cosmos `ibc-proto` pattern: one repo owns the .proto, every
consumer pulls the same generated types from crates.io. Eliminates the
schema drift that had already started (sdk-rs proto was 8897B, the chain
server's was 8979B as of 2026-05-13).

The `sentrix_chain::grpc::pb` module stays as a thin re-export of
`sentrix_proto`, so existing consumers that path-into pb don't churn:

    pub mod pb { pub use sentrix_proto::*; }

Drops `tonic-prost` and `prost` from this crate's deps — they're now
transitive through `sentrix-proto`. `tonic` stays for the transport
layer.

Tested locally with a path-dep against the chain repo's sentrix-proto
crate: `cargo build/test/clippy --features grpc` all clean.

NOTE: CI will fail on this PR until `cargo publish -p sentrix-proto`
runs from the chain repo. The version bump on this crate
(`0.1.0-alpha.0` → `0.2.0-alpha.0`) ships in a follow-up commit so
the publish + this PR's merge land together.
@satyakwok satyakwok marked this pull request as ready for review May 13, 2026 16:46
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2700e8f6-5deb-4a2f-b882-a62c7b28766f

📥 Commits

Reviewing files that changed from the base of the PR and between e216c9a and 2b96aae.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (1)
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

This PR migrates gRPC protobuf definitions from a locally-maintained proto file to an external published crate sentrix-proto. The grpc feature in Cargo.toml now depends on sentrix-proto and removes tonic-prost/prost optional deps. The local proto/sentrix.proto and generated bindings src/grpc/pb.rs are deleted. src/grpc/mod.rs is updated to re-export sentrix_proto::* as the pb module, preserving the public module path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Sentriscloud/sdk-rs#15: Both PRs modify the gRPC feature/dependency wiring and update the gRPC bindings layer to use external proto sources instead of local generation.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: migrating from vendored proto definitions to the sentrix-proto crate dependency.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering motivation, what changed, test plan, and post-publish steps, though it uses a non-standard format rather than the template's contract/test/deploy-focused structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 chore/depend-on-sentrix-proto-crate

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

Copy link
Copy Markdown

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/grpc/mod.rs (1)

12-15: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Stale documentation references removed pb.rs and defunct tooling.

These lines describe the old vendored approach:

  • "proto types are pre-generated + committed (pb.rs is checked in)" — pb.rs is deleted in this PR
  • "Regenerate via cargo run --bin gen-grpc" — this binary no longer applies since types come from sentrix-proto

Update to reflect the new sourcing model.

📝 Suggested doc update
-//! The proto types are pre-generated + committed (`pb.rs` is checked
-//! in) so consumers don't need `protoc` installed. Regenerate via
-//! `cargo run --bin gen-grpc` if the upstream chain bumps the proto
-//! (planned tooling — not shipped in alpha.0).
+//! The proto types are sourced from the [`sentrix-proto`] crate
+//! (published from `sentrix-labs/sentrix`), so consumers don't need
+//! `protoc` installed. Schema updates arrive via crate version bumps.
🤖 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 `@src/grpc/mod.rs` around lines 12 - 15, Update the module documentation at the
top of src/grpc/mod.rs to remove the stale references to a vendored pb.rs and
the defunct gen-grpc binary; replace that paragraph to state that proto types
are sourced from the sentrix-proto crate (or otherwise pulled from
sentrix-proto) and provide brief guidance on how to regenerate or update proto
types via that crate instead of mentioning `pb.rs` or `cargo run --bin
gen-grpc`, ensuring the new doc lives in the existing module doc comment block.
🤖 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.

Outside diff comments:
In `@src/grpc/mod.rs`:
- Around line 12-15: Update the module documentation at the top of
src/grpc/mod.rs to remove the stale references to a vendored pb.rs and the
defunct gen-grpc binary; replace that paragraph to state that proto types are
sourced from the sentrix-proto crate (or otherwise pulled from sentrix-proto)
and provide brief guidance on how to regenerate or update proto types via that
crate instead of mentioning `pb.rs` or `cargo run --bin gen-grpc`, ensuring the
new doc lives in the existing module doc comment block.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f7227253-480b-4394-987b-1073012b98e0

📥 Commits

Reviewing files that changed from the base of the PR and between 611ac62 and e216c9a.

📒 Files selected for processing (4)
  • Cargo.toml
  • proto/sentrix.proto
  • src/grpc/mod.rs
  • src/grpc/pb.rs
💤 Files with no reviewable changes (2)
  • proto/sentrix.proto
  • src/grpc/pb.rs

sentrix-proto's build.rs invokes protoc to generate tonic types at
consumer build time. The previous CI run failed with "Could not find
`protoc`" because ubuntu-22.04 doesn't ship it by default.

Add `apt-get install protobuf-compiler` step and refresh Cargo.lock to
0.1.1 (which adds the wasm-friendly `transport` feature gate, not
needed by sdk-rs but already published upstream).
@satyakwok satyakwok merged commit 79222ea into main May 13, 2026
5 checks passed
satyakwok added a commit that referenced this pull request May 13, 2026
Three stale claims fixed after the sentrix-proto extraction landed
(PR #23 merged):

1. **grpc surface row** said "Pre-generated proto types committed; no
   protoc needed by consumers". src/grpc/pb.rs is gone — the grpc
   feature now depends on sentrix-proto from crates.io. Updated to
   reflect the new dep + the protoc build-time requirement.

2. **Status section** claimed "EVM (alloy) and gRPC (tonic) modules
   are doors-only stubs". Both are functional — SentrixGrpcClient
   has connect / get_latest_block / get_balance / get_validator_set /
   get_supply / get_mempool / subscribe_events all live in
   src/grpc/mod.rs. Reframed to "all six doors compile + have working
   client paths".

3. **Roadmap "Published to crates.io once feature surface stabilises"**
   was already published — checkbox was lying. Replaced with a
   forward-looking "next: surface stabilisation toward 1.0" line.

Co-authored-by: satyakwok <satyakwok@users.noreply.github.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.

1 participant