hiero-ledger / hiero-ledger/hiero-consensus-node
CLPR-4.1: gRPC Server and ClprEndpointService
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
## Story CLPR-4.1: gRPC Server and ClprEndpointService
**Parent Epic:** CLPR-4: Hiero Endpoint
### Objective
Register the `ClprEndpointService` gRPC service alongside existing HAPI services on the node's Netty gRPC server.
### Acceptance Criteria
- **AC-1:** Implements `rpc sync(ClprSyncPayload) returns (ClprSyncPayload)`.
- **AC-2:** Implements `rpc discoverEndpoints(DiscoverEndpointsRequest) returns (DiscoverEndpointsResponse)` for gossip-based peer discovery. Responses throttled per caller.
- **AC-3:** Registered alongside existing HAPI services using the same `ServiceRegistration` mechanism. Shares the node's existing gRPC port.
- **AC-4:** The gRPC service is always registered. The `clprEnabled` flag is checked dynamically at call time — when disabled, calls return `UNAVAILABLE`. This allows the council to enable/disable CLPR via config update without node restarts (important as a safety kill-switch).
- **AC-5:** TLS for transport encryption. Peer authentication is proof-based (not certificate-based against an on-chain roster). Any peer providing valid proofs is legitimate; peers sending invalid data are shunned.
- **AC-6:** Inbound rate limiting: if a Connection's inbound sync rate exceeds `max_syncs_per_sec`, respond with `RESOURCE_EXHAUSTED`.
- **AC-7:** gRPC max message size configured to accommodate `max_sync_bytes`.
- **AC-8:** Graceful shutdown: in-flight syncs complete before server stops.
- **AC-9:** Sync handler: pre-verify received payload via verifier, construct this node's outbound payload, return response, submit caller's payload as `submitBundle`.
### Dependencies
- Existing Hiero gRPC/Netty infrastructure
- CLPR-1.1 (`ClprSyncPayload` proto, `DiscoverEndpointsRequest/Response` protos)
### Risk
**Medium** — Integration with existing gRPC service registration. Discovery throttling.
Contributor guide
Research direction
Start by locating the existing Hiero gRPC/Netty server, HAPI service registrations, and the ServiceRegistration mechanism. Read the CLPR-1.1 proto definitions and trace how configuration, verification, rate limiting, TLS, and graceful shutdown are handled. Done means ClprEndpointService is always registered, honors the listed call-time checks, supports both RPCs, and satisfies the acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend, distributed-systems, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100