-
Notifications
You must be signed in to change notification settings - Fork 12
Closed as not planned
Closed as not planned
Copy link
Labels
BugThis is an item that causes unwanted behaviorThis is an item that causes unwanted behaviorTriageThis item needs to be prioritizeThis item needs to be prioritize
Description
Describe the bug
Anchor has wrappers for SPL types that generates taylor made security checks.
One of them is the metadata owner check.
When generating code from a CIDL that has SPL types as inputs, Codigo is placing redundant owner checks.
But furthermore, this check is wrong in the case of an ATA: the owner of an ATA is the Token Program, not the ATA program
To Reproduce
methods:
- name: mint
uses:
- csl_spl_token.mint_to
Generated anchor code:
#[account(mut, signer)]
pub fee_payer : AccountInfo<'info>,
#[account(mut, owner=Pubkey::from_str("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA").unwrap())]
pub mint: Account<'info,anchor_spl::token::Mint>,
#[account(mut, owner=Pubkey::from_str("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL").unwrap())]
pub assoc_token_account: Account<'info,anchor_spl::token::TokenAccount>,
Expected behavior
To generate code that follows Anchor's guidelines. In this case:
#[account(mut, signer)]
pub fee_payer : AccountInfo<'info>,
#[account(mut)]
pub mint: Account<'info,anchor_spl::token::Mint>,
#[account(mut)]
pub assoc_token_account: Account<'info,anchor_spl::token::TokenAccount>,
is enough to fire the proper checks.
Platform version:
- CLI Version [e.g. v0.1.0]
- GenService Version v0.8
Extension (mark with an X the extension):
- Solana Native [ ]
- Solana Anchor [x]
Metadata
Metadata
Assignees
Labels
BugThis is an item that causes unwanted behaviorThis is an item that causes unwanted behaviorTriageThis item needs to be prioritizeThis item needs to be prioritize