Skip to content

Commit

Permalink
syavar rent_epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Oct 31, 2024
1 parent 4994762 commit 9e94f89
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,15 @@ impl Bank {
// More generally, this code always re-calculates for possible sysvar data size change,
// although there is no such sysvars currently.
self.adjust_sysvar_balance_for_rent(&mut new_account);

// When new sysvar comes into existence, this code ensures that the
// sysvar's rent_epoch is set to RENT_EXEMPT_EPOCH (i.e. U64::MAX). This
// is because sysvars are never deleted, and are always rent exempt.
// Currently, it relies on rent collection code to update rent_epoch to
// RENT_EXEMPT_EPOCH. In the future, we will remove rent collection
// code. Therefore, we should set rent_epoch here, and don't depend on
// rent collection code to update rent_epoch..
self.adjust_sysvar_rent_epoch(&mut new_account);
self.store_account_and_update_capitalization(pubkey, &new_account);
}

Expand Down Expand Up @@ -6660,6 +6669,10 @@ impl Bank {
);
}

fn adjust_sysvar_rent_epoch(&self, account: &mut AccountSharedData) {
account.set_rent_epoch(solana_sdk::rent_collector::RENT_EXEMPT_RENT_EPOCH);
}

/// Compute the active feature set based on the current bank state,
/// and return it together with the set of newly activated features.
fn compute_active_feature_set(&self, include_pending: bool) -> (FeatureSet, HashSet<Pubkey>) {
Expand Down

0 comments on commit 9e94f89

Please sign in to comment.