From eadbc9480a99cb055c0ba7f911924f2770858b77 Mon Sep 17 00:00:00 2001 From: satyakwok Date: Wed, 13 May 2026 18:32:22 +0200 Subject: [PATCH 1/4] chore: depend on sentrix-proto crate, drop vendored proto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. 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 `sentrix_grpc_wasm::pb::*` don't churn: pub mod pb { pub use sentrix_proto::*; } Drops `tonic-prost` + `prost` + `tonic-prost-build` from explicit deps — they're transitive through `sentrix-proto` now. `tonic` stays for the codegen macros + transport. Tested locally with a path-dep against the chain repo's sentrix-proto crate: `cargo build / test --doc / clippy --all-targets -- -D warnings` all clean. NOTE: CI will fail on this PR until `cargo publish -p sentrix-proto` runs from the chain repo. --- Cargo.toml | 9 +- build.rs | 16 --- proto/sentrix.proto | 256 -------------------------------------------- src/lib.rs | 7 +- 4 files changed, 9 insertions(+), 279 deletions(-) delete mode 100644 build.rs delete mode 100644 proto/sentrix.proto diff --git a/Cargo.toml b/Cargo.toml index 119ed22..80d8145 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,14 +14,13 @@ readme = "README.md" crate-type = ["cdylib", "rlib"] [dependencies] +# Proto types come from the published `sentrix-proto` crate (the chain +# repo's source of truth). Drops `tonic-prost` / `prost` from explicit +# deps — they're transitive through `sentrix-proto` now. +sentrix-proto = "0.1" tonic = { version = "0.14", default-features = false, features = ["codegen"] } -tonic-prost = "0.14" tonic-web-wasm-client = "0.9" -prost = "0.14" hex = "0.4" -[build-dependencies] -tonic-prost-build = { version = "0.14", default-features = false } - [lints.rust] unsafe_code = "forbid" diff --git a/build.rs b/build.rs deleted file mode 100644 index 9fc61f2..0000000 --- a/build.rs +++ /dev/null @@ -1,16 +0,0 @@ -// tonic-build invokes protoc at compile time to generate the -// `sentrix.v1` Rust module from `proto/sentrix.proto`. We disable -// server codegen — this crate is browser-only, no need for the -// service stub. - -fn main() -> Result<(), Box> { - // proto/sentrix.proto uses proto3 `optional` (eg - // GetValidatorSetRequest.at_height). protoc 3.15+ accepts this by - // default; ubuntu-22.04 still ships 3.12.4 in apt and needs the - // flag. Harmless on newer protoc. - tonic_prost_build::configure() - .build_server(false) - .protoc_arg("--experimental_allow_proto3_optional") - .compile_protos(&["proto/sentrix.proto"], &["proto"])?; - Ok(()) -} diff --git a/proto/sentrix.proto b/proto/sentrix.proto deleted file mode 100644 index 65c907d..0000000 --- a/proto/sentrix.proto +++ /dev/null @@ -1,256 +0,0 @@ -syntax = "proto3"; - -// Sentrix gRPC service v0.1 — package sentrix.v1. -// -// Parallel transport to JSON-RPC at port 8545. Same backend, same state, -// different wire format. Methods here mirror the most common JSON-RPC paths -// plus add a server-streaming variant for events that JSON-RPC + WebSocket -// can express but at a higher per-subscriber cost. -// -// Versioning: "sentrix.v1" is a hard contract. Breaking changes go to -// "sentrix.v2" with v1 retained for ≥ 2 minor releases overlap. -// -// Status: v0.1 skeleton. Handlers in crates/sentrix-grpc/src/lib.rs return -// tonic::Status::unimplemented until main.rs integration lands. - -package sentrix.v1; - -// 20-byte EVM-compatible address. Mirror of sentrix-primitives::Address. -// Wire = bytes (NOT hex string) for binary efficiency. -message Address { - bytes value = 1; // exactly 20 bytes -} - -// 32-byte hash — block hash, tx hash, state root. -message Hash { - bytes value = 1; // exactly 32 bytes -} - -// Native amount — sentri (10^-8 SRX). u64 wire to match Sentrix internal. -message Amount { - uint64 sentri = 1; -} - -// Block height — u64 starting at 0 (genesis). -message BlockHeight { - uint64 value = 1; -} - -// Mirror of sentrix-primitives::Transaction. Identical wire format to chain -// MDBX serialisation (modulo prost-encoding). Field numbers match the -// canonical struct order; do NOT renumber on changes. -message Transaction { - Hash txid = 1; - Address from_address = 2; - Address to_address = 3; - Amount amount = 4; - Amount fee = 5; - uint64 nonce = 6; - uint64 timestamp = 7; - bytes signature = 8; // 64-byte ed25519 OR 65-byte secp256k1 - bytes payload = 9; // contract calldata (EVM) or staking-op blob - uint32 chain_id = 10; - uint32 tx_type = 11; // 0 = transfer, 1 = contract, 2 = staking-op -} - -message Block { - uint64 index = 1; - Hash hash = 2; - Hash parent_hash = 3; - Hash state_root = 4; - uint64 timestamp = 5; - Address proposer = 6; - uint32 round = 7; - repeated Transaction transactions = 8; - // BFT justification carried from validator-side; included for audit. - // Empty for blocks at h<100_000 (pre state-root-fork). - bytes justification = 9; -} - -message Account { - Address address = 1; - Amount balance = 2; - uint64 nonce = 3; - // For contract accounts: 32-byte storage root + non-empty code_hash. - Hash storage_root = 4; - Hash code_hash = 5; -} - -// Server-streaming event types. -message ChainEvent { - oneof event { - BlockFinalized block_finalized = 1; - PendingTx pending_tx = 2; - ValidatorSetChange validator_set_change = 3; - LogEmitted log = 4; - // Synthetic Lagged sentinel — emitted when the per-subscriber broadcast - // channel drops oldest events (slow consumer). Mirrors tokio broadcast - // RecvError::Lagged semantics. Consumer should resync state from RPC. - StreamLagged lagged = 5; - } - uint64 sequence = 100; // monotonic across all events on this stream - uint64 timestamp = 101; // server-wall-clock unix seconds -} - -message BlockFinalized { Block block = 1; } -message PendingTx { Transaction tx = 1; } - -message ValidatorSetChange { - uint32 epoch = 1; - repeated Address active = 2; - repeated Address jailed = 3; -} - -message LogEmitted { - Address contract = 1; - repeated Hash topics = 2; // 0..4 topics per EVM convention - bytes data = 3; - Hash tx_hash = 4; - uint64 block_height = 5; - uint32 log_index = 6; -} - -message StreamLagged { - uint64 skipped_count = 1; // events dropped since last delivery -} - -// ──────────────────────────────────────────────────────────── -// Service definition -// ──────────────────────────────────────────────────────────── -service Sentrix { - // Submit a signed transaction to the local mempool. Same semantics as - // JSON-RPC eth_sendRawTransaction for EVM txs, with native fields exposed - // for staking-ops and other native variants. - rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse); - - // Fetch a block by height OR by hash. Returns NOT_FOUND if outside the - // local chain window (currently 1000 blocks; older blocks need indexer). - rpc GetBlock(GetBlockRequest) returns (Block); - - // Fetch account balance + nonce. Mirrors eth_getBalance + - // eth_getTransactionCount in a single round-trip. Includes mempool-pending - // nonce so wallets build correct next-tx without an extra call (matches - // the pending-aware nonce behaviour from chain v2.1.57). - rpc GetBalance(GetBalanceRequest) returns (Account); - - // v0.4 read-only state queries — drop the REST `/sentrix_status_extended` - // bridge from the explorer's stats hot path. All three are pure reads - // off `state.read()` snapshots; same lock contention profile as - // GetBlock/GetBalance. - // - // Active validator set + per-validator stake/active/jailed flags. - rpc GetValidatorSet(GetValidatorSetRequest) returns (ValidatorSet); - // Native-token supply snapshot (minted, burned, circulating). - rpc GetSupply(GetSupplyRequest) returns (Supply); - // Pending-tx count + a capped header window for UI display. - rpc GetMempool(GetMempoolRequest) returns (Mempool); - - // Server-streaming chain events. Subscribe once, receive every event type - // until cancel or server restart. Replaces N separate eth_subscribe calls. - // Backpressure: server bounded channel per stream (capacity 4096 — same as - // event_tx in chain). On slow client, server drops OLDEST events and emits - // a StreamLagged sentinel. Client should resync state from RPC. - rpc StreamEvents(StreamEventsRequest) returns (stream ChainEvent); -} - -message BroadcastTxRequest { Transaction tx = 1; } - -message BroadcastTxResponse { - Hash txid = 1; - uint64 mempool_position = 2; // 0-indexed; FIFO ordering UX -} - -message GetBlockRequest { - oneof selector { - BlockHeight height = 1; - Hash hash = 2; - bool latest = 3; // selector == "latest" shorthand - bool finalized = 4; // selector == "finalized" (BFT-finalized head) - } -} - -message GetBalanceRequest { - Address address = 1; - // Snapshot height — read state as-of this block. Default = latest. - // Returns FAILED_PRECONDITION if outside chain window. - optional BlockHeight at_height = 2; -} - -message StreamEventsRequest { - // Filter set — empty = subscribe to all event types. Backend filters - // server-side so the wire only carries matched events. - repeated EventFilter filters = 1; - // Resume from a sequence number (0 = current head). Backend keeps last - // 4096 events in a ring buffer — beyond that, sequence is not resumable - // and the server returns FAILED_PRECONDITION. - uint64 from_sequence = 2; -} - -enum EventFilter { - EVENT_FILTER_UNSPECIFIED = 0; - EVENT_FILTER_BLOCK_FINALIZED = 1; - EVENT_FILTER_PENDING_TX = 2; - EVENT_FILTER_VALIDATOR_SET = 3; - EVENT_FILTER_LOG = 4; -} - -// ──────────────────────────────────────────────────────────── -// v0.4 read-only state-query messages -// ──────────────────────────────────────────────────────────── - -message GetValidatorSetRequest { - // Reserved for at_height historical reads — gated on MDBX snapshot - // isolation (Refactor 5). v0.4 returns the latest finalized set. - optional BlockHeight at_height = 1; -} - -message ValidatorSet { - uint32 epoch = 1; - uint32 active_count = 2; - uint32 total_count = 3; - // Total stake across the active set, in sentri (10^-8 SRX). - uint64 total_active_stake_sentri = 4; - repeated ValidatorEntry validators = 5; -} - -message ValidatorEntry { - Address address = 1; - uint64 stake_sentri = 2; - bool active = 3; - bool jailed = 4; -} - -message GetSupplyRequest { - optional BlockHeight at_height = 1; -} - -message Supply { - // sentri = 10^-8 SRX. Cap is fork-gated (210M pre-fork, 315M post- - // tokenomics-v2 at h=640800); leave conversion to display layer. - uint64 minted_sentri = 1; - uint64 burned_sentri = 2; - uint64 circulating_sentri = 3; // = minted − burned -} - -message GetMempoolRequest { - // Cap returned tx headers; default 100, max 500. Larger windows need - // pagination (deferred). 0 = use server default (100). - uint32 limit = 1; -} - -message Mempool { - // Authoritative pending-tx count. `entries` is capped by `limit`; - // size always reflects the full mempool depth. - uint32 size = 1; - repeated MempoolEntry entries = 2; -} - -message MempoolEntry { - Hash txid = 1; - Address from_address = 2; - Address to_address = 3; - Amount amount = 4; - Amount fee = 5; - uint64 nonce = 6; - uint32 tx_type = 7; -} diff --git a/src/lib.rs b/src/lib.rs index b7985fa..d8075fa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,9 +23,12 @@ #![allow(missing_docs)] #![allow(clippy::doc_lazy_continuation)] -#[allow(clippy::all, clippy::pedantic, dead_code)] +/// Generated tonic + prost types for the `sentrix.v1` schema. Re-export +/// of the `sentrix-proto` crate published from the chain repo, so this +/// crate stays in sync with the server schema without vendoring its +/// own copy. pub mod pb { - tonic::include_proto!("sentrix.v1"); + pub use sentrix_proto::*; } pub mod client; From 258f82ba8ff63b170c62e6b5b56c2dfdbd9bbdf4 Mon Sep 17 00:00:00 2001 From: satyakwok Date: Wed, 13 May 2026 18:47:57 +0200 Subject: [PATCH 2/4] chore: refresh Cargo.lock for sentrix-proto 0.1.0 from crates.io --- Cargo.lock | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 302 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 6003571..f4b463e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,55 @@ dependencies = [ "syn", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", +] + [[package]] name = "base64" version = "0.22.1" @@ -98,12 +147,27 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foldhash" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + [[package]] name = "futures-core" version = "0.3.32" @@ -168,6 +232,25 @@ dependencies = [ "wasip3", ] +[[package]] +name = "h2" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171fefbc92fe4a4de27e0698d6a5b392d6a0e333506bc49133760b3bcf948733" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.15.5" @@ -234,6 +317,67 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + [[package]] name = "id-arena" version = "2.3.0" @@ -303,12 +447,35 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "memchr" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + [[package]] name = "multimap" version = "0.10.1" @@ -407,6 +574,8 @@ dependencies = [ "prettyplease", "prost", "prost-types", + "pulldown-cmark", + "pulldown-cmark-to-cmark", "regex", "syn", "tempfile", @@ -434,6 +603,26 @@ dependencies = [ "prost", ] +[[package]] +name = "pulldown-cmark" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c3a14896dfa883796f1cb410461aef38810ea05f2b2c33c5aded3649095fdad" +dependencies = [ + "bitflags", + "memchr", + "unicase", +] + +[[package]] +name = "pulldown-cmark-to-cmark" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90" +dependencies = [ + "pulldown-cmark", +] + [[package]] name = "quote" version = "1.0.45" @@ -508,11 +697,23 @@ name = "sentrix-grpc-wasm" version = "0.1.0-alpha.0" dependencies = [ "hex", + "sentrix-proto", + "tonic", + "tonic-web-wasm-client", +] + +[[package]] +name = "sentrix-proto" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c608dbefa2b41ad2ffffbcc3f69388fdb1e95257411b93dfb57c888a17566d40" +dependencies = [ "prost", + "prost-build", "tonic", + "tonic-build", "tonic-prost", "tonic-prost-build", - "tonic-web-wasm-client", ] [[package]] @@ -563,6 +764,22 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "syn" version = "2.0.117" @@ -619,7 +836,24 @@ version = "1.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" dependencies = [ + "bytes", + "libc", + "mio", "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -633,6 +867,19 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "tonic" version = "0.14.6" @@ -640,15 +887,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac2a5518c70fa84342385732db33fb3f44bc4cc748936eb5833d2df34d6445ef" dependencies = [ "async-trait", + "axum", "base64", "bytes", + "h2", "http", "http-body", "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", + "socket2", "sync_wrapper", + "tokio", "tokio-stream", + "tower", "tower-layer", "tower-service", "tracing", @@ -718,6 +973,25 @@ dependencies = [ "web-sys", ] +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project-lite", + "slab", + "sync_wrapper", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower-layer" version = "0.3.3" @@ -761,6 +1035,18 @@ dependencies = [ "once_cell", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + [[package]] name = "unicode-ident" version = "1.0.24" @@ -773,6 +1059,21 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasip2" version = "1.0.3+wasi-0.2.9" From 91ec4a567c0a2d6414232d5288ad1fd75fa06e0e Mon Sep 17 00:00:00 2001 From: satyakwok Date: Wed, 13 May 2026 19:02:57 +0200 Subject: [PATCH 3/4] fix: depend on sentrix-proto without transport feature for wasm32 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. v0.1.1 (sentrix-labs/sentrix#670) makes `transport` an opt-in feature. This crate's browser-only consumer drops it via `default-features = false` and uses `tonic-web-wasm-client` for the actual HTTP transport instead of tonic's hyper-based Channel. Tested locally: - `cargo build --target wasm32-unknown-unknown` clean - `cargo build` (native) clean --- Cargo.lock | 265 +---------------------------------------------------- Cargo.toml | 6 +- 2 files changed, 7 insertions(+), 264 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f4b463e..f2d79a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,55 +28,6 @@ dependencies = [ "syn", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "axum" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" -dependencies = [ - "axum-core", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "serde_core", - "sync_wrapper", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "sync_wrapper", - "tower-layer", - "tower-service", -] - [[package]] name = "base64" version = "0.22.1" @@ -147,27 +98,12 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "foldhash" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "futures-channel" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" -dependencies = [ - "futures-core", -] - [[package]] name = "futures-core" version = "0.3.32" @@ -232,25 +168,6 @@ dependencies = [ "wasip3", ] -[[package]] -name = "h2" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171fefbc92fe4a4de27e0698d6a5b392d6a0e333506bc49133760b3bcf948733" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.15.5" @@ -317,67 +234,6 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-timeout" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" -dependencies = [ - "hyper", - "hyper-util", - "pin-project-lite", - "tokio", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "libc", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - [[package]] name = "id-arena" version = "2.3.0" @@ -447,35 +303,12 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" -[[package]] -name = "matchit" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" - [[package]] name = "memchr" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mio" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" -dependencies = [ - "libc", - "wasi", - "windows-sys", -] - [[package]] name = "multimap" version = "0.10.1" @@ -704,9 +537,9 @@ dependencies = [ [[package]] name = "sentrix-proto" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c608dbefa2b41ad2ffffbcc3f69388fdb1e95257411b93dfb57c888a17566d40" +checksum = "e4a96198c479e3dad9d7a2718c3d12d86a228cd07a2bade9091ef64206c273c9" dependencies = [ "prost", "prost-build", @@ -764,22 +597,6 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" - -[[package]] -name = "socket2" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" -dependencies = [ - "libc", - "windows-sys", -] - [[package]] name = "syn" version = "2.0.117" @@ -836,24 +653,7 @@ version = "1.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" dependencies = [ - "bytes", - "libc", - "mio", "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys", -] - -[[package]] -name = "tokio-macros" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" -dependencies = [ - "proc-macro2", - "quote", - "syn", ] [[package]] @@ -867,19 +667,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-util" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - [[package]] name = "tonic" version = "0.14.6" @@ -887,23 +674,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac2a5518c70fa84342385732db33fb3f44bc4cc748936eb5833d2df34d6445ef" dependencies = [ "async-trait", - "axum", "base64", "bytes", - "h2", "http", "http-body", "http-body-util", - "hyper", - "hyper-timeout", - "hyper-util", "percent-encoding", "pin-project", - "socket2", "sync_wrapper", - "tokio", "tokio-stream", - "tower", "tower-layer", "tower-service", "tracing", @@ -973,25 +752,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "tower" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "pin-project-lite", - "slab", - "sync_wrapper", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tower-layer" version = "0.3.3" @@ -1035,12 +795,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "unicase" version = "2.9.0" @@ -1059,21 +813,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - [[package]] name = "wasip2" version = "1.0.3+wasi-0.2.9" diff --git a/Cargo.toml b/Cargo.toml index 80d8145..1d0b554 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,11 @@ crate-type = ["cdylib", "rlib"] # Proto types come from the published `sentrix-proto` crate (the chain # repo's source of truth). Drops `tonic-prost` / `prost` from explicit # deps — they're transitive through `sentrix-proto` now. -sentrix-proto = "0.1" +# `default-features = false` drops the `transport` feature so this crate +# compiles for the wasm32 target (transport pulls tokio-net / mio which +# don't support wasm). The browser's HTTP layer is `tonic-web-wasm-client` +# anyway, not tonic's hyper-based Channel. +sentrix-proto = { version = "0.1", default-features = false } tonic = { version = "0.14", default-features = false, features = ["codegen"] } tonic-web-wasm-client = "0.9" hex = "0.4" From 1de086ad5832e6514fbdb5d93dee0dc678f685f0 Mon Sep 17 00:00:00 2001 From: satyakwok Date: Wed, 13 May 2026 19:29:28 +0200 Subject: [PATCH 4/4] fix: bump sentrix-proto minimum to 0.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sentrix-proto 0.1.0 pulled tonic/transport unconditionally and broke wasm32 builds. 0.1.1 added the `transport` feature flag — that's the version we ACTUALLY rely on. Bare `version = "0.1"` would let cargo resolve to 0.1.0 on a fresh lock-file regen and reintroduce the breakage. Followup to CodeRabbit comment on PR #17. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1d0b554..0a11994 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ crate-type = ["cdylib", "rlib"] # compiles for the wasm32 target (transport pulls tokio-net / mio which # don't support wasm). The browser's HTTP layer is `tonic-web-wasm-client` # anyway, not tonic's hyper-based Channel. -sentrix-proto = { version = "0.1", default-features = false } +sentrix-proto = { version = "0.1.1", default-features = false } tonic = { version = "0.14", default-features = false, features = ["codegen"] } tonic-web-wasm-client = "0.9" hex = "0.4"