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

New Idl generation fails when seeds are generated using an external function #2903

Open
Bhargavamacha opened this issue Apr 12, 2024 · 3 comments
Labels
idl related to the IDL, either program or client side

Comments

@Bhargavamacha
Copy link
Contributor

Consider the following example:

#[account(
    init,
    seeds = [
        CONSTANT_SEED,
        external_function(ix_param).as_slice()
    ],
    bump,
    space = 8 + size,
    payer = payer
)]

IDL generation fails saying ix_param not found.

@acheroncrypto acheroncrypto added the idl related to the IDL, either program or client side label Apr 13, 2024
@acheroncrypto
Copy link
Collaborator

Yeah, it's because the new IDL generation stores PDA seeds in the IDL by default, but there is no way to store external_function in the IDL.

@Bhargavamacha
Copy link
Contributor Author

Is there a way to fix it?

@acheroncrypto
Copy link
Collaborator

The client needs to be able to derive the address from the information based on the program's IDL to make it work. This depends on what you do inside your external_function, but most of the time, you should be able to do that inline instead of calling a function.

You can also disable account resolution in Anchor.toml:

[features]
resolution = false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idl related to the IDL, either program or client side
Projects
None yet
Development

No branches or pull requests

2 participants