feat(token): add p-token (SIMD-0266) and missing SPL Token instructions#366
Open
hxuan190 wants to merge 1 commit intosolana-foundation:mainfrom
Open
feat(token): add p-token (SIMD-0266) and missing SPL Token instructions#366hxuan190 wants to merge 1 commit intosolana-foundation:mainfrom
hxuan190 wants to merge 1 commit intosolana-foundation:mainfrom
Conversation
Add support for 7 missing token instructions to the SPL Token program: Instructions 21-24 (existing on-chain, missing from solana-go): - GetAccountDataSize (ID 21) - InitializeImmutableOwner (ID 22) - AmountToUiAmount (ID 23) - UiAmountToAmount (ID 24) P-token exclusive instructions (SIMD-0266 / Pinocchio): - WithdrawExcessLamports (ID 38) - UnwrapLamports (ID 45) - Batch (ID 255) Updated instructions.go with new constants, InstructionIDToName entries, extended InstructionImplDef for IDs 0-24, and added pTokenInstructionMap with custom DecodeInstruction dispatch for non-contiguous p-token IDs. Verified on Solana testnet (SIMD-0266 feature gate activated at slot 396236256, address ptokFjwyJtrwCa9Kgo9xoDS59V4QccBGEaRFnRPnSdP): Simulation tests (IDs 20-24): - InitializeMint2: 364 CUs - GetAccountDataSize: 179 CUs - AmountToUiAmount: 615 CUs - UiAmountToAmount: 589 CUs Send+confirm tests (p-token exclusive): - WithdrawExcessLamports (ID 38): 3C9iNnUPPaqRCA1RSD5tXDpD7ZW72VQYsKYm1j3voEYcH4UCfzKURan63Df2jdfX3gzPzEHZDu6eFfnTf2K4H98d - UnwrapLamports partial (ID 45): zPrV9K6wLqnES4RBDAQs15S8MgvC48QjsLZAmPoimvY6vmQkh8yi3XBJYqQBkpo28HpiNdhuPL3N65Dqf1ovhWn - UnwrapLamports all (ID 45): 5VVDC6PeWo5sAAUhbc3xRRiZDMo1t5Y6c1VDktBqLLhXZtri1HshL9y7TmEu9BBZEpiQCdAmULazfNjTfeHd5ujH - Batch with 2 transfers (ID 255): 2y1jC5rXbQvvym1bM5ukRcQfiovUQPi4fbcryixXpjTe5fc2UDGvvgurZqLNx7DEYd7NHHwEnEt6oPX4anV9kXnh All 68 tests pass (30 existing + 38 new), zero regressions. Made-with: Cursor
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.
Add support for 7 missing token instructions to the SPL Token program:
Instructions 21-24 (existing on-chain, missing from solana-go):
P-token exclusive instructions (SIMD-0266 / Pinocchio):
Updated instructions.go with new constants, InstructionIDToName entries, extended InstructionImplDef for IDs 0-24, and added pTokenInstructionMap with custom DecodeInstruction dispatch for non-contiguous p-token IDs.
Verified on Solana testnet (SIMD-0266 feature gate activated at slot 396236256, address ptokFjwyJtrwCa9Kgo9xoDS59V4QccBGEaRFnRPnSdP):
Simulation tests (IDs 20-24):
Send+confirm tests (p-token exclusive):