Skip to content

fix: correct CPI bugs in group_pointer and cpi_guard extensions#4334

Open
alexchenai wants to merge 1 commit intosolana-foundation:masterfrom
alexchenai:fix/spl-token2022-cpi-bugs
Open

fix: correct CPI bugs in group_pointer and cpi_guard extensions#4334
alexchenai wants to merge 1 commit intosolana-foundation:masterfrom
alexchenai:fix/spl-token2022-cpi-bugs

Conversation

@alexchenai
Copy link

Fixes two CPI bugs in spl/src/token_2022_extensions/:

1. group_pointer_update (fixes #4323)

The authority AccountInfo was missing from the accounts slice passed to invoke_signed. The instruction is built with the authority pubkey but the CPI omits it, so the call always fails. The analogous group_member_pointer_update in group_member_pointer.rs correctly 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 of ctx.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 with OwnerMismatch. The analogous functions in memo_transfer.rs correctly use ctx.accounts.owner.key.

Changes

  • spl/src/token_2022_extensions/group_pointer.rs: Add ctx.accounts.authority to invoke_signed accounts slice
  • spl/src/token_2022_extensions/cpi_guard.rs: Replace ctx.accounts.account.owner with ctx.accounts.owner.key in both enable and disable

Closes #4323
Closes #4321

…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.
@vercel
Copy link

vercel bot commented Mar 19, 2026

Someone is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Auth Account Missing From invoke_signed in group_pointer_update [Bug]: cpi_guard_enable and cpi_guard_disable Pass the Wrong Owner Pubkey

1 participant