Skip to content

Commit

Permalink
fix: remove expensive debug msg
Browse files Browse the repository at this point in the history
Signed-off-by: Reinis Martinsons <[email protected]>
  • Loading branch information
Reinis-FRP committed Sep 24, 2024
1 parent db591ea commit 719822e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
1 change: 0 additions & 1 deletion programs/svm-spoke/src/instructions/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ impl RelayerRefundLeaf {

pub fn to_keccak_hash(&self) -> [u8; 32] {
let input = self.to_bytes();
msg!("input: {:?}", input);
keccak::hash(&input).0
}
}
Expand Down
40 changes: 28 additions & 12 deletions test/svm/SvmSpoke.Bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,10 @@ describe("svm_spoke.bundle", () => {
it("Execute Max Refunds", async () => {
const relayerRefundLeaves: RelayerRefundLeafType[] = [];

// Higher refund count panics out of memory when looping the transfers.
// TODO: split out claiming individual refunds to resolve this bottleneck.
const numberOfRefunds = 19;
// Higher refund count hits message size limit due to refund accounts also being present in calldata. This could be
// resolved by feeding calldata from a buffer account.
const numberOfRefunds = 21;
const maxExtendedAccounts = 30; // Maximum number of accounts that can be added to ALT in a single transaction.

const refundAccounts: anchor.web3.PublicKey[] = [];
const refundAmounts: BN[] = [];
Expand Down Expand Up @@ -694,24 +695,39 @@ describe("svm_spoke.bundle", () => {
payer: payer.publicKey,
recentSlot: await connection.getSlot(),
});
const extendInstruction = AddressLookupTableProgram.extendLookupTable({
lookupTable: lookupTableAddress,
authority: payer.publicKey,
payer: payer.publicKey,
addresses: allAccounts,
});

// Submit the ALT creation and extend transaction
// Submit the ALT creation transaction
await anchor.web3.sendAndConfirmTransaction(
connection,
new anchor.web3.Transaction().add(lookupTableInstruction).add(extendInstruction),
new anchor.web3.Transaction().add(lookupTableInstruction),
[payer],
{
skipPreflight: true, // Avoids recent slot mismatch in simulation.
commitment: "finalized", // Avoids invalid ALT index as ALT might not be active yet on the following tx.
}
);

// Extend the ALT with all accounts making sure not to exceed the maximum number of accounts per transaction.
for (let i = 0; i < allAccounts.length; i += maxExtendedAccounts) {
const extendInstruction = AddressLookupTableProgram.extendLookupTable({
lookupTable: lookupTableAddress,
authority: payer.publicKey,
payer: payer.publicKey,
addresses: allAccounts.slice(i, i + maxExtendedAccounts),
});

await anchor.web3.sendAndConfirmTransaction(
connection,
new anchor.web3.Transaction().add(extendInstruction),
[payer],
{
skipPreflight: true, // Avoids recent slot mismatch in simulation.
}
);
}

// Avoids invalid ALT index as ALT might not be active yet on the following tx.
await new Promise((resolve) => setTimeout(resolve, 500));

// Fetch the AddressLookupTableAccount
const lookupTableAccount = (await connection.getAddressLookupTable(lookupTableAddress)).value;
assert(lookupTableAccount !== null, "AddressLookupTableAccount not fetched");
Expand Down

0 comments on commit 719822e

Please sign in to comment.