feat(rpc): add getMultipleAccounts implementation#9068
feat(rpc): add getMultipleAccounts implementation#9068frank-temporal wants to merge 1 commit intofiredancer-io:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an implementation of the Solana JSON-RPC getMultipleAccounts endpoint in Firedancer’s RPC tile, enabling batch account fetches from accdb with configurable encoding/slicing behavior.
Changes:
- Implement
getMultipleAccountsrequest validation, account lookup, and JSON response streaming. - Add support for per-account data slicing and base58/base64/binary encoding output (per shared config parsing).
| int is_base58 = !strncmp( encoding_cstr, "base58", 6 ); | ||
| int is_binary = !strncmp( encoding_cstr, "binary", 6 ); | ||
| |
There was a problem hiding this comment.
fd_rpc_validate_config allows encoding: "base64+zstd", but this implementation never performs ZSTD compression. As a result, responses may advertise "base64+zstd" while actually returning plain base64 (and it also doesn't error when ZSTD support is disabled). Add base64+zstd handling equivalent to getAccountInfo (including the FD_HAS_ZSTD gated error path), or explicitly reject base64+zstd for this method to avoid returning incorrectly encoded data.
| ulong data_sz = fd_accdb_ref_data_sz( ro ); | ||
| uchar const * data = (uchar const *)fd_accdb_ref_data_const( ro ) + fd_ulong_if( slice_offset<data_sz, slice_offset, 0UL ); | ||
| ulong snip_sz = fd_ulong_min( fd_ulong_if( slice_offset<data_sz, data_sz-slice_offset, 0UL ), slice_length ); | ||
| ulong out_sz = snip_sz; | ||
| |
There was a problem hiding this comment.
This method duplicates the account encoding/serialization logic used by getAccountInfo. The duplication has already drifted (e.g., base64+zstd handling), which makes it easy for the two endpoints to become inconsistent over time. Consider extracting a shared helper for “emit UiAccount JSON + encoded data” so both methods stay in sync.
No description provided.