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

fix createLUTProposal tx size #1777

Merged
merged 3 commits into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions actions/createLUTproposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,22 @@ export const createLUTProposal = async (
})

// add addresses to the `lookupTableAddress` table via an `extend` instruction
const extendInstruction = AddressLookupTableProgram.extendLookupTable({
payer: payer,
authority: payer,
lookupTable: lookupTableAddress,
addresses: keys,
})
// need to split into multiple instructions because of the ~20 address limit
// https://docs.solana.com/developing/lookup-tables#:~:text=NOTE%3A%20Due%20to,transaction%27s%20memory%20limits.
// const extendInstruction = AddressLookupTableProgram.extendLookupTable({
// payer: payer,
// authority: payer,
// lookupTable: lookupTableAddress,
// addresses: keys,
// })
const extendInstructions = chunks(keys, 15).map((chunk) =>
AddressLookupTableProgram.extendLookupTable({
payer: payer,
authority: payer,
lookupTable: lookupTableAddress,
addresses: chunk,
})
)

// Send this `extendInstruction` in a transaction to the cluster
// to insert the listing of `addresses` into your lookup table with address `lookupTableAddress`
Expand All @@ -246,12 +256,15 @@ export const createLUTProposal = async (
wallet,
transactionInstructions: [
{
instructionsSet: [
{ transactionInstruction: lookupTableInst },
{ transactionInstruction: extendInstruction },
],
instructionsSet: [{ transactionInstruction: lookupTableInst }],
sequenceType: SequenceType.Sequential,
},
...extendInstructions.map((x) => {
asktree marked this conversation as resolved.
Show resolved Hide resolved
return {
instructionsSet: [{ transactionInstruction: x }],
sequenceType: SequenceType.Sequential,
}
}),
],
callbacks: {
afterAllTxConfirmed: resolve,
Expand Down
Loading