2

We've been stumped for a few days regarding the creation of LUTs from within a program (Anchor based). Ideally we'd like to do this inside the program if possible to keep things cleaner.

Dependeices are

anchor-lang = "0.25.0"
anchor-spl = "0.25.0"
mpl-token-metadata = { version="1.6.1", features = [ "no-entrypoint" ] }
solana-address-lookup-table-program = "1.10.41"

We can't use the newest solana-address-lookup-table-program of 1.14 because of a dependecy issue with anchor needing an older Solana Program crate so wondering if this may be part of the issue.

Invoking the call seems to attempt the cpi but no matter what we do we always get "missing account from instruction"

let (lut_create_ix, lut_pubkey) =
                ::instruction::create_lookup_table(
                ctx.accounts.owner.key(),
                ctx.accounts.owner.key(),
                slot,
            );

        assert_eq!(lut_pubkey, ctx.accounts.lut_key.key());

        msg!("Sending Transcation");
        invoke(
            &lut_create_ix,
            &[
                ctx.accounts.tailor_lut.to_account_info(),
                ctx.accounts.owner.to_account_info(),
                ctx.accounts.owner.to_account_info(),
                ctx.accounts.system_program.to_account_info(),
            ]
        )?;

The accounts needed are described here in the address-lookup-table crate repo which we have followed and can't see any other additional accounts needed in the code it's looking for that we are aware of.

https://github.com/solana-labs/solana/blob/master/programs/address-lookup-table/src/instruction.rs

Even checking a create look up table transaction from the program itself shows that only these 4 accounts are passed in so we are at a loss.

https://solscan.io/tx/27xinL4PBFXFhnDzxYsB9XeAUgfoBMpnb8t9CMhfNacwmkTin7tehGMeHUU7wsY872KhwwdscAmfefsaoWazC9Wk

2 Answers 2

0

This may be silly, but there's a mismatch in the names that you're using. You're checking:

        assert_eq!(lut_pubkey, ctx.accounts.lut_key.key());

But then you're passing in ctx.accounts.tailor_lut.to_account_info() to the CPI. Shouldn't that be ctx.accounts.lut_key.to_account_info() instead?

1
  • Geez! You could very well have nailed that. Probably my own fault ha! Was a long couple of days of coding. Funny enough two of us had checked this as well. I'll give this another shot and check back. It could also be that this might of been a copy of paste of all the random combinations we tried. Will report back :)
    – Tony Boyle
    Dec 1, 2022 at 14:24
0

How did you get tailor_lut into that function?

pub tailor_lut: Account<'a,AddressLookupTable>

This gave errors in anchor 0.27.0.

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.