canopy
canopy copied to clipboard
Custom rpc endpoints plugin
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/PluginQueryResponseproto messages + wire fields (lib/.proto/plugin.proto). PluginQueryProvider+handleQueryRequestinlib/plugin.go, backed by a controller-ownedTimeMachinesnapshot adapter (controller/controller.go). Detached queries are read-only (noStateWrite).- Prefix-collision guard (two layers): plugins declare
custom_state_prefixes; core panics at handshake if any collides with a core-reserved prefix (1–15), andFSM.StateWriterejects 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. rpcAddressconfig field and a skeleton HTTP server (rpc.*) that starts with no routes, ready for builders to add their own endpoints.custom_state_prefixesconfig plumbing.
Docs & tutorial
TUTORIAL.md/AGENTS.mdfor every plugin document how to add custom RPC endpoints, including a full worked faucet/reward example that lives only in each plugin'stutorial/folder (with integration tests).