Skip to content

Documentation: ensure all RPC endpoints are documented and tested #1754

@dannywillems

Description

@dannywillems

Summary

PR #1745 started documenting the RPC endpoints and how the RPC server works.
However, we need to ensure all endpoints are documented to avoid node operators
missing crucial data.

Goal

Every constructor of the RpcRequest enum in node/src/rpc/mod.rs:75-113
should be documented with:

  1. A curl script in website/docs/developers/api-and-data/scripts/rpc-api/curl/
  2. A corresponding test in .github/scripts/test-rpc-remote/
  3. An entry in the RPC API documentation page

RpcRequest variants to document

The following variants need documentation (check those already done):

Variant Endpoint Documented Tested
StateGet /state [x] [x]
StatusGet /status [x] [x]
HeartbeatGet /heartbeat [ ] [ ]
ActionStatsGet /stats/actions [ ] [ ]
SyncStatsGet /stats/sync [x] [x]
BlockProducerStatsGet /stats/block_producer [x] [x]
MessageProgressGet /state/message-progress [x] [x]
PeersGet /state/peers [x] [x]
P2pConnectionOutgoing /p2p/connection/outgoing [ ] [ ]
P2pConnectionIncoming /p2p/connection/incoming [ ] [ ]
ScanStateSummaryGet /scan-state/summary [x] [x]
SnarkPoolGet /snark-pool/jobs [x] [x]
SnarkPoolJobGet /snark-pool/job/{id} [ ] [ ]
SnarkPoolCompletedJobsGet /snark-pool/completed-jobs [ ] [ ]
SnarkPoolPendingJobsGet /snark-pool/pending-jobs [ ] [ ]
SnarkerConfig /snarker/config [x] [x]
SnarkerJobCommit /snarker/job/commit [ ] [ ]
SnarkerJobSpec /snarker/job/spec [ ] [ ]
SnarkerWorkers /snarker/workers [x] [x]
HealthCheck /healthz [x] [x]
ReadinessCheck /readyz [x] [x]
DiscoveryRoutingTable /discovery/routing_table [x] [x]
DiscoveryBoostrapStats /discovery/bootstrap_stats [x] [x]
TransactionPoolGet /transaction-pool [x] [x]
LedgerAccountsGet /accounts [x] [x]
TransactionInject /transaction/inject [ ] [ ]
TransitionFrontierUserCommandsGet /transition-frontier/user-commands [ ] [ ]
BestChain /best-chain [ ] [ ]
ConsensusConstantsGet /consensus/constants [ ] [ ]
TransactionStatusGet /transaction/status [ ] [ ]
GetBlock /block [ ] [ ]
PooledUserCommands /pooled-user-commands [ ] [ ]
PooledZkappCommands /pooled-zkapp-commands [ ] [ ]
GenesisBlockGet /genesis-block [ ] [ ]
ConsensusTimeGet /consensus/time [ ] [ ]
LedgerStatusGet /ledger/status [ ] [ ]
LedgerAccountDelegatorsGet /ledger/account/delegators [ ] [ ]

Implementation steps

For each undocumented endpoint:

  1. Create curl script in
    website/docs/developers/api-and-data/scripts/rpc-api/curl/{endpoint}.sh

    #!/bin/bash
    RPC_ENDPOINT="${1:-http://localhost:3000}"
    curl -s -X GET "$RPC_ENDPOINT/{path}" -H "Content-Type: application/json"
  2. Create test script in .github/scripts/test-rpc-remote/test-{endpoint}.sh
    that calls the curl script and validates the response

  3. Add workflow step in .github/workflows/test-rpc-remote.yml

  4. Document in website at website/docs/developers/api-and-data/rpc-api.md

Note on using AI

This task is well-suited for AI assistants (e.g., Claude Code). The work is
repetitive and follows a clear pattern established by the existing documented
endpoints. Using AI is recommended to speed up the process.

Verification

The CI workflow includes a verification step that fails if any curl script
doesn't have a corresponding test:

- name: Verify all curl scripts have tests

Acceptance criteria

  • All RpcRequest variants have corresponding curl scripts
  • All curl scripts have corresponding tests in CI
  • All endpoints are documented in the RPC API page
  • CI verification step passes
  • Documentation links to Rust API docs for response types

Related

Location

  • Enum: node/src/rpc/mod.rs:75-113
  • Curl scripts: website/docs/developers/api-and-data/scripts/rpc-api/curl/
  • Tests: .github/scripts/test-rpc-remote/
  • Workflow: .github/workflows/test-rpc-remote.yml
  • Documentation: website/docs/developers/api-and-data/rpc-api.md

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions