Skip to content

Commit

Permalink
remove calculation of slots_per_year
Browse files Browse the repository at this point in the history
  • Loading branch information
LStan authored Feb 17, 2025
1 parent eee5cab commit 4ae6130
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion genesis-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ solana-frozen-abi-macro = { workspace = true, optional = true }
solana-hash = { workspace = true }
solana-inflation = { workspace = true }
solana-keypair = { workspace = true }
solana-logger = { workspace = true }
solana-native-token = { workspace = true }
solana-poh-config = { workspace = true }
solana-pubkey = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion rent-collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ solana-clock = { workspace = true }
solana-epoch-schedule = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true }
solana-frozen-abi-macro = { workspace = true, optional = true }
solana-genesis-config = { workspace = true }
solana-pubkey = { workspace = true }
solana-rent = { workspace = true }
solana-sdk-ids = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
solana-genesis-config = { workspace = true }
solana-logger = { workspace = true }
solana-pubkey = { workspace = true, features = ["rand"] }

Expand Down
9 changes: 6 additions & 3 deletions rent-collector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use {
solana_account::{AccountSharedData, ReadableAccount, WritableAccount},
solana_clock::Epoch,
solana_epoch_schedule::EpochSchedule,
solana_genesis_config::GenesisConfig,
solana_pubkey::Pubkey,
solana_rent::{Rent, RentDue},
solana_sdk_ids::incinerator,
Expand All @@ -27,11 +26,15 @@ pub struct RentCollector {

impl Default for RentCollector {
fn default() -> Self {
// slots_per_year derived from GenesisConfig::default() without calculations
// then checked in case it changes
let slots_per_year = 78892314.984;
#[cfg(test)]
assert!(slots_per_year == solana_genesis_config::GenesisConfig::default().slots_per_year());
Self {
epoch: Epoch::default(),
epoch_schedule: EpochSchedule::default(),
// derive default value using GenesisConfig::default()
slots_per_year: GenesisConfig::default().slots_per_year(),
slots_per_year,
rent: Rent::default(),
}
}
Expand Down

0 comments on commit 4ae6130

Please sign in to comment.