Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect accounts assumption for cpi #10

Closed
julianzamt opened this issue Aug 29, 2023 · 1 comment
Closed

Incorrect accounts assumption for cpi #10

julianzamt opened this issue Aug 29, 2023 · 1 comment
Assignees
Labels
Triage This item needs to be prioritize

Comments

@julianzamt
Copy link

Describe the bug
Similar to #8 , when using csl_spl_token.mint_to creates code that expects an ATA, and generates code expecting the input. This is wrong in at least two ways:

  1. It is possible that the user wants to use a regular token account
  2. It is possible that the user wants to use an account that is already in the context. Furthermore, the accounts that will be used in a cpi may result from runtime logic execution. Assuming the inputs of a cpi, if not required, can be very confusing from a user perspective, and clutters the accounts array.

To Reproduce

methods:
  - name: mint_to_a_regular_account
    uses:
      - csl_spl_token.initialize_mint2
      - csl_spl_token.initialize_account3
      - csl_spl_token.mint_to
    inputs:
      - name: mint
        type: csl_spl_token.Mint
        solana:
          attributes: [ init ]
      - name: regular_token_account ------------> I wanted to mint to this account after creation
        type: csl_spl_token.Account
        solana:
          attributes: [ init ]

In processor, the vec of accounts that i supposedly should use in the mint_to cpi:

&vec![
	mint_info.clone(),
	assoc_token_account_info.clone(), -----> this is the account that the generator "decided" that I should mint to
	owner_info.clone(),
	wallet_info.clone(),
	token_program_info.clone(),
],

Expected behavior
To not assume which accounts are going to be used in a cpi. Even if the CIDL allows the user to map accounts to cpi methods, which accounts are going to be used may result from runtime logic.

Código CLI version:

  • Version v0.8
@julianzamt
Copy link
Author

Incorrect use of the CIDL

@julianzamt julianzamt closed this as not planned Won't fix, can't repro, duplicate, stale Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage This item needs to be prioritize
Projects
None yet
Development

No branches or pull requests

2 participants