6

Following the example in the docs here.

When I try to send a tx that would create a LUT I get:

logs: [
    'Program AddressLookupTab1e1111111111111111111111111 invoke [1]',
    '157405384 is not a recent slot',
    'Program AddressLookupTab1e1111111111111111111111111 failed: invalid instruction data'
  ]

Tried different RPC providers and processed / confirmed / finalized settings - all the same.

Halp?

1 Answer 1

6

This occured because you provided a slot that isn't on the main fork, the slot increase for each tentative block but there might not be a block for every slot (consensus dropped the block, leader did not produce anything...).

If you need to create multiple address lookup tables at once, you need to ensure each slot is valid.

This snippet fetches the slots of the main fork blocks for the last 200 slots (by number).

  const currentSlot = await connection.getSlot();
  console.log('currentSlot:', currentSlot);
  const slots = await connection.getBlocks(currentSlot - 200);
  if (slots.length < 100) {
    throw new Error(`Could find only ${slots.length} ${slots} on the main fork`);
  }

This gives you a bunch of valid slots to use

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.