Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion rent-collector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ impl Default for RentCollector {
/// When rent is collected from an exempt account, rent_epoch is set to this
/// value. The idea is to have a fixed, consistent value for rent_epoch for all accounts that do not collect rent.
/// This enables us to get rid of the field completely.
#[deprecated(since = "2.3.0", note = "Redefine this constant elsewhere")]
pub const RENT_EXEMPT_RENT_EPOCH: Epoch = Epoch::MAX;

/// when rent is collected for this account, this is the action to apply to the account
#[derive(Debug)]
#[deprecated(since = "2.3.0", note = "Redefine this struct elsewhere if needed")]
enum RentResult {
/// this account will never have rent collected from it
Exempt,
Expand Down Expand Up @@ -79,13 +81,15 @@ impl RentCollector {
}

/// true if it is easy to determine this account should consider having rent collected from it
#[deprecated(since = "2.3.0", note = "Redefine this logic elsewhere if needed")]
pub fn should_collect_rent(&self, address: &Pubkey, executable: bool) -> bool {
!(executable // executable accounts must be rent-exempt balance
|| *address == incinerator::id())
}

/// given an account that 'should_collect_rent'
/// returns (amount rent due, is_exempt_from_rent)
#[deprecated(since = "2.3.0", note = "Redefine this logic elsewhere if needed")]
pub fn get_rent_due(
&self,
lamports: u64,
Expand Down Expand Up @@ -119,6 +123,8 @@ impl RentCollector {
// This is NOT thread safe at some level. If we try to collect from the same account in
// parallel, we may collect twice.
#[must_use = "add to Bank::collected_rent"]
#[deprecated(since = "2.3.0", note = "Redefine this logic elsewhere if needed")]
#[allow(deprecated)]
pub fn collect_from_existing_account(
&self,
address: &Pubkey,
Expand Down Expand Up @@ -155,6 +161,7 @@ impl RentCollector {

/// determine what should happen to collect rent from this account
#[must_use]
#[allow(deprecated)]
fn calculate_rent_result(
&self,
address: &Pubkey,
Expand Down Expand Up @@ -190,13 +197,15 @@ impl RentCollector {

/// Information computed during rent collection
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq)]
#[deprecated(since = "2.3.0", note = "Redefine this logic elsewhere if needed")]
pub struct CollectedInfo {
/// Amount of rent collected from account
pub rent_amount: u64,
/// Size of data reclaimed from account (happens when account's lamports go to zero)
pub account_data_len_reclaimed: u64,
}

#[allow(deprecated)]
impl std::ops::Add for CollectedInfo {
type Output = Self;
fn add(self, other: Self) -> Self {
Expand All @@ -209,14 +218,16 @@ impl std::ops::Add for CollectedInfo {
}
}

#[allow(deprecated)]
#[allow(clippy::arithmetic_side_effects)]
impl std::ops::AddAssign for CollectedInfo {
#![allow(clippy::arithmetic_side_effects)]
fn add_assign(&mut self, other: Self) {
*self = *self + other;
}
}

#[cfg(test)]
#[allow(deprecated)]
mod tests {
use {
super::*, assert_matches::assert_matches, solana_account::Account, solana_sdk_ids::sysvar,
Expand Down
Loading