Repository navigation
fix(sdk-coin-sol): correct ConfigureAccount wire and fee reallocation - #10119
Open
bhavidhingra wants to merge 1 commit into
Open
bhavidhingra wants to merge 1 commit into
bhavidhingra wants to merge 1 commit into
Conversation
Token-2022 ConfigureAccount carries no ElGamal pubkey: the key is taken from the VerifyPubkeyValidity proof context. Drop the inline 32-byte key so the instruction data is [27][2] + decryptable_zero_balance(36) + maximum_pending_balance_credit_counter(u64) + proof_instruction_offset(i8), instead of the deprecated 79-byte form. Reallocate now also reserves ConfidentialTransferFeeAmount (extension 17) when the mint carries TransferFeeConfig: ConfigureAccount initializes that extension for such mints, so the account needs its 68 bytes of space. Verified on devnet: CreateATA + Reallocate + ConfigureAccount + VerifyPubkeyValidity confirms for a plain CT mint (469B account, extension 5) and a TransferFeeConfig CT mint (549B, extensions 2/5/17). The same sequence without the fee extension fails ConfigureAccount with invalid account data. CHALO-2030
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
Contributor
|
|
This branch has not been deployed
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.
Description
Fixes the Token-2022 confidential-transfer wire so SDK-built account enablement actually works on-chain. Two defects live in the encoder (
modules/sdk-coin-sol), both of which make everyConfigureAccountfail:ConfigureAccountwrote the deprecated 79-byte payload. Token-2022 no longer carries the ElGamal pubkey in the instruction data — the key is recovered from the accompanyingVerifyPubkeyValidityproof context. New layout:[27][2] + decryptable_zero_balance(36) + maximum_pending_balance_credit_counter(u64) + proof_instruction_offset(i8)= 47 bytes. TheelgamalPubkeyparam is removed fromConfigureConfidentialTransferAccount(the caller still needs the key to generate the proof, but it is not instruction data).Reallocatereserved onlyConfidentialTransferAccount. For a mint carryingTransferFeeConfig,ConfigureAccountalso initializesConfidentialTransferFeeAmount, so the account must be 68 bytes larger (64 payload + TLV header).Reallocatenow appends extension type 17 when the mint is fee-bearing.The pinned
@solana/spl-token(0.4.13) enum predates the confidential-fee members, so type 17 is declared locally with the Token-2022 enum order cited.API change (unreleased CT lane only):
elgamalPubkeyremoved fromconfigureAccount; new optionalmintHasTransferFeeConfigoncreateAta/ReallocateConfidentialTransferAccount. Consumers (wallet-platform #63702) must pass the flag for fee-bearing mints and stop passingelgamalPubkey.Issue Number
CHALO-2030
Type of change
How Has This Been Tested?
ConfigureAccountwire-bytes test asserts the exact 47-byte layout and offsets; newcreateAtareallocate tests assert the extension list[5]versus[5, 17]. Both were written failing first (79 ≠ 47,3 ≠ 5bytes) against the previous encoders.mochainmodules/sdk-coin-sol: 895 passing / 0 failing (Node 24).CreateATA → Reallocate → ConfigureAccount → VerifyPubkeyValidityconfirmed by the real Token-2022 program on devnet:ImmutableOwner,ConfidentialTransferAccount(295B)TransferFeeConfigCT mint — 549B account, extensionsImmutableOwner,TransferFeeAmount(8B),ConfidentialTransferAccount(295B),ConfidentialTransferFeeAmount(64B)ConfigureAccountfails withinvalid account data, confirming the shortfall the fix preventsChecklist: