Skip to content

chore: depend on sentrix-proto crate, drop vendored proto#32

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

chore: depend on sentrix-proto crate, drop vendored proto#32
satyakwok merged 2 commits into
mainfrom
chore/depend-on-sentrix-proto-crate

Conversation

@satyakwok
Copy link
Copy Markdown
Member

@satyakwok satyakwok commented May 13, 2026

Why

The proto schema lived in four places (chain server, sdk-rs, sentrix-grpc-wasm, this repo). Drift had already started. The chain repo now ships a sibling `sentrix-proto` crate (sentrix-labs/sentrix#667 merged + published v0.1.0 to crates.io 2026-05-13) as the single source of truth.

This PR migrates explorer-v2 to consume `sentrix-proto` from crates.io. Same pattern landing in parallel for sdk-rs (Sentriscloud/sdk-rs#23) and sentrix-grpc-wasm (Sentriscloud/sentrix-grpc-wasm#17).

What

  • Drop `proto/sentrix.proto` (vendored copy)
  • Drop `build.rs` (tonic-build invocation + SSR-vs-WASM gating)
  • Drop `tonic-prost` + `prost` from `[dependencies]`
  • Drop `tonic-prost-build` + `prost-build` from `[build-dependencies]`
  • Add `sentrix-proto = "0.1"`
  • `src/grpc/mod.rs`: `pub mod pb { pub use sentrix_proto::; }` keeps existing `pb::` paths compiling

Net diff: -308 / +49 lines.

Test plan

  • Local: `cargo build` clean (native target)
  • Local: `cargo test --doc` clean
  • Local: `cargo clippy -- -D warnings` clean
  • CI: full check matrix (clippy, leptos build, fmt, codeql, dep-review, cargo-deny)

Summary by CodeRabbit

  • Refactor
    • gRPC protocol schema and generated types moved to a published external package; local proto files and build-time code generation were removed.
    • No changes to public APIs or runtime behavior; downstream interfaces remain compatible while build/configuration is simplified.

Replace the vendored proto/sentrix.proto + the build.rs tonic-build
invocation with a dependency on the standalone `sentrix-proto` crate
that the chain repo (sentrix-labs/sentrix) publishes to crates.io as
the single source of truth for the schema.

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 across the four consumers.

The `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` + `prost` from `[dependencies]` and `tonic-prost-build`
+ `prost-build` from `[build-dependencies]` — they're transitive through
`sentrix-proto` now. `tonic` stays for the codegen macros + transport.

The SSR-vs-WASM build-server gating that build.rs previously handled is
no longer relevant — `sentrix-proto` always builds with `build_server =
true` and tonic's `transport` feature stays gated behind the SSR
feature on this crate.

Tested locally: cargo build / test --doc / clippy -- -D warnings all clean.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

📝 Walkthrough

Walkthrough

This change removes local protobuf codegen and the proto contract: proto/sentrix.proto and the build.rs script were deleted, and Cargo build dependencies for prost/tonic codegen were removed. Cargo.toml now depends on the published sentrix-proto = { version = "0.1", default-features = false }. src/grpc/mod.rs was updated to re-export types from the sentrix_proto crate (pub use sentrix_proto::*) instead of including generated code via tonic::include_proto!.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Sentriscloud/sentrix-explorer-v2#25: Modifies the same gRPC/proto configuration points—Cargo dependencies and proto code generation infra, relevant to replacing local codegen with a shared sentrix-proto crate.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: depend on sentrix-proto crate, drop vendored proto' accurately and concisely describes the main change: adopting an external proto crate and removing vendored proto files.
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.
Description check ✅ Passed The pull request description is well-structured and comprehensive, covering the 'Why', 'What', and 'Test plan' sections as required by the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 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.

v0.1.0 of sentrix-proto pulled `tonic/transport` unconditionally, which
propagates a tokio-net / mio dep that doesn't compile for the
wasm32-unknown-unknown target — the leptos build emits both wasm
(browser bundle) and native (SSR) targets, so the wasm leg was failing.

v0.1.1 (sentrix-labs/sentrix#670) makes `transport` an opt-in feature.
Disable it here so the wasm target compiles. The SSR binary uses tonic
without the hyper Channel anyway; the browser uses tonic-web-wasm-client.

Tested locally:
- `cargo check` (native) clean
- `cargo check --target wasm32-unknown-unknown` clean
@satyakwok satyakwok merged commit 2ff2dee into main May 13, 2026
8 checks passed
satyakwok added a commit that referenced this pull request May 13, 2026
)

The proto schema was extracted into a standalone `sentrix-proto` crate
on crates.io (chain repo PR #667) and this app migrated to consume it
in PR #32 — local `proto/` + `build.rs` + tonic codegen are gone.

The Architecture diagram still showed:
  proto/sentrix.proto → build.rs / tonic-build → src/grpc/pb

Updated to reflect the current path:
  sentrix-proto crate → re-exported as `pb` in src/grpc/mod.rs

Includes the wasm-specific `default-features = false` note since the
transport feature gate is the whole reason that migration shipped.

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