Skip to content

idl: Fix using account or arg values for seeds::program#3570

Merged
acheroncrypto merged 3 commits intosolana-foundation:masterfrom
acheroncrypto:idl-fix-using-account-or-arg-values-for-seeds-program
Feb 23, 2025
Merged

idl: Fix using account or arg values for seeds::program#3570
acheroncrypto merged 3 commits intosolana-foundation:masterfrom
acheroncrypto:idl-fix-using-account-or-arg-values-for-seeds-program

Conversation

@acheroncrypto
Copy link
Copy Markdown
Collaborator

Problem

Passing an account or an argument to seeds::program results in a compile error.

For example, using the following accounts struct:

#[derive(Accounts)]
pub struct Test<'info> {
    #[account(
        seeds = [b"*"],
        seeds::program = some_program,
        bump
    )]
    pub pda: UncheckedAccount<'info>,
    pub some_program: Program<'info, System>,
}

and running anchor idl build results in:

error[E0425]: cannot find value `some_program` in this scope
  --> programs/program/src/lib.rs:20:26
   |
20 |         seeds::program = some_program,
   |                          ^^^^^^^^^^^^ not found in this scope

Dynamic values are generally not supported, but we have a few exceptions for accounts and arguments. Given this kind usage already works for regular seeds, it should also work for seeds::program.

Summary of changes

Fix being unable to use account or argument values for seeds::program during IDL generation.

Fixes #3471

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 23, 2025

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added idl related to the IDL, either program or client side fix Bug fix PR labels Feb 23, 2025
@acheroncrypto acheroncrypto merged commit b6b4f11 into solana-foundation:master Feb 23, 2025
52 of 53 checks passed
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix PR idl related to the IDL, either program or client side

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anchor idl build fails on seeds::program constraint

1 participant