Allow sub-rent-exempt-minimum transfers to `1nc1nerator` (#23382)
* Add failing test * Allow small burns to incinerator * Use check_id method
This commit is contained in:
parent
e3fa55f88d
commit
19448ba078
|
@ -79,7 +79,9 @@ pub(crate) fn check_rent_state_with_account(
|
||||||
account_state: &AccountSharedData,
|
account_state: &AccountSharedData,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
submit_rent_state_metrics(pre_rent_state, post_rent_state);
|
submit_rent_state_metrics(pre_rent_state, post_rent_state);
|
||||||
if !post_rent_state.transition_allowed_from(pre_rent_state) {
|
if !solana_sdk::incinerator::check_id(address)
|
||||||
|
&& !post_rent_state.transition_allowed_from(pre_rent_state)
|
||||||
|
{
|
||||||
debug!(
|
debug!(
|
||||||
"Account {} not rent exempt, state {:?}",
|
"Account {} not rent exempt, state {:?}",
|
||||||
address, account_state,
|
address, account_state,
|
||||||
|
|
|
@ -16725,6 +16725,28 @@ pub(crate) mod tests {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure System transfers of any size can be made to the incinerator
|
||||||
|
#[test]
|
||||||
|
fn test_rent_state_incinerator() {
|
||||||
|
let GenesisConfigInfo {
|
||||||
|
mut genesis_config,
|
||||||
|
mint_keypair,
|
||||||
|
..
|
||||||
|
} = create_genesis_config_with_leader(sol_to_lamports(100.), &Pubkey::new_unique(), 42);
|
||||||
|
genesis_config.rent = Rent::default();
|
||||||
|
let rent_exempt_minimum = genesis_config.rent.minimum_balance(0);
|
||||||
|
|
||||||
|
// Activate features, including require_rent_exempt_accounts
|
||||||
|
activate_all_features(&mut genesis_config);
|
||||||
|
|
||||||
|
let bank = Bank::new_for_tests(&genesis_config);
|
||||||
|
|
||||||
|
for amount in [rent_exempt_minimum - 1, rent_exempt_minimum] {
|
||||||
|
bank.transfer(amount, &mint_keypair, &solana_sdk::incinerator::id())
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rent_state_list_len() {
|
fn test_rent_state_list_len() {
|
||||||
let GenesisConfigInfo {
|
let GenesisConfigInfo {
|
||||||
|
|
Loading…
Reference in New Issue