feat: Save CU by removing parsing/validation of the token program account args - #144
Draft
kaze-cow wants to merge 2 commits into
Draft
feat: Save CU by removing parsing/validation of the token program account args#144kaze-cow wants to merge 2 commits into
kaze-cow wants to merge 2 commits into
Conversation
Every token-moving instruction still names its token program — a CPI can only dispatch to a program its own instruction names — but nothing reads those accounts any more. The program a transfer targets is the one owning the account it moves, which the account itself says, so the slots are skipped positionally and dropped from the parsed inputs. `BeginSettle` pulls against the sell account's owner and `FinalizeSettle` pushes against the destination's owner; `CreateBuffer` creates each buffer under its mint's owner and `ReclaimBuffer` closes each one through the program that owns it. That takes ~110-170 CU off every settlement, and costs ~35 CU per buffer in the two batch instructions, which resolve once per buffer rather than once per instruction. `TokenProgramNotProvided` went with the slot validation: a settlement that leaves out a program its accounts live under is now refused by the runtime as a missing account. `PushDestinationInvalid` takes its code, both being new on this stack. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
No description provided.