From 50cfd90493a635b08c68a15493bfa1a11a5162f4 Mon Sep 17 00:00:00 2001 From: Reinis Martinsons Date: Tue, 7 Jan 2025 09:03:39 +0000 Subject: [PATCH 1/2] fix(svm): L-09 close instruction_params account after execute_relayer_refund_leaf Signed-off-by: Reinis Martinsons --- programs/svm-spoke/src/instructions/bundle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/svm-spoke/src/instructions/bundle.rs b/programs/svm-spoke/src/instructions/bundle.rs index 0e00ace0a..20b855ed5 100644 --- a/programs/svm-spoke/src/instructions/bundle.rs +++ b/programs/svm-spoke/src/instructions/bundle.rs @@ -18,7 +18,7 @@ pub struct ExecuteRelayerRefundLeaf<'info> { #[account(mut)] pub signer: Signer<'info>, - #[account(seeds = [b"instruction_params", signer.key().as_ref()], bump)] + #[account(mut, seeds = [b"instruction_params", signer.key().as_ref()], bump, close = signer)] pub instruction_params: Account<'info, ExecuteRelayerRefundLeafParams>, // Contains all leaf & proof information. #[account(seeds = [b"state", state.seed.to_le_bytes().as_ref()], bump)] From 71aac6589830f2fe82ba58d10ccdf2bfbd3c6d51 Mon Sep 17 00:00:00 2001 From: Reinis Martinsons Date: Wed, 8 Jan 2025 07:37:03 +0000 Subject: [PATCH 2/2] test: instruction params account is closed Signed-off-by: Reinis Martinsons --- test/svm/SvmSpoke.Bundle.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/svm/SvmSpoke.Bundle.ts b/test/svm/SvmSpoke.Bundle.ts index e84f9f36f..d1707e1ca 100644 --- a/test/svm/SvmSpoke.Bundle.ts +++ b/test/svm/SvmSpoke.Bundle.ts @@ -241,13 +241,23 @@ describe("svm_spoke.bundle", () => { program: program.programId, }; const proofAsNumbers = proof.map((p) => Array.from(p)); - await loadExecuteRelayerRefundLeafParams(program, owner, stateAccountData.rootBundleId, leaf, proofAsNumbers); + const instructionParams = await loadExecuteRelayerRefundLeafParams( + program, + owner, + stateAccountData.rootBundleId, + leaf, + proofAsNumbers + ); const tx = await program.methods .executeRelayerRefundLeaf() .accounts(executeRelayerRefundLeafAccounts) .remainingAccounts(remainingAccounts) .rpc(); + // Verify the instruction params account has been automatically closed. + const instructionParamsInfo = await program.provider.connection.getAccountInfo(instructionParams); + assert.isNull(instructionParamsInfo, "Instruction params account should be closed"); + // Verify the ExecutedRelayerRefundRoot event let events = await readEventsUntilFound(connection, tx, [program]); let event = events.find((event) => event.name === "executedRelayerRefundRoot")?.data;