Repository navigation
fix(rpc): count loaded accounts data size as SIMD-0186 does - #831
Merged
MicaiahReid merged 1 commit intoOct 5, 2026
Merged
Conversation
Contributor
|
MicaiahReid
previously approved these changes
Sep 30, 2026
MicaiahReid
left a comment
Collaborator
There was a problem hiding this comment.
This is great, good find!
L0STE
force-pushed
the
fix/loaded-accounts-data-size
branch
from
October 4, 2026 20:07
5e5c3bf to
0c6ae28
Compare
MicaiahReid
approved these changes
Oct 5, 2026
1 of 2 tasks
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.
Problem
simulateTransactioncomputesloadedAccountsDataSizeby hand, and it counts less than a validatordoes. SIMD-0186, as Agave implements it in
load_transaction_accounts(
svm/src/account_loader.rs), counts:exist;
programdata account itself.
Surfpool counts only the accounts' data, counts a lookup table's data instead of the flat size, and
counts programdata only for a program it has just fetched from the datasource. A program already on
the surfnet, including the ones bundled at startup, is counted without its programdata.
For example, a transfer to a new account resolved through a lookup table, which also passes an
upgradeable program with 1,000 bytes of programdata:
programdata (64 + 1,000) and the lookup table (8,248): 9,561 bytes.
88 bytes of data.
A client that sets
setLoadedAccountsDataSizeLimitfrom the simulated size then sees the transactionrefused on chain with
MaxLoadedAccountsDataSizeExceeded.Fix
in
seen_accounts, so the base is added once for all of them.lookup tables, which only existed to measure their data.
one already did.
The count is still Surfpool's own. A comment marks it for deletion once LiteSVM returns the size it
metered in
TransactionMetadata(LiteSVM/litesvm#428), so the reported size and the metered sizecome from one place. That PR also makes LiteSVM meter programdata, which it currently skips.
Test
test_simulate_transaction_loaded_accounts_data_size: an offline simulation with a payer, thesystem program, a missing recipient resolved through a lookup table, and an upgradeable program
with its programdata. The expected size is written out account by account from the rules above.
test_simulate_add_alt_entries_fetchingpinned 140,134, which depended on how much data a mainnetlookup table held and no longer matched. Under SIMD-0186 the table costs a flat size, so the value
only depends on the table's first entry, the Token program, and on the Token program LiteSVM
bundles. The breakdown is written next to the value.
Each test was checked by breaking the code one change at a time: dropping the base size, the lookup
table size or the programdata, charging the base for a missing account, and using the wrong base or
lookup table size. Every break turns at least one of them red.
Validation
cargo +nightly fmt --all -- --checkcargo clippy -p surfpool-core --all-targetsadds no warningscargo test -p surfpool-core --lib -- loaded_accounts_data_size test_simulate_add_alt_entries_fetchingcargo test -p surfpool-core --lib: all pass, includingtest_simulate_add_alt_entries_fetching,which fails on
main