Uh oh!
There was an error while loading. Please reload this page.
tlv-account-resolution: resolve extra metas without per-meta allocation - #199
Merged
joncinque merged 3 commits intoAug 26, 2026
Merged
Conversation
danenbm
approved these changes
Aug 17, 2026
danenbm
left a comment
There was a problem hiding this comment.
LGTM. The once-built refs list preserves the existing resolution semantics (later metas can still reference previously resolved accounts in add_to_cpi_instruction via the appended borrows), and the allocation tests are a nice guard. Would be great to land as it directly unblocks transfer-hook usage with larger extra-account-meta lists.
joncinque
left a comment
Contributor
There was a problem hiding this comment.
Thanks for your contribution, looks great overall! Just a small question, then we can land this
Uh oh!
There was an error while loading. Please reload this page.
Drops the final-account borrow guard per review feedback, so resolution takes a shared data borrow on every resolved account uniformly.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 26, 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 freeto 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.
Solana's shared account-resolution library (
spl-tlv-account-resolution) rebuilt a temporary list of every account for each extra account meta it resolved. Under Solana's default SBF bump allocator, which does not reclaim deallocated memory, those cumulative allocations can exceed the default 32 KB heap and abort with "out of memory." This matches the transfer-hook failures reported in solana-program-library#7004 and token-2022#66.The fix builds that list once and appends each newly resolved account as the loop advances, reducing allocation growth from quadratic to linear. A host-side counting allocator measured 75,864 bytes on the base implementation and 13,368 bytes on this branch when resolving 32 extra accounts. Resolution behavior is unchanged, and the existing suite covers chained resolution where one meta derives from a previously resolved account.
The dedicated allocation regression test samples 8, 16, and 32 extra metas and bounds marginal growth, so reintroducing the per-meta rebuild fails the test.