-
Notifications
You must be signed in to change notification settings - Fork 4.5k
restricts rent-paying accounts lifetime extension #26606
restricts rent-paying accounts lifetime extension #26606
Conversation
33da4c9
to
5fde79a
Compare
5fde79a
to
d8d37bc
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.
Thanks, @behzadnouri . Logic looks fine, some nits.
sdk/src/feature_set.rs
Outdated
@@ -456,6 +456,10 @@ pub mod enable_bpf_loader_extend_program_data_ix { | |||
solana_sdk::declare_id!("8Zs9W7D9MpSEtUWSQdGniZk2cNmV22y6FLJwCx53asme"); | |||
} | |||
|
|||
pub mod restrict_rent_paying_accounts_ttl_extension { |
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.
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.
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.
done.
runtime/src/account_rent_state.rs
Outdated
post_data_size == pre_data_size && { | ||
!restrict_rent_paying_accounts_ttl_extension | ||
|| post_lamports <= pre_lamports | ||
} |
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.
Did cargo fmt
wrap this extended boolean in brackets like this instead of parens? That's weird.
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.
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)
runtime/src/account_rent_state.rs
Outdated
}, | ||
restrict_rent_paying_accounts_ttl_extension | ||
)); | ||
// No resize, same lamports is always allowed. |
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 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.
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.
done.
d8d37bc
to
7a1e96e
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.
lgtm, just some nits on naming and code formatting
runtime/src/account_rent_state.rs
Outdated
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer this more-explicit suggestion too
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.
done
sdk/src/feature_set.rs
Outdated
@@ -564,6 +568,7 @@ lazy_static! { | |||
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent_crediting_accounts_that_end_rent_paying
works for me
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.
done
7a1e96e
to
3299e60
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.
Comment nits. Otherwise, this lgtm
runtime/src/account_rent_state.rs
Outdated
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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. |
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.
done
runtime/src/account_rent_state.rs
Outdated
// Once the feature is activated, transition is not allowed if the | ||
// account is credited with more lamports. |
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.
// 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. |
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.
done
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 <[email protected]>
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