program: Relax minimum rent check#79
Merged
Merged
Conversation
joncinque
previously approved these changes
Jun 4, 2026
| if buffer.lamports() < minimum_balance { | ||
| // The buffer account must have non-zero lamports. The runtime will then | ||
| // ensure that the account is rent exempt. | ||
| if buffer.lamports() == 0 { |
Contributor
There was a problem hiding this comment.
Actually, seeing this here makes me realize that this will probably become the future of rent-exemption checks on-chain!
| // - must be rent exempt (pre-funded account) since we are reallocating the buffer | ||
| // account | ||
| // - must be rent exempt (pre-funded account) since we are reallocating the | ||
| // account (checked by the runtime) |
Contributor
There was a problem hiding this comment.
We could say that initialize checked to make sure it had at least some lamports, since without the check in initialize, extend would still work on an account with 0 lamports, right?
Contributor
Author
There was a problem hiding this comment.
Yeah, good point! Same for allocate. I will add a comment for both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Currently,
Allocate,Extend,InitializeandWriteinclude explicit minimum rent exempt, but could rely on the runtime instead.Solution
For
AllocateandInitialize, replace the minimum rent check by a check that account must have lamports; these are the only 2 instructions that can create the PDA. Remove the rent exempt check inExtendandWritesince these instructions require an initialized account with data.