Open
Conversation
- Switch from blocking RpcClient to solana_client::nonblocking for async RPC calls that won't block the tokio runtime under load - Replace .unwrap() on Mint::unpack_from_slice with proper error propagation to prevent panics on malformed data - Return HTTP 503 on RPC/parse failures instead of misleading "0" response (errors are logged internally, not exposed to clients) - Share RpcClient via Axum state instead of creating new client per request for better resource efficiency
- Use async Solana RPC client with proper error handling (503 on failure) - Share RPC client via state instead of creating per request - Add router() functions to supply and legacy modules - Simplify main.rs with clean route composition
- New endpoint: GET /api/stats/staked/{token}
- Queries PositionV0 accounts via getProgramAccounts with registrar filter
- Sums amount_deposited_native and divides by token decimals
- Background task populates cache on startup and refreshes every 15 min
- Requests block on cache miss with double-check locking to prevent parallel fetches
- Replace runtime PDA derivation with registrar constants - Use data_slice in gPA to fetch only the 8-byte amount field
madninja
reviewed
Jan 20, 2026
| spl-token = { version = "7.0", features = ["no-entrypoint"] } | ||
| tokio = { version = "1", features = ["full"] } | ||
| pretty_env_logger = "0.5" | ||
| log = "0.4" |
Member
There was a problem hiding this comment.
don't use log if we already have tracing in use.. otherwise, switch to tracing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.