-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[spl-record] Add Reallocate
instruction
#6063
Conversation
There was a problem hiding this 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?
record/program/src/instruction.rs
Outdated
/// 1. `[signer, writable]` The payer account to fund reallocation | ||
/// 2. `[]` System program for reallocation funding |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
c5af5ed
to
be4f527
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
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.