canopy icon indicating copy to clipboard operation
canopy copied to clipboard

Custom rpc endpoints plugin

Open pablocampogo opened this issue 5 months ago • 0 comments

Summary

Adds a detached, read-only query path from plugins to Canopy so plugin builders can serve their own custom RPC endpoints for chain-specific data, without coupling Canopy core to plugin-specific routes.

What's added

Core

  • New PluginQueryRequest/PluginQueryResponse proto messages + wire fields (lib/.proto/plugin.proto).
  • PluginQueryProvider + handleQueryRequest in lib/plugin.go, backed by a controller-owned TimeMachine snapshot adapter (controller/controller.go). Detached queries are read-only (no StateWrite).
  • Prefix-collision guard (two layers): plugins declare custom_state_prefixes; core panics at handshake if any collides with a core-reserved prefix (1–15), and FSM.StateWrite rejects writes to reserved prefixes (fsm/state.go, fsm/plugin_guard_test.go).

Plugin SDKs (go, python, typescript, kotlin, csharp)

  • Detached QueryState(height, read) client method + transport.
  • rpcAddress config field and a skeleton HTTP server (rpc.*) that starts with no routes, ready for builders to add their own endpoints.
  • custom_state_prefixes config plumbing.

Docs & tutorial

  • TUTORIAL.md / AGENTS.md for every plugin document how to add custom RPC endpoints, including a full worked faucet/reward example that lives only in each plugin's tutorial/ folder (with integration tests).

pablocampogo avatar Jun 16 '26 04:06 pablocampogo