Repository navigation
fix: meter programdata and return the loaded accounts data size - #428
Merged
Merged
Conversation
Aursen
approved these changes
Oct 4, 2026
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.
LiteSVM meters a transaction's loaded accounts data size against its limit (SIMD-0186), but it misses one rule Agave applies, and it doesn't tell the caller the size it metered.
Count programdata (fix). Agave also counts the programdata of every loader-v3 program the transaction loads: 64 bytes plus its data, once, and not at all when the transaction lists the programdata account itself (
account_loader.rs#L543-L563). LiteSVM skipped it, so any transaction touching an upgradeable program (every Anchor program) was metered below what mainnet counts. A transaction that setsset_loaded_accounts_data_size_limitfrom a LiteSVM run could then pass here and fail on mainnet withMaxLoadedAccountsDataSizeExceeded.Return the size (feature).
TransactionMetadatagainsloaded_accounts_data_size, set bysend_transactionandsimulate_transaction, including for transactions that fail in execution. RPC layers built on LiteSVM, like Surfpool'ssimulateTransaction, can report it instead of recounting it themselves.Notes:
TransactionMetadata, so code that builds the struct with a literal needs to set it.litesvm-persistencedoesn't store the field, so the snapshot format is unchanged and restored history reports 0. Happy to persist it with a format version bump instead, if you prefer that.Tests, in
tests/compute_budget.rs:test_loaded_accounts_data_size_counts_programdata: with an upgradeable program in the transaction, a limit at the exact size passes and one byte below fails, both when the programdata is unlisted (counted with the program) and when it is listed (counted once).test_transaction_metadata_reports_loaded_accounts_data_size: the reported size equals the metered size for a simulated, a successful and an execution-failed transaction.cargo test --features precompiles,cargo clippy --all-targets -- -D warnings(with and without--all-features) andcargo +nightly fmt --all -- --checkpass.