Skip to content

feat(rpc): impl getSupply#1304

Merged
dnut merged 3 commits intomainfrom
prestonsn/impl-get-supply
Mar 24, 2026
Merged

feat(rpc): impl getSupply#1304
dnut merged 3 commits intomainfrom
prestonsn/impl-get-supply

Conversation

@prestonsn
Copy link
Copy Markdown
Contributor

@prestonsn prestonsn commented Mar 9, 2026

Implements getSupply

Testing Done

Test Params Result
finalized commitment: finalized PASS — 124 accts match, nonCirc match, invariant holds
confirmed commitment: confirmed PASS — 124 accts match, nonCirc match, invariant holds
processed commitment: processed PASS — 124 accts match, nonCirc match, invariant holds
exclude=true finalized, exclude: true PASS — 0 accts on both, nonCirc match
exclude=false finalized, exclude: false PASS — 124 accts match, nonCirc match
confirmed+exclude confirmed, exclude: true PASS — 0 accts on both, nonCirc match

@prestonsn prestonsn self-assigned this Mar 9, 2026
@github-project-automation github-project-automation Bot moved this to 🏗 In progress in Sig Mar 9, 2026
@prestonsn prestonsn force-pushed the prestonsn/impl-get-supply branch from a09a9a8 to d6b1cdf Compare March 9, 2026 19:23
@prestonsn prestonsn force-pushed the prestonsn/impl-get-program-accounts branch from bed9f49 to 8ae5962 Compare March 9, 2026 21:57
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/rpc/account_codec/lib.zig 81.92% <ø> (ø)
src/rpc/account_codec/parse_stake.zig 100.00% <ø> (ø)
src/rpc/methods.zig 91.08% <ø> (ø)
src/rpc/test_serialize.zig 100.00% <100.00%> (ø)

... 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 prestonsn/impl-get-supply branch from 2de4b91 to 9262b38 Compare March 9, 2026 23:51
@prestonsn prestonsn force-pushed the prestonsn/impl-get-program-accounts branch 2 times, most recently from 6e00548 to 5291f93 Compare March 10, 2026 19:05
@prestonsn prestonsn force-pushed the prestonsn/impl-get-supply branch 2 times, most recently from 3cab526 to 120e1bd Compare March 10, 2026 19:39
@prestonsn prestonsn marked this pull request as ready for review March 11, 2026 15:08
@prestonsn prestonsn requested review from dnut, ultd and yewman as code owners March 11, 2026 15:08
@prestonsn prestonsn force-pushed the prestonsn/impl-get-program-accounts branch 3 times, most recently from 8d43dd3 to dfe1dd0 Compare March 17, 2026 00:10
Base automatically changed from prestonsn/impl-get-program-accounts to main March 17, 2026 17:20
@prestonsn prestonsn force-pushed the prestonsn/impl-get-supply branch 3 times, most recently from 4a2474e to 85c56fd Compare March 18, 2026 22:16
@prestonsn prestonsn requested a review from ajw221 March 19, 2026 14:35
Comment thread build.zig Outdated
ajw221
ajw221 previously approved these changes Mar 19, 2026
Copy link
Copy Markdown
Contributor

@ajw221 ajw221 left a comment

Choose a reason for hiding this comment

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

not hard necessary but just thought I'd point a few things out

Comment thread src/rpc/methods.zig Outdated
Comment thread src/rpc/hook_contexts/Account.zig Outdated
ajw221
ajw221 previously approved these changes Mar 19, 2026
- Add non-circulating supply data file (.zon) with 110 accounts and 10 withdraw authorities matching Agave v3.1.8
- Add build-time script to decode base58 pubkeys into [32]u8 arrays (avoids comptime branch quota limits)
- Implement getSupply handler: scans stake accounts, checks lockup/authority, computes circulating vs non-circulating lamports
- Add getSysvar generic helper to account_codec, refactor parseMintAdditionalData to use it
- Add isNonCirculatingStake to parse_stake module
- Add serialization/deserialization tests for GetSupply requests and responses
ajw221
ajw221 previously approved these changes Mar 20, 2026
Comment thread src/rpc/hook_contexts/Account.zig Outdated
…uction

Use a single ArrayList instead of collecting extras separately and
concatenating two buffers at the end.
@dnut dnut self-assigned this Mar 24, 2026
@dnut dnut enabled auto-merge March 24, 2026 14:11
@dnut dnut disabled auto-merge March 24, 2026 14:11
@dnut dnut enabled auto-merge March 24, 2026 14:11
Copy link
Copy Markdown
Contributor

@InKryption InKryption left a comment

Choose a reason for hiding this comment

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

Approved, just had a question

Comment thread src/rpc/non_circulating_supply.zon
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to 👀 In review in Sig Mar 24, 2026
@dnut dnut added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit bd25b23 Mar 24, 2026
13 checks passed
@dnut dnut deleted the prestonsn/impl-get-supply branch March 24, 2026 15:52
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Sig Mar 24, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Mar 26, 2026
implements
[getLargestAccounts](https://solana.com/docs/rpc/http/getlargestaccounts)

Adds an in memory data-structure to Rooted.zig to track a leaderboard of
the top 20 accounts by lamports. It acts as a materialized view (since
sqlite lacks native materialized views).

Requires #1304 for circulating and
nonCirculating calculations

### Testing Done

| Test | Result | Speed |
|------|--------|-------|
| `getLargestAccounts` (processed, no filter) | Sig and Agave match:
same 20 accounts, same order | Sig near-instant vs Agave 30s+ |
| `getLargestAccounts` (confirmed, no filter) | Sig and Agave match:
same 20 accounts, same order | Sig near-instant vs Agave 30s+ |
| `getLargestAccounts` (confirmed, circulating) | Sig returned 20
accounts; Agave failed to respond | Sig near-instant |
| `getLargestAccounts` (finalized, circulating) | Sig returned 20
accounts; Agave failed to respond | Sig near-instant |
| `getLargestAccounts` (confirmed, nonCirculating) | Sig returned empty
list; Agave failed to respond | Sig near-instant |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants