Skip to content

program: do not resize self-split, ban self-withdraw#96

Merged
2501babe merged 2 commits into
solana-program:mainfrom
2501babe:dealloc-better
Oct 14, 2025
Merged

program: do not resize self-split, ban self-withdraw#96
2501babe merged 2 commits into
solana-program:mainfrom
2501babe:dealloc-better

Conversation

@2501babe
Copy link
Copy Markdown
Member

the account realloc added in #82 did not properly handle the case for Split and Withdraw where the source is the same account as the destination, therefore truncating an uninitialized "source" incorrectly truncated the destination

this pr makes it so we do not truncate for self-split, and we ban self-withdraws entirely. i decided to do this instead of handling the withdraw case because there are existing tests ensuring self-split is possible but no such tests for self-withdraw. in any event philosophically withdraw should have as few features as is practical

Merge also resizes source to zero, but self-merge is already banned

@2501babe 2501babe requested a review from joncinque October 13, 2025 13:27
@2501babe 2501babe self-assigned this Oct 13, 2025
@2501babe 2501babe marked this pull request as draft October 13, 2025 13:49
@2501babe 2501babe marked this pull request as ready for review October 13, 2025 13:53
Copy link
Copy Markdown
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

@2501babe 2501babe merged commit 5aa1185 into solana-program:main Oct 14, 2025
9 checks passed
@2501babe 2501babe deleted the dealloc-better branch October 14, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants