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(svm): L-09 close instruction_params account after execute_relayer_refund_leaf #840

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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.

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
@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

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.

3 participants