Push proceeds to users in FinalizeSettle#62
Open
fedgiac wants to merge 46 commits into
Open
Conversation
kaze-cow
reviewed
Jul 10, 2026
…' into push-funds-to-user-parsing
…cessing-in-begin-settle
…h-funds-to-user-processing-in-finalize-settle
…' into push-funds-to-user-parsing
…cessing-in-begin-settle
…h-funds-to-user-processing-in-finalize-settle
…cessing-in-begin-settle
…h-funds-to-user-processing-in-finalize-settle
Base automatically changed from
push-funds-to-user-processing-in-begin-settle
to
main
July 15, 2026 15:06
…h-funds-to-user-processing-in-finalize-settle
… -> rejects_push_if_buffer_does_not_match_mint
kaze-cow
approved these changes
Jul 17, 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.
Push each order's proceeds out of the buffers in
FinalizeSettle.This is the final part of the settlement push flow. The previous PR taught
BeginSettleto pair each settled order with exactly one push and check the push pays the order's buy token account, but nothing moved yet. HereFinalizeSettleactually performs the transfers.What
push_fundsdoesBeginSettlealready guarantees, for the paired finalize, that the push count matches the order count and that each push's destination is the right buy token account, and the counterpart check guarantees that begin ran.So the only things left for
FinalizeSettleto check is that:And naturally, it needs to actually send funds.
How to test
finalize_settle_pushes.rsmoves from asserting that pushes merely parse to asserting they actually pay: single-order, several orders sharing one buffer, and several orders drawing from different buffers, each checking both the destinations' credited balances and the buffers' debited balances. It also covers new edge cases.