fix: correct CPI bugs in group_pointer and cpi_guard extensions#4334
Open
alexchenai wants to merge 1 commit intosolana-foundation:masterfrom
Open
fix: correct CPI bugs in group_pointer and cpi_guard extensions#4334alexchenai wants to merge 1 commit intosolana-foundation:masterfrom
alexchenai wants to merge 1 commit intosolana-foundation:masterfrom
Conversation
…ard) - group_pointer_update: include authority AccountInfo in invoke_signed accounts slice, matching the pattern in group_member_pointer_update. Without this, the CPI always fails since the runtime cannot find the authority account. Fixes solana-foundation#4323. - cpi_guard_enable/disable: pass ctx.accounts.owner.key (token account authority) instead of ctx.accounts.account.owner (runtime account owner / program ID) when building the CPI guard instruction. The SPL Token-2022 processor validates this against the stored token authority, so using .owner always results in OwnerMismatch. Matches the pattern used in memo_transfer.rs. Fixes solana-foundation#4321.
|
Someone is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
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.
Fixes two CPI bugs in
spl/src/token_2022_extensions/:1.
group_pointer_update(fixes #4323)The
authorityAccountInfowas missing from the accounts slice passed toinvoke_signed. The instruction is built with the authority pubkey but the CPI omits it, so the call always fails. The analogousgroup_member_pointer_updateingroup_member_pointer.rscorrectly includes it.2.
cpi_guard_enable/cpi_guard_disable(fixes #4321)Both functions pass
ctx.accounts.account.owner(the Solana runtime account owner, i.e. the Token-2022 program ID) instead ofctx.accounts.owner.key(the token account authority) when constructing the CPI guard instruction. The SPL Token-2022 processor validates this parameter against the stored token authority, so the CPI always fails withOwnerMismatch. The analogous functions inmemo_transfer.rscorrectly usectx.accounts.owner.key.Changes
spl/src/token_2022_extensions/group_pointer.rs: Addctx.accounts.authoritytoinvoke_signedaccounts slicespl/src/token_2022_extensions/cpi_guard.rs: Replacectx.accounts.account.ownerwithctx.accounts.owner.keyin both enable and disableCloses #4323
Closes #4321