-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
lang: add rent exemption skip to init and make init_if_needed check that acc is rent exempt if init is not needed #1234
Conversation
…hat acc is rent exempt if init is not needed
}; | ||
|
||
let lamports = match rent_exempt { | ||
ConstraintRentExempt::Skip => quote! {0}, |
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.
I don't think this is necessarily what we want because it means the account will immediately be garbage collected.
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.
*at the end of the transaction so following ix can still use it.
I doubt this will be used much but to me it seems like the code a user would expect to be generated by that combination of constraints. I think the API is not great (not obvious that this causes init with 0) but at least it would provide the functionality
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.
but yea maybe its better to just roll out the new rent/lamports feature asap and forbid rent_exempt = skip on init in the parser
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.
Sounds good. rent_exempt = skip
was originally added with the expectation that the account was created in a prior instruction (with what is now #[account(zero)]
).
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.
just to confirm. The thing that sounds good to you is this #1234 (comment) comment, not the one before?
}; | ||
|
||
let lamports = match rent_exempt { | ||
ConstraintRentExempt::Skip => quote! {0}, |
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.
Sounds good. rent_exempt = skip
was originally added with the expectation that the account was created in a prior instruction (with what is now #[account(zero)]
).
fixes #1225, fixes #1224