SIGN IN SIGN UP

feat: per-network static responses for RPC methods (#844)

Some chains deviate from client assumptions in ways that make specific
RPC requests unanswerable. For example, a chain whose genesis block is
at height 1 has no valid response for eth_getBlockByNumber("0x0", false);
clients that probe block 0 see upstream errors or divergent results, and
the upstream may be flagged as misbehaving.

Add a per-network `staticResponses` list. When an inbound request matches
a configured (method, params) entry, the stub response is returned and
no upstream is contacted. Both result-shaped and error-shaped stubs are
supported. Matching uses recursive deep equality that tolerates numeric
type divergence between YAML config and JSON request decoding and is
order-independent for map keys.

The short-circuit fires after method extraction and before the
multiplexer / cache / upstream selection in Network.Forward, and echoes
the inbound request id. Hits are counted by the new metric
erpc_network_static_response_served_total{project,network,category}.

Internal state pollers are unaffected.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
P
Paymahn Moghadasian committed
9da7e25aa536df2a01307f3400fe0697bcf1fc34
Parent: a9ba3f6
Committed by GitHub <noreply@github.com> on 4/23/2026, 9:22:45 AM