Skip to content

Conversation

@Reinis-FRP
Copy link
Contributor

OZ identified following issue:

The instruction_params account used in the ExecuteRelayerRefundLeaf instruction remains open after execution,
despite becoming unnecessary once the instruction completes. Leaving the account open leads to resource
inefficiencies. Although a close_instruction_params function can address this issue, it introduces
unnecessary complexity. A more elegant and efficient approach is to leverage Anchor's close attribute to
handle account closure automatically. Unclosed accounts within Solana persist on-chain indefinitely, wasting
storage resources and keeping the lamports from rent locked and unavailable for other operations.

Consider using Anchor's close attribute to ensure that the instruction_params account is automatically
closed, reclaiming resources and simplifying the code.

This PR addresses the issue by closing instruction_params account at the end of execute_relayer_refund_leaf instruction.

…_refund_leaf

Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
@linear
Copy link

linear bot commented Jan 7, 2025

chrismaree
chrismaree previously approved these changes Jan 7, 2025
Copy link
Member

@chrismaree chrismaree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. can you add a test to show it's closed correctly?

md0x
md0x previously approved these changes Jan 7, 2025
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
@Reinis-FRP Reinis-FRP dismissed stale reviews from md0x and chrismaree via 71aac65 January 8, 2025 07:37
@Reinis-FRP
Copy link
Contributor Author

Looks good. can you add a test to show it's closed correctly?

Sure, added the check in 71aac65

@Reinis-FRP Reinis-FRP merged commit ab91cd4 into master Jan 20, 2025
9 checks passed
@Reinis-FRP Reinis-FRP deleted the reinis/acx-3589-l-09-instruction_params-account-remains-open-after-execution branch January 20, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants