Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit d53f02e

Browse files
Remove lamports-per-byte-year and lamports-per-epoch from rent as all… (#29731)
Remove lamports-per-byte-year and lamports-per-epoch from rent as all accounts must be rent exempt
1 parent a72c2ec commit d53f02e

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

cli/src/cluster_query.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ use {
5959
slot_history::SlotHistory,
6060
stake_history::{self},
6161
},
62-
timing,
6362
transaction::Transaction,
6463
},
6564
solana_transaction_status::UiTransactionEncoding,
@@ -453,7 +452,7 @@ impl ClusterQuerySubCommands for App<'_, '_> {
453452
)
454453
.subcommand(
455454
SubCommand::with_name("rent")
456-
.about("Calculate per-epoch and rent-exempt-minimum values for a given account data field length.")
455+
.about("Calculate rent-exempt-minimum value for a given account data field length.")
457456
.arg(
458457
Arg::with_name("data_length")
459458
.index(1)
@@ -2088,8 +2087,6 @@ pub fn process_transaction_history(
20882087
#[derive(Serialize, Deserialize)]
20892088
#[serde(rename_all = "camelCase")]
20902089
struct CliRentCalculation {
2091-
pub lamports_per_byte_year: u64,
2092-
pub lamports_per_epoch: u64,
20932090
pub rent_exempt_minimum_lamports: u64,
20942091
#[serde(skip)]
20952092
pub use_lamports_unit: bool,
@@ -2103,11 +2100,7 @@ impl CliRentCalculation {
21032100

21042101
impl fmt::Display for CliRentCalculation {
21052102
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2106-
let per_byte_year = self.build_balance_message(self.lamports_per_byte_year);
2107-
let per_epoch = self.build_balance_message(self.lamports_per_epoch);
21082103
let exempt_minimum = self.build_balance_message(self.rent_exempt_minimum_lamports);
2109-
writeln_name_value(f, "Rent per byte-year:", &per_byte_year)?;
2110-
writeln_name_value(f, "Rent per epoch:", &per_epoch)?;
21112104
writeln_name_value(f, "Rent-exempt minimum:", &exempt_minimum)
21122105
}
21132106
}
@@ -2162,19 +2155,10 @@ pub fn process_calculate_rent(
21622155
data_length: usize,
21632156
use_lamports_unit: bool,
21642157
) -> ProcessResult {
2165-
let epoch_schedule = rpc_client.get_epoch_schedule()?;
21662158
let rent_account = rpc_client.get_account(&sysvar::rent::id())?;
21672159
let rent: Rent = rent_account.deserialize_data()?;
21682160
let rent_exempt_minimum_lamports = rent.minimum_balance(data_length);
2169-
let seconds_per_tick = Duration::from_secs_f64(1.0 / clock::DEFAULT_TICKS_PER_SECOND as f64);
2170-
let slots_per_year =
2171-
timing::years_as_slots(1.0, &seconds_per_tick, clock::DEFAULT_TICKS_PER_SLOT);
2172-
let slots_per_epoch = epoch_schedule.slots_per_epoch as f64;
2173-
let years_per_epoch = slots_per_epoch / slots_per_year;
2174-
let lamports_per_epoch = rent.due(0, data_length, years_per_epoch).lamports();
21752161
let cli_rent_calculation = CliRentCalculation {
2176-
lamports_per_byte_year: rent.lamports_per_byte_year,
2177-
lamports_per_epoch,
21782162
rent_exempt_minimum_lamports,
21792163
use_lamports_unit,
21802164
};

0 commit comments

Comments
 (0)