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

Feature Request: add pda realloc to account macro #1917

Closed
cavemanloverboy opened this issue May 24, 2022 · 3 comments · Fixed by #1943
Closed

Feature Request: add pda realloc to account macro #1917

cavemanloverboy opened this issue May 24, 2022 · 3 comments · Fixed by #1943

Comments

@cavemanloverboy
Copy link
Contributor

I think this new feature could go in the #[account()] macro, e.g.

#[derive(Accounts)]
#[instruction(new_size: usize)]
pub struct MyAccounts<'info> {
    #[account(
        mut,
        realloc = new_size,
        ...
    )]
    pub my_pda: Account<'info, DataAccount>
}

and perhaps skip the realloc if old size is equal to new size.

@cavemanloverboy
Copy link
Contributor Author

If you point me to the right file/scope I'll see if I can throw something together

@callensm
Copy link
Member

callensm commented May 28, 2022

The implementation should also include the requirement of including something like exempter (similar to the payer input) to handle the transfer of lamports to or from the program account to manage the rent exemption increase or decrease related to the reallocation.

@armaniferrante
Copy link
Member

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 a pull request may close this issue.

3 participants