Skip to content
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
2 changes: 0 additions & 2 deletions accounts-db/src/ancestors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use {
std::collections::HashMap,
};

pub type AncestorsForSerialization = HashMap<Slot, usize>;

#[cfg_attr(feature = "frozen-abi", derive(AbiExample))]
#[derive(Clone, PartialEq)]
pub struct Ancestors {
Expand Down
11 changes: 4 additions & 7 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ use {
accounts_hash::AccountsLtHash,
accounts_index::{IndexKey, ScanConfig, ScanResult},
accounts_update_notifier_interface::AccountsUpdateNotifier,
ancestors::{Ancestors, AncestorsForSerialization},
ancestors::Ancestors,
blockhash_queue::BlockhashQueue,
storable_accounts::StorableAccounts,
utils::create_account_shared_data,
Expand Down Expand Up @@ -455,7 +455,6 @@ impl TransactionLogCollector {
#[derive(Clone, Debug)]
pub struct BankFieldsToDeserialize {
pub(crate) blockhash_queue: BlockhashQueue,
pub(crate) ancestors: AncestorsForSerialization,
pub(crate) hash: Hash,
pub(crate) parent_hash: Hash,
pub(crate) parent_slot: Slot,
Expand Down Expand Up @@ -499,7 +498,6 @@ pub struct BankFieldsToDeserialize {
#[derive(Debug)]
pub struct BankFieldsToSerialize {
pub blockhash_queue: BlockhashQueue,
pub ancestors: AncestorsForSerialization,
pub hash: Hash,
pub parent_hash: Hash,
pub parent_slot: Slot,
Expand Down Expand Up @@ -650,7 +648,6 @@ impl BankFieldsToSerialize {
pub fn default_for_tests() -> Self {
Self {
blockhash_queue: BlockhashQueue::default(),
ancestors: AncestorsForSerialization::default(),
hash: Hash::default(),
parent_hash: Hash::default(),
parent_slot: Slot::default(),
Expand Down Expand Up @@ -1846,7 +1843,8 @@ impl Bank {
epoch_stakes: HashMap<Epoch, VersionedEpochStakes>,
) -> Self {
let now = Instant::now();
let ancestors = Ancestors::from(&fields.ancestors);
let slot = fields.slot;
let ancestors = Ancestors::from(vec![slot]);
// For backward compatibility, we can only serialize and deserialize
// Stakes<Delegation> in BankFieldsTo{Serialize,Deserialize}. But Bank
// caches Stakes<StakeAccount>. Below Stakes<StakeAccount> is obtained
Expand Down Expand Up @@ -1902,7 +1900,7 @@ impl Bank {
ns_per_slot: fields.ns_per_slot,
genesis_creation_time: fields.genesis_creation_time,
slots_per_year: fields.slots_per_year,
slot: fields.slot,
slot,
bank_id: 0,
epoch: fields.epoch,
block_height: fields.block_height,
Expand Down Expand Up @@ -2008,7 +2006,6 @@ impl Bank {
pub(crate) fn get_fields_to_serialize(&self) -> BankFieldsToSerialize {
BankFieldsToSerialize {
blockhash_queue: self.blockhash_queue.read().unwrap().clone(),
ancestors: AncestorsForSerialization::from(&self.ancestors),
hash: *self.hash.read().unwrap(),
parent_hash: self.parent_hash,
parent_slot: self.parent_slot,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/bank/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ mod tests {
#[cfg_attr(
feature = "frozen-abi",
derive(AbiExample),
frozen_abi(digest = "FCDuswxZnGvvJURSkrQPshX45a25CR6UAmPgzGeUfMFv")
frozen_abi(digest = "HKTVanoy2iLbtAVwrt2y8HxH8YaWsgw4LZC9B76X6EL4")
)]
#[derive(serde::Serialize)]
pub struct BankAbiTestWrapper {
Expand Down
8 changes: 3 additions & 5 deletions runtime/src/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use {
accounts_file::{AccountsFile, StorageAccess},
accounts_hash::AccountsLtHash,
accounts_update_notifier_interface::AccountsUpdateNotifier,
ancestors::AncestorsForSerialization,
blockhash_queue::BlockhashQueue,
},
solana_clock::{Epoch, Slot, UnixTimestamp},
Expand Down Expand Up @@ -155,7 +154,7 @@ struct UnusedAccounts {
#[derive(Clone, Deserialize)]
struct DeserializableVersionedBank {
blockhash_queue: BlockhashQueue,
ancestors: AncestorsForSerialization,
_unused_ancestors: HashMap<Slot, usize>,
hash: Hash,
parent_hash: Hash,
parent_slot: Slot,
Expand Down Expand Up @@ -195,7 +194,6 @@ impl From<DeserializableVersionedBank> for BankFieldsToDeserialize {
const LT_HASH_CANARY: LtHash = LtHash([0xCAFE; LtHash::NUM_ELEMENTS]);
BankFieldsToDeserialize {
blockhash_queue: dvb.blockhash_queue,
ancestors: dvb.ancestors,
hash: dvb.hash,
parent_hash: dvb.parent_hash,
parent_slot: dvb.parent_slot,
Expand Down Expand Up @@ -233,7 +231,7 @@ impl From<DeserializableVersionedBank> for BankFieldsToDeserialize {
#[derive(Serialize)]
struct SerializableVersionedBank {
blockhash_queue: BlockhashQueue,
ancestors: AncestorsForSerialization,
unused_ancestors: HashMap<Slot, usize>,
hash: Hash,
parent_hash: Hash,
parent_slot: Slot,
Expand Down Expand Up @@ -271,7 +269,7 @@ impl From<BankFieldsToSerialize> for SerializableVersionedBank {
fn from(rhs: BankFieldsToSerialize) -> Self {
Self {
blockhash_queue: rhs.blockhash_queue,
ancestors: rhs.ancestors,
unused_ancestors: HashMap::default(),
hash: rhs.hash,
parent_hash: rhs.parent_hash,
parent_slot: rhs.parent_slot,
Expand Down
Loading