show rent model (#7410)

This commit is contained in:
Rob Walker 2019-12-10 14:50:55 -08:00 committed by GitHub
parent 96c08cd295
commit 7d6777a96f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 42 deletions

View File

@ -129,46 +129,39 @@ mod tests {
); );
} }
// uncomment me and make my eprintlns macros #[ignore]
// #[test] #[test]
// fn test_rent_model() { #[should_panic]
// use crate::timing::*; fn show_rent_model() {
// use crate::{clock::*, sysvar::Sysvar, timing::*};
// const SECONDS_PER_YEAR: f64 = (365.25 * 24.0 * 60.0 * 60.0);
// const SLOTS_PER_YEAR: f64 = const SLOTS_PER_YEAR: f64 =
// SECONDS_PER_YEAR / (DEFAULT_TICKS_PER_SLOT as f64 / DEFAULT_TICKS_PER_SECOND as f64); SECONDS_PER_YEAR / (DEFAULT_TICKS_PER_SLOT as f64 / DEFAULT_TICKS_PER_SECOND as f64);
//
// let rent = Rent::default(); let rent = Rent::default();
// panic!(
// eprintln(); "\n\n\
// // lamports charged per byte per slot at $1/MByear, rent per slot is zero ==================================================\n\
// eprintln( empty account, no data:\n\
// "{} lamports per byte-slot, rent.due(): {}", \t{} lamports per epoch, {} lamports to be rent_exempt\n\n\
// (1.0 / SLOTS_PER_YEAR) * DEFAULT_LAMPORTS_PER_BYTE_YEAR as f64, stake_history, which is {}kB of data:\n\
// rent.due(0, 1, 1.0 / SLOTS_PER_YEAR).0, \t{} lamports per epoch, {} lamports to be rent_exempt\n\
// ); ==================================================\n\n",
// // lamports charged per byte per _epoch_ starts to have some significant digits rent.due(
// eprintln( 0,
// "{} lamports per byte-epoch, rent.due(): {}", 0,
// (1.0 / SLOTS_PER_YEAR) (1.0 / SLOTS_PER_YEAR) * DEFAULT_SLOTS_PER_EPOCH as f64,
// * (DEFAULT_LAMPORTS_PER_BYTE_YEAR * DEFAULT_SLOTS_PER_EPOCH) as f64, )
// rent.due( .0,
// 0, rent.minimum_balance(0),
// 1, crate::sysvar::stake_history::StakeHistory::size_of() / 1024,
// (1.0 / SLOTS_PER_YEAR) * DEFAULT_SLOTS_PER_EPOCH as f64 rent.due(
// ) 0,
// .0, crate::sysvar::stake_history::StakeHistory::size_of(),
// ); (1.0 / SLOTS_PER_YEAR) * DEFAULT_SLOTS_PER_EPOCH as f64,
// // have a look at what a large-ish sysvar would cost, were it a real account... )
// eprintln( .0,
// "stake_history: {}kB == {} lamports per epoch", rent.minimum_balance(crate::sysvar::stake_history::StakeHistory::size_of()),
// crate::sysvar::stake_history::StakeHistory::size_of() / 1024, );
// rent.due( }
// 0,
// crate::sysvar::stake_history::StakeHistory::size_of(),
// (1.0 / SLOTS_PER_YEAR) * DEFAULT_SLOTS_PER_EPOCH as f64
// )
// .0,
// );
// }
} }