Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 8031

Any workaround to use remaining accounts if they are exceeding the transaction limit?

$
0
0

I am working on an Anchor program where I need to mutate four accounts linked to each client (two balance accounts and two withdrawal accounts). Here's an example of my test

const fundMovements = [  { client: clientOne.publicKey, underlyingAmount: new anchor.BN(100), strikeAmount: new anchor.BN(-2000) },  { client: clientTwo.publicKey, underlyingAmount: new anchor.BN(150), strikeAmount: new anchor.BN(2500) },];let backendId = new anchor.BN(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER))// Passing a maximum of 8 accounts (4 for each client)let remainingAccounts = [  { pubkey: clientOneWsolBalance, isWritable: true, isSigner: false },  { pubkey: clientOneUsdcBalance, isWritable: true, isSigner: false },  { pubkey: clientOneWsolWithdrawals, isWritable: true, isSigner: false },  { pubkey: clientOneUsdcWithdrawals, isWritable: true, isSigner: false },  { pubkey: clientTwoWsolBalance, isWritable: true, isSigner: false },  { pubkey: clientTwoUsdcBalance, isWritable: true, isSigner: false },  { pubkey: clientTwoWsolWithdrawals, isWritable: true, isSigner: false },  { pubkey: clientTwoUsdcWithdrawals, isWritable: true, isSigner: false },];let updateFundMovementsTx = await program.methods.updateFundMovements(fundMovements, backendId).accountsPartial({      caller: utilityAccount.publicKey,      accessController: accessControllerAccount,      role: roleAccountUtilityAccount,      member: memberAccountUtilityAccount,      tokenValidator: tokenValidatorAccount,      ledger: usdcWSolLedger,      whitelistedStrikeToken: whitelistedUsdcTokenAccount,      whitelistedUnderlyingToken: whitelistedNativeTokenAccount,      strikeToken: usdcMint,      underlyingToken: nativeMint,      systemProgram: SystemProgram.programId,    }).preInstructions([      anchor.web3.ComputeBudgetProgram.setComputeUnitLimit({ units: 1400000 }),      anchor.web3.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 })    ]).remainingAccounts(remainingAccounts).signers([utilityAccount]).rpc().then(confirmTx).then(log);

Due to Solana's transaction size limits, I can't pass more than 8 remaining accounts, therefore I can only mutate data linked to 2 clients (aiming to do at least 15 clients per call (60 rem accounts)) because I will exceed the limit of 1232 bytes per transaction.

Question

Is there any way to manage additional accounts efficiently, so I can pass and mutate more account data without exceeding the transaction limit? Or is there any workaround in Anchor that can help to deal with multiple accounts beyond the standard limit?

P.S. I tried using LUTs (Address Lookup Table), but obviously they can only compress and store public keys and not account info or data.

Thanks in advance


Viewing all articles
Browse latest Browse all 8031

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>