restricts rent-paying accounts lifetime extension#26606
restricts rent-paying accounts lifetime extension#26606behzadnouri merged 1 commit intosolana-labs:masterfrom
Conversation
33da4c9 to
5fde79a
Compare
5fde79a to
d8d37bc
Compare
CriesofCarrots
left a comment
There was a problem hiding this comment.
Thanks, @behzadnouri . Logic looks fine, some nits.
| solana_sdk::declare_id!("8Zs9W7D9MpSEtUWSQdGniZk2cNmV22y6FLJwCx53asme"); | ||
| } | ||
|
|
||
| pub mod restrict_rent_paying_accounts_ttl_extension { |
There was a problem hiding this comment.
This name is kind of hard to parse at a glance. Can we call it something like: prevent_crediting_rent_paying_accounts? I would prefer we not add a phrase like "TTL extension" that then ought to be defined.
| post_data_size == pre_data_size && { | ||
| !restrict_rent_paying_accounts_ttl_extension | ||
| || post_lamports <= pre_lamports | ||
| } |
There was a problem hiding this comment.
Did cargo fmt wrap this extended boolean in brackets like this instead of parens? That's weird.
There was a problem hiding this comment.
Rust accepts both; I think in this case { gives more readable format:
post_data_size == pre_data_size && {
!prevent_crediting_rent_paying_accounts || post_lamports <= pre_lamports
}vs
post_data_size == pre_data_size
&& (!prevent_crediting_rent_paying_accounts
|| post_lamports <= pre_lamports)| }, | ||
| restrict_rent_paying_accounts_ttl_extension | ||
| )); | ||
| // No resize, same lamports is always allowed. |
There was a problem hiding this comment.
I understand that the word "transition" is implied here, but if you could find a way to rewrite these comments so they don't say "lamports is" so many times, I would appreciate it.
d8d37bc to
7a1e96e
Compare
jstarry
left a comment
There was a problem hiding this comment.
lgtm, just some nits on naming and code formatting
| // Cannot be RentPaying if resized | ||
| post_data_size == pre_data_size && { | ||
| !prevent_crediting_rent_paying_accounts || post_lamports <= pre_lamports | ||
| } |
There was a problem hiding this comment.
| // Cannot be RentPaying if resized | |
| post_data_size == pre_data_size && { | |
| !prevent_crediting_rent_paying_accounts || post_lamports <= pre_lamports | |
| } | |
| // Cannot remain RentPaying if resized | |
| if post_data_size != pre_data_size { | |
| false | |
| } else if prevent_crediting_rent_paying_accounts { | |
| // Cannot remain RentPaying if credited | |
| post_lamports <= pre_lamports | |
| } else { | |
| true | |
| } |
There was a problem hiding this comment.
I prefer this more-explicit suggestion too
| (cap_accounts_data_size_per_block::id(), "cap the accounts data size per block #25517"), | ||
| (preserve_rent_epoch_for_rent_exempt_accounts::id(), "preserve rent epoch for rent exempt accounts #26479"), | ||
| (enable_bpf_loader_extend_program_data_ix::id(), "enable bpf upgradeable loader ExtendProgramData instruction #25234"), | ||
| (prevent_crediting_rent_paying_accounts::id(), "prevent crediting rent paying accounts #26606"), |
There was a problem hiding this comment.
Technically rent paying accounts can be credited if they become rent exempt. Can you rename the feature module name and the description here to match your PR title? I think restrict_rent_paying_accounts_lifetime_extension would be pretty clear
There was a problem hiding this comment.
we are doing back and forth here; initially it was: restrict_rent_paying_accounts_ttl_extension.
@CriesofCarrots asked to change it: #26606 (comment)
There was a problem hiding this comment.
Yup I saw that comment thread as well. Like I said, I think that @CriesofCarrots's suggestion is a bit misleading so I hope that changing from "ttl" to "lifetime" is a good compromise.
There was a problem hiding this comment.
I don't have strong preference either way since this is going to be deleted soon anyways.
I will wait for @CriesofCarrots comment. If there is no objection, I can change it to what you suggest.
There was a problem hiding this comment.
Personally, I think it’s fine as-is, but to address Justin’s concern about lost nuance, it could be prevent_crediting_accounts_that_end_rent_paying or similar, I suppose.
I am opposed to the “lifetime” suggestion, as rust already has a definition of the word; I don’t think that “accounts lifetime extension” is that clear unless you already understand the problem, and I am disinclined to add new verbiage that ought to be explained, especially for functionality that is being made obsolete.
There was a problem hiding this comment.
prevent_crediting_accounts_that_end_rent_paying works for me
7a1e96e to
3299e60
Compare
CriesofCarrots
left a comment
There was a problem hiding this comment.
Comment nits. Otherwise, this lgtm
| // Transition is always allowed if there is no account data resize and | ||
| // account's lamports is reduced because that will shorten rent paying | ||
| // account lifeline. |
There was a problem hiding this comment.
| // Transition is always allowed if there is no account data resize and | |
| // account's lamports is reduced because that will shorten rent paying | |
| // account lifeline. | |
| // Transition is always allowed if there is no account data resize and | |
| // account's lamports is reduced. |
| // Once the feature is activated, transition is not allowed if the | ||
| // account is credited with more lamports. |
There was a problem hiding this comment.
| // Once the feature is activated, transition is not allowed if the | |
| // account is credited with more lamports. | |
| // Once the feature is activated, transition is not allowed if the | |
| // account is credited with more lamports and remains rent-paying. |
3299e60 to
5ab36a9
Compare
Pull request has been modified.
5ab36a9 to
6c826ce
Compare
solana-labs/solana#26606 prevents crediting a rent paying account if the account stays rent paying. As a result, test_lamport_transfer fails. The commit updates destination account lamports so that after transfer it is no longer rent paying.
solana-labs/solana#26606 prevents crediting a rent paying account if the account stays rent paying. As a result, test_lamport_transfer fails. The commit updates destination account lamports so that after transfer it is no longer rent paying.
solana-labs#22292 prevents rent paying accounts creation going forward. However a rent paying account can linger on for ever if it is continually topped up but stays below the rent-exempt minimum. This can prevent eliminating accounts-rewrites and the problematic rent_epoch field in accounts. Link to discord discussion: https://discord.com/channels/428295358100013066/943609352068145162/995202300001927219 This commit restricts rent-paying accounts lifeline extension by preventing increasing lamports on the account if the account stays below the rent-exempt minimum.
6c826ce to
ef05348
Compare
#22292 prevents rent paying accounts creation going forward. However a rent paying account can linger on for ever if it is continually topped up but stays below the rent-exempt minimum. This can prevent eliminating accounts-rewrites and the problematic rent_epoch field in accounts. Link to discord discussion: https://discord.com/channels/428295358100013066/943609352068145162/995202300001927219 This commit restricts rent-paying accounts lifetime extension by preventing increasing lamports on the account if the account stays below the rent-exempt minimum. (cherry picked from commit bf225ba) # Conflicts: # runtime/src/account_rent_state.rs # runtime/src/accounts.rs # runtime/src/bank/transaction_account_state_info.rs # sdk/src/feature_set.rs
…26635) * restricts rent-paying accounts lifetime extension (#26606) #22292 prevents rent paying accounts creation going forward. However a rent paying account can linger on for ever if it is continually topped up but stays below the rent-exempt minimum. This can prevent eliminating accounts-rewrites and the problematic rent_epoch field in accounts. Link to discord discussion: https://discord.com/channels/428295358100013066/943609352068145162/995202300001927219 This commit restricts rent-paying accounts lifetime extension by preventing increasing lamports on the account if the account stays below the rent-exempt minimum. (cherry picked from commit bf225ba) # Conflicts: # runtime/src/account_rent_state.rs # runtime/src/accounts.rs # runtime/src/bank/transaction_account_state_info.rs # sdk/src/feature_set.rs * removes mergify merge conflicts Co-authored-by: behzad nouri <behzadnouri@gmail.com>
solana-labs#22292 prevents rent paying accounts creation going forward. However a rent paying account can linger on for ever if it is continually topped up but stays below the rent-exempt minimum. This can prevent eliminating accounts-rewrites and the problematic rent_epoch field in accounts. Link to discord discussion: https://discord.com/channels/428295358100013066/943609352068145162/995202300001927219 This commit restricts rent-paying accounts lifetime extension by preventing increasing lamports on the account if the account stays below the rent-exempt minimum.
Problem
#22292 prevents rent paying accounts creation going forward. However a rent
paying account can linger on for ever if it is continually topped up but
stays below the rent-exempt minimum.
This can prevent eliminating accounts-rewrites and the problematic
rent_epoch field in accounts.
Link to discord discussion:
https://discord.com/channels/428295358100013066/943609352068145162/995202300001927219
Summary of Changes
This commit restricts rent-paying accounts lifetime extension by preventing
increasing lamports on the account if the account stays below the
rent-exempt minimum.
Feature Gate Issue: #26607