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

[spl-record] Add Reallocate instruction #6063

Merged
merged 5 commits into from
Jan 6, 2024

Conversation

samkim-crypto
Copy link
Contributor

@samkim-crypto samkim-crypto commented Jan 5, 2024

Problem

The record program is useful when storing arbitrary length data on accounts. However, if the data is too long to fit inside an account, it is not possible to record the data without creating a new account with enough space. It would be nice to be able to reallocate more space to the existing account to store longer record data.

Summary of changes

Add a reallocate instruction. I followed the main logic of the reallocate instruction in the token-2022 program.

This PR builds on top of #6062. Once #6062 is merged, I will rebase to master to remove the first few commits.

@samkim-crypto samkim-crypto added WIP Work in progress and removed WIP Work in progress labels Jan 5, 2024
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

The implementation and tests look good! I think we just need to move the lamport transfer logic outside of the program. What do you think?

Comment on lines 65 to 66
/// 1. `[signer, writable]` The payer account to fund reallocation
/// 2. `[]` System program for reallocation funding
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than passing these accounts in, how about we have the client library top up the account with the new required rent exemption?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, yes agreed. I removed the lamports logic! Let me know what you think.

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@samkim-crypto samkim-crypto merged commit e08f30b into solana-labs:master Jan 6, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants