Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

JSON-RPC envelope dispatch + the tier/allowlist boundary.

dispatch is the single entry the server (and any in-process caller) funnels a raw request through. It resolves the method, enforces the Surface boundary (which tiers the caller may reach), then calls the node’s RpcHandler, assembling a canonical JSON-RPC response either way.

The boundary is the security-critical part and mirrors the canonical node:

  • unknown method → -32601;
  • a method not reachable on the caller’s surface → -32601 on the peer surface (the allowlist is a denylist-by-omission, exactly Method::is_peer_reachable), or -32030 (UNAUTHORIZED) for a control method reached off the loopback/in-process surface;
  • rpc.discover is answered here from the generated OpenRPC document (never forwarded to the handler), so discovery can’t drift.

Enums§

Surface
Which transport surface a request arrived on — this decides which method tiers are reachable.

Functions§

dispatch
Dispatch one JSON-RPC request against handler, arriving on surface.
parse_error_response
Build a bare error response for a request that failed to even parse into an envelope (used by the transport before dispatch can run). id is RequestId::Null when the id could not be recovered.

Type Aliases§

SharedHandler
A handler shared across the tower stack.