Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
18 changes: 0 additions & 18 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,6 @@ pub(crate) struct BankFieldsToDeserialize {
pub(crate) ns_per_slot: u128,
pub(crate) genesis_creation_time: UnixTimestamp,
pub(crate) slots_per_year: f64,
#[allow(dead_code)]
pub(crate) unused: u64,
pub(crate) slot: Slot,
pub(crate) epoch: Epoch,
pub(crate) block_height: u64,
Expand Down Expand Up @@ -904,7 +902,6 @@ pub(crate) struct BankFieldsToSerialize<'a> {
pub(crate) ns_per_slot: u128,
pub(crate) genesis_creation_time: UnixTimestamp,
pub(crate) slots_per_year: f64,
pub(crate) unused: u64,
pub(crate) slot: Slot,
pub(crate) epoch: Epoch,
pub(crate) block_height: u64,
Expand Down Expand Up @@ -943,7 +940,6 @@ impl PartialEq for Bank {
&& self.ns_per_slot == other.ns_per_slot
&& self.genesis_creation_time == other.genesis_creation_time
&& self.slots_per_year == other.slots_per_year
&& self.unused == other.unused
&& self.slot == other.slot
&& self.epoch == other.epoch
&& self.block_height == other.block_height
Expand Down Expand Up @@ -1095,9 +1091,6 @@ pub struct Bank {
/// The number of slots per year, used for inflation
slots_per_year: f64,

/// Unused
unused: u64,

/// Bank slot (i.e. block)
slot: Slot,

Expand Down Expand Up @@ -1300,7 +1293,6 @@ impl Bank {
ns_per_slot: u128::default(),
genesis_creation_time: UnixTimestamp::default(),
slots_per_year: f64::default(),
unused: u64::default(),
slot: Slot::default(),
bank_id: BankId::default(),
epoch: Epoch::default(),
Expand Down Expand Up @@ -1531,7 +1523,6 @@ impl Bank {
ticks_per_slot: parent.ticks_per_slot,
ns_per_slot: parent.ns_per_slot,
genesis_creation_time: parent.genesis_creation_time,
unused: parent.unused,
slots_per_year: parent.slots_per_year,
epoch_schedule,
collected_rent: AtomicU64::new(0),
Expand Down Expand Up @@ -1738,7 +1729,6 @@ impl Bank {
ns_per_slot: fields.ns_per_slot,
genesis_creation_time: fields.genesis_creation_time,
slots_per_year: fields.slots_per_year,
unused: genesis_config.unused,
slot: fields.slot,
bank_id: 0,
epoch: fields.epoch,
Expand Down Expand Up @@ -1798,7 +1788,6 @@ impl Bank {
* genesis_config.ticks_per_slot as u128
);
assert_eq!(bank.genesis_creation_time, genesis_config.creation_time);
assert_eq!(bank.unused, genesis_config.unused);
assert_eq!(bank.max_tick_height, (bank.slot + 1) * bank.ticks_per_slot);
assert_eq!(
bank.slots_per_year,
Expand Down Expand Up @@ -1843,7 +1832,6 @@ impl Bank {
ns_per_slot: self.ns_per_slot,
genesis_creation_time: self.genesis_creation_time,
slots_per_year: self.slots_per_year,
unused: self.unused,
slot: self.slot,
epoch: self.epoch,
block_height: self.block_height,
Expand Down Expand Up @@ -1980,11 +1968,6 @@ impl Bank {
)
}

/// Unused conversion
pub fn get_unused_from_slot(rooted_slot: Slot, unused: u64) -> u64 {
(rooted_slot + (unused - 1)) / unused
}

pub fn clock(&self) -> sysvar::clock::Clock {
from_account(&self.get_account(&sysvar::clock::id()).unwrap_or_default())
.unwrap_or_default()
Expand Down Expand Up @@ -2910,7 +2893,6 @@ impl Bank {
self.ticks_per_slot = genesis_config.ticks_per_slot();
self.ns_per_slot = genesis_config.ns_per_slot();
self.genesis_creation_time = genesis_config.creation_time;
self.unused = genesis_config.unused;
self.max_tick_height = (self.slot + 1) * self.ticks_per_slot;
self.slots_per_year = genesis_config.slots_per_year();

Expand Down
9 changes: 3 additions & 6 deletions runtime/src/serde_snapshot/newer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct DeserializableVersionedBank {
ns_per_slot: u128,
genesis_creation_time: UnixTimestamp,
slots_per_year: f64,
#[allow(dead_code)]
unused: u64,
slot: Slot,
epoch: Epoch,
Expand Down Expand Up @@ -71,7 +72,6 @@ impl From<DeserializableVersionedBank> for BankFieldsToDeserialize {
ns_per_slot: dvb.ns_per_slot,
genesis_creation_time: dvb.genesis_creation_time,
slots_per_year: dvb.slots_per_year,
unused: dvb.unused,
slot: dvb.slot,
epoch: dvb.epoch,
block_height: dvb.block_height,
Expand Down Expand Up @@ -130,9 +130,6 @@ struct SerializableVersionedBank<'a> {

impl<'a> From<crate::bank::BankFieldsToSerialize<'a>> for SerializableVersionedBank<'a> {
fn from(rhs: crate::bank::BankFieldsToSerialize<'a>) -> Self {
fn new<T: Default>() -> T {
T::default()
}
Self {
blockhash_queue: rhs.blockhash_queue,
ancestors: rhs.ancestors,
Expand All @@ -150,7 +147,7 @@ impl<'a> From<crate::bank::BankFieldsToSerialize<'a>> for SerializableVersionedB
ns_per_slot: rhs.ns_per_slot,
genesis_creation_time: rhs.genesis_creation_time,
slots_per_year: rhs.slots_per_year,
unused: rhs.unused,
unused: u64::default(),
slot: rhs.slot,
epoch: rhs.epoch,
block_height: rhs.block_height,
Expand All @@ -163,7 +160,7 @@ impl<'a> From<crate::bank::BankFieldsToSerialize<'a>> for SerializableVersionedB
epoch_schedule: rhs.epoch_schedule,
inflation: rhs.inflation,
stakes: rhs.stakes,
unused_accounts: new(),
unused_accounts: UnusedAccounts::default(),
epoch_stakes: rhs.epoch_stakes,
is_delta: rhs.is_delta,
}
Expand Down