2

I have my accounts struct like this

#[derive(Accounts)]
#[instruction(force_seed: [u8; 32])]
pub struct Dummy<'info> {
    #[account(mut)]
    pub payer: Signer<'info>,

    /// CHECK:
    #[account(
        mut,
        seeds = [RANDOMNESS_ACCOUNT_SEED.as_ref(), &force_seed],
        bump,
        seeds::program = orao_solana_vrf::ID
    )]
    pub random: AccountInfo<'info>,

    pub system_program: Program<'info, System>,
}

I want to pas in the force_seed argument with another argument, dummy. Dummy will not be used in the Accounts struct, only force_seed. The issue is that when I include dummy, the generated PDA address account here random changes.

 pub fn guess(ctx: Context<Dummy>, dummy: u8,  force_seed: [u8; 32]) -> Result<()> {

        Ok(())
    }

1 Answer 1

3

The instructions are passed in order from left to right. So either you change the order of your parameters in the guess instruction or you write your instruction macro like this: #[instruction(dummy: u8, force_seed: [u8; 32])]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.