Skip to content

feat(rpc): implement getSlot RPC method#1197

Open
ajw221 wants to merge 10 commits intomainfrom
adamw/implement-getSlot-in-rpc
Open

feat(rpc): implement getSlot RPC method#1197
ajw221 wants to merge 10 commits intomainfrom
adamw/implement-getSlot-in-rpc

Conversation

@ajw221
Copy link
Contributor

@ajw221 ajw221 commented Feb 2, 2026

Intent

  • Implement getSlot RPC method

Implementation

  • Added ForkChoiceProcessedSlot and OptimisticallyConfirmedSlot atomic trackers to src/replay/trackers.zig
  • Added SlotHookContext to src/rpc/methods.zig which reads slot state from SlotTracker based on commitment level
  • Updated SlotTracker.root to be atomic for thread-safe access from RPC
  • Wired latest_processed_slot updates in consensus mode (during vote handling) and bypass mode (from SlotTree.tip())
  • Wired latest_confirmed_slot updates in vote listener when optimistic confirmation threshold is reached

Ramifications

  • ForkChoiceProcessedSlot uses store() rather than fetchMax() because the processed slot can decrease when fork choice switches to a different fork
  • In bypass-consensus mode, processed slot is set to the highest fork tip, which differs from Agave's semantics where it only updates when voting

Tests

  • Updated existing unit tests to include the new slot tracker dependencies
  • Added assertions verifying slot trackers remain at initial state after expected failures

@ajw221 ajw221 self-assigned this Feb 2, 2026
@github-project-automation github-project-automation bot moved this to 🏗 In progress in Sig Feb 2, 2026
@ajw221 ajw221 changed the base branch from main to harnew/epoch-state-tracking February 2, 2026 16:36
@ajw221 ajw221 force-pushed the adamw/implement-getSlot-in-rpc branch from 5c910f3 to a29f437 Compare February 2, 2026 23:55
@ajw221 ajw221 changed the base branch from harnew/epoch-state-tracking to main February 3, 2026 14:38
@prestonsn prestonsn force-pushed the adamw/implement-getSlot-in-rpc branch 2 times, most recently from 88d9154 to c5b6298 Compare February 4, 2026 15:13
@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 96.22642% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/replay/trackers.zig 92.85% 2 Missing ⚠️
src/consensus/vote_listener.zig 85.71% 1 Missing ⚠️
src/replay/service.zig 88.88% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/consensus/replay_tower.zig 96.16% <100.00%> (+<0.01%) ⬆️
src/replay/consensus/cluster_sync.zig 91.56% <100.00%> (+<0.01%) ⬆️
src/replay/consensus/core.zig 94.98% <100.00%> (+<0.01%) ⬆️
src/replay/consensus/process_result.zig 93.37% <100.00%> (+0.02%) ⬆️
src/rpc/methods.zig 79.66% <ø> (ø)
src/consensus/vote_listener.zig 93.39% <85.71%> (-0.09%) ⬇️
src/replay/service.zig 93.66% <88.88%> (+0.03%) ⬆️
src/replay/trackers.zig 98.89% <92.85%> (-0.71%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@prestonsn prestonsn force-pushed the adamw/implement-getSlot-in-rpc branch from c5b6298 to ccfde8d Compare February 4, 2026 16:16
@prestonsn prestonsn self-assigned this Feb 4, 2026
@prestonsn prestonsn changed the title feat(rpc): implement getSlot feat(rpc): implement getSlot RPC method Feb 4, 2026
@prestonsn prestonsn force-pushed the adamw/implement-getSlot-in-rpc branch 2 times, most recently from 40fae04 to 72d8727 Compare February 9, 2026 17:58
@dnut dnut marked this pull request as ready for review February 9, 2026 18:54
Copy link
Contributor

@dnut dnut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my main overall thought is to move all the slot integers to be owned by the slot tracker which would solve several of my comments including the stack pointer uafs

@github-project-automation github-project-automation bot moved this from 🏗 In progress to 👀 In review in Sig Feb 10, 2026
@dnut dnut requested a review from InKryption February 10, 2026 00:36
@prestonsn prestonsn force-pushed the adamw/implement-getSlot-in-rpc branch 2 times, most recently from e7172e5 to 0568f9e Compare February 12, 2026 22:08
ajw221 and others added 4 commits February 13, 2026 22:24
- Add SlotTree.tip() to get highest slot among fork leaves (bypass mode)
- Update latest_processed_slot inside vote handling to match Agave behavior
- Update latest_processed_slot in bypassConsensus() from SlotTree.tip()
- Change ForkChoiceProcessedSlot to use store() since slot can decrease
Note: Bypass mode uses highest fork tip, while consensus mode matches
Agave's semantics where processed slot only updates when voting.
@ajw221 ajw221 force-pushed the adamw/implement-getSlot-in-rpc branch from 7d84370 to 8279fe0 Compare February 14, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

4 participants