Skip to content

feat(netutils)!: GrpcIndexer chooses its transport at construction - #2602

Draft
zancas wants to merge 3 commits into
devfrom
integrate_with_grpc_indexer
Draft

feat(netutils)!: GrpcIndexer chooses its transport at construction#2602
zancas wants to merge 3 commits into
devfrom
integrate_with_grpc_indexer

Conversation

@zancas

@zancas zancas commented Jul 30, 2026

Copy link
Copy Markdown
Member

Three commits, all in zingo-netutils except one glossary entry.

GrpcIndexer chooses its transport at construction (408efaa). New constructor new_via_socks5(uri, socks5_addr, timeout), behind socks5-transmit, builds the channel through the existing SOCKS5 dial (connect_via_socks5, opened to pub(crate)): https-only, webpki TLS over the tunnel, phase-typed Socks5TransmitError. Every Indexer and TransparentIndexer RPC on such an instance travels the mixnet; there is no per-method routing flag. The private field is renamed clear_net_clientclient to match, and get_clear_net_client is deleted — it had no callers in this workspace, zingo-mobile, or zingo-pc. The endpoint scaffolding that new, new_lazy, and the SOCKS5 dial each rebuilt collapses into shared channel_endpoint / clearnet_endpoint helpers (scheme and authority validation included); the SOCKS5 path keeps its connect_timeout and its deliberate no-RPC-bound policy.

The protocol re-export is curated (4cedf4e). The wholesale pub use lightwallet_protocol is replaced by a facade module at the same path carrying the message types plus the generated server trait pair (CompactTxStreamer / CompactTxStreamerServer, which mock indexers implement) — but not the generated client stub, so consumers cannot construct a transport outside the constructors above. Every existing consumer import path is unchanged.

Glossary (c1490aa). zingolib/CONTEXT.md gains a Lightwallet Protocol entry — the one protocol every Indexer speaks, with Sync Indexer and Broadcast Indexer as policy roles above it — and the Indexer entry now uses the term.

Verification. Standalone netutils workspace: rustfmt; clippy -D warnings on the default, socks5-transmit, and globally-public-transparent,ping-very-insecure configurations; 32/32 tests. Main workspace: cargo check clean for pepper-sync, zingolib (nym and nym,testutils), and the libtonode-tests test targets.

🤖 Generated with Claude Code

zancas and others added 3 commits July 29, 2026 21:18
A GrpcIndexer holds one tonic channel and speaks the lightwallet gRPC
protocol over it; until now the only constructors dialed clearnet. The
new `new_via_socks5` constructor (behind `socks5-transmit`) builds the
channel through the local SOCKS5 proxy — the mixnet tunnel — so every
Indexer and TransparentIndexer RPC on that instance travels over the
mixnet, with no per-method routing flag. This is the shape the 5.0.1
CHANGELOG promised ("nym enabled clients ... will also be held by
GrpcIndexer"), and it deliberately avoids the proof-of-concept's
cfg-forked trait (PRs #2335/#2338), whose `proxied: bool` on every
method churned every caller.

Because construction now decides the transport, the private channel
field's old name became untrue; it is renamed `clear_net_client` →
`client`. The public `get_clear_net_client` accessor is removed: it has
no callers in this workspace, zingo-mobile, or zingo-pc, and its name
promises a clearnet channel the type no longer guarantees. The endpoint
scaffolding that `new`, `new_lazy`, and the SOCKS5 dial each rebuilt is
collapsed into the shared `channel_endpoint` / `clearnet_endpoint`
helpers, and `connect_via_socks5` opens to the crate so the constructor
reuses the tunnel dial, its phase-typed errors included.

Verified in the standalone netutils workspace with rustfmt, clippy -D
warnings on the default, socks5-transmit, and
globally-public-transparent + ping-very-insecure configurations, and
the 32-test suite; the main workspace's zingolib checks clean against
the removal under --features nym.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The wholesale `pub use lightwallet_protocol` made the generated client
stub reachable from every dependent, inviting transport decisions
outside the constructors. A facade module of the same path now carries
the protocol message types and the generated server trait pair (mock
indexers implement the service), but not the client stub: consumers
hold a GrpcIndexer, whose transport is chosen at construction, and
speak through the Indexer trait. Every existing message-type import
path is unchanged, verified by checking pepper-sync, zingolib with
nym and testutils, and the libtonode test imports against the facade;
the netutils feature matrix stays clippy-clean and its suite 32/32.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The grilling ruling on the generated client stub was to hide it rather
than rename it, and the glossary records the concept that makes the
hiding coherent: one protocol, spoken by every Indexer, with Sync
Indexer and Broadcast Indexer as policy roles above it rather than
wire dialects. The Indexer entry now points at the ratified term.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@zancas
zancas marked this pull request as ready for review July 30, 2026 04:39
@zancas
zancas requested a review from Oscar-Pepper July 30, 2026 04:41
@zancas
zancas marked this pull request as draft July 30, 2026 04:54
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