Skip to content

Add validator metrics RPC methods - #283

Open
NeerajGodiyal wants to merge 17 commits into
alpenglow-devfrom
koro/rpc-validator-metrics
Open

NeerajGodiyal wants to merge 17 commits into
alpenglow-devfrom
koro/rpc-validator-metrics

Conversation

@NeerajGodiyal

@NeerajGodiyal NeerajGodiyal commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add getVoteAccounts, getBalance, getLeaderSchedule, and getBlockProduction so Solana Exporter can read validator metrics from Mithril.

Maintain rooted stake totals and cache parsed vote records, invalidating them on account changes, recovery, and rewind. Epoch recalculation yields the cache mutex in bounded entry batches. Missing or deleted accounts return null from getAccountInfo and zero from getBalance.

Preserve the v1 manifest undo boolean on new writes. Recovery derives vote candidates from validated account records. Previously written flag-style manifests remain readable by this version, but downgrading those existing stores requires rebuilding or canonicalizing them first.

Query behavior

Parse integer parameters without floating-point rounding and use defaults for null optional fields. Support keepUnstakedDelinquents and vote-account-keyed leader schedules. The identity filter still selects a node identity. Vote-account keys come from the retained canonical schedule; requests return an error when only a node-keyed compatibility schedule is available.

Account and validator reads use the published rooted state for confirmed and finalized. They reject processed rather than return rooted data for that request. This does not add a separate optimistic confirmed account view. Existing processed counters in getSlot and getEpochInfo are unchanged.

Related PRs

#280 supplies the correct epoch length for Alpenglow. Both PRs change getEpochInfo; their integration must keep the schedule-derived epoch length and the commitment/minimum-context handling here.

Complete exporter support also needs #282 for node information and #284 for retained block summaries. Inflation rewards from #285 are already merged. This PR does not depend on the separate full transaction-history work.

Validation

  • Affected race suites, vet, and Mithril build passed locally. Scale testing covered up to two million stake accounts, concurrent root changes, and independent full-scan correctness checks.
  • Cross-version manifest recovery and rewind passed in both directions for newly written compatible fixtures.
  • At f521efcc, the unmodified Solana Exporter RPC client passed HTTP checks for all four methods before/after committed updates and durable rewind, under race detection.
  • Standalone full-exporter scrapes return HTTP 500 because node-info methods from Add node health, version, and identity RPC methods #282 and ledger-availability methods from Add rooted block history RPC methods #284 are absent. This PR alone does not provide complete exporter compatibility. The earlier Alpenglow exporter test used a combined build; the latest changes were tested with isolated local fixtures.
  • The candidate on 348704c4 passed native race tests for replay, execution and RPC/account/reward behavior, followed by repository-wide vet, build and CLI compilation. All 1,152 parent test executions passed without Go skip events. The optional external program workloads were not enabled because their pinned arithmetic fixture was unavailable. These are isolated fixture tests, not a public-cluster throughput result.

Performance

Local M4 Pro / ARM64, GOMAXPROCS=2: warm responses for 1,000 unchanged vote records improved from 2.78 to 0.66 ms including JSON encoding. Two-million-delegation recalculation improved from 103 to 60 ms, with temporary allocations reduced from 64.2 to 0.19 MB. Reusable benchmarks and methodology are in docs/rooted-stake-rpc-cache.md and the RPC test suite.

These are component measurements, not live RPC p99 or validator voting results. Cache benefits depend on record reuse; bootstrap and epoch recalculation still visit stake delegations.

NeerajGodiyal and others added 17 commits September 23, 2026 23:30
Serve the live replay slot for processed requests and the published rooted slot for confirmed and finalized requests. Decode minContextSlot as an exact uint64 and return the existing structured RPC errors.

Add HTTP coverage for commitment selection, minimum-context boundaries, invalid inputs, numeric precision, missing roots and cancellation. Document the supported options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants