tlv-account-resolution: resolve extra metas without per-meta allocation - #199
Open
stranzhay wants to merge 2 commits into
Open
tlv-account-resolution: resolve extra metas without per-meta allocation#199stranzhay wants to merge 2 commits into
stranzhay wants to merge 2 commits into
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.
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.
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.