diff --git a/core/src/snapshot_packager_service.rs b/core/src/snapshot_packager_service.rs index 4db4dbfb3a..589017ff84 100644 --- a/core/src/snapshot_packager_service.rs +++ b/core/src/snapshot_packager_service.rs @@ -59,10 +59,8 @@ mod tests { snapshot_utils::{self, SNAPSHOT_STATUS_CACHE_FILE_NAME}, }; use solana_runtime::{ - accounts_db::AccountStorageEntry, bank::MAX_SNAPSHOT_DATA_FILE_SIZE, - status_cache::SlotDelta, + accounts_db::AccountStorageEntry, bank::BankSlotDelta, bank::MAX_SNAPSHOT_DATA_FILE_SIZE, }; - use solana_sdk::transaction; use std::{ fs::{self, remove_dir_all, OpenOptions}, io::Write, @@ -149,7 +147,7 @@ mod tests { // before we compare, stick an empty status_cache in this dir so that the package comparision works // This is needed since the status_cache is added by the packager and is not collected from // the source dir for snapshots - let dummy_slot_deltas: Vec>> = vec![]; + let dummy_slot_deltas: Vec = vec![]; snapshot_utils::serialize_snapshot_data_file( &snapshots_dir.join(SNAPSHOT_STATUS_CACHE_FILE_NAME), MAX_SNAPSHOT_DATA_FILE_SIZE, diff --git a/core/tests/bank_forks.rs b/core/tests/bank_forks.rs index e7ad14b4d6..603814792b 100644 --- a/core/tests/bank_forks.rs +++ b/core/tests/bank_forks.rs @@ -14,15 +14,15 @@ mod tests { snapshot_utils, }; use solana_runtime::{ - bank::Bank, - status_cache::{SlotDelta, MAX_CACHE_ENTRIES}, + bank::{Bank, BankSlotDelta}, + status_cache::MAX_CACHE_ENTRIES, }; use solana_sdk::{ clock::Slot, hash::hashv, pubkey::Pubkey, signature::{Keypair, KeypairUtil}, - system_transaction, transaction, + system_transaction, }; use std::{fs, path::PathBuf, sync::atomic::AtomicBool, sync::mpsc::channel, sync::Arc}; use tempfile::TempDir; @@ -312,7 +312,7 @@ mod tests { // before we compare, stick an empty status_cache in this dir so that the package comparision works // This is needed since the status_cache is added by the packager and is not collected from // the source dir for snapshots - let dummy_slot_deltas: Vec>> = vec![]; + let dummy_slot_deltas: Vec = vec![]; snapshot_utils::serialize_snapshot_data_file( &saved_snapshots_dir .path() diff --git a/ledger/src/snapshot_package.rs b/ledger/src/snapshot_package.rs index 3c1598d757..26064f435c 100644 --- a/ledger/src/snapshot_package.rs +++ b/ledger/src/snapshot_package.rs @@ -1,6 +1,6 @@ use solana_runtime::accounts_db::AccountStorageEntry; -use solana_runtime::status_cache::SlotDelta; -use solana_sdk::{clock::Slot, transaction}; +use solana_runtime::bank::BankSlotDelta; +use solana_sdk::clock::Slot; use std::path::PathBuf; use std::sync::mpsc::{Receiver, SendError, Sender}; use std::sync::Arc; @@ -13,7 +13,7 @@ pub type SnapshotPackageSendError = SendError; #[derive(Debug)] pub struct SnapshotPackage { pub root: Slot, - pub slot_deltas: Vec>>, + pub slot_deltas: Vec, pub snapshot_links: TempDir, pub storage_entries: Vec>, pub tar_output_file: PathBuf, @@ -22,7 +22,7 @@ pub struct SnapshotPackage { impl SnapshotPackage { pub fn new( root: Slot, - slot_deltas: Vec>>, + slot_deltas: Vec, snapshot_links: TempDir, storage_entries: Vec>, tar_output_file: PathBuf, diff --git a/ledger/src/snapshot_utils.rs b/ledger/src/snapshot_utils.rs index 9b38051b35..1b95fca101 100644 --- a/ledger/src/snapshot_utils.rs +++ b/ledger/src/snapshot_utils.rs @@ -4,12 +4,10 @@ use bzip2::bufread::BzDecoder; use fs_extra::dir::CopyOptions; use log::*; use solana_measure::measure::Measure; -use solana_runtime::{ - bank::{self, deserialize_from_snapshot, Bank, MAX_SNAPSHOT_DATA_FILE_SIZE}, - status_cache::SlotDelta, +use solana_runtime::bank::{ + self, deserialize_from_snapshot, Bank, BankSlotDelta, MAX_SNAPSHOT_DATA_FILE_SIZE, }; -use solana_sdk::transaction::Result as TransactionResult; -use solana_sdk::{clock::Slot, transaction}; +use solana_sdk::clock::Slot; use std::{ cmp::Ordering, fs::{self, File}, @@ -362,7 +360,7 @@ pub fn add_snapshot>(snapshot_path: P, bank: &Bank) -> Result>], + slot_deltas: &[BankSlotDelta], snapshot_links: &TempDir, ) -> Result<()> { // the status cache is stored as snapshot_path/status_cache @@ -549,8 +547,7 @@ where MAX_SNAPSHOT_DATA_FILE_SIZE, |stream| { // Rebuild status cache - let slot_deltas: Vec>> = - deserialize_from_snapshot(stream)?; + let slot_deltas: Vec = deserialize_from_snapshot(stream)?; Ok(slot_deltas) }, diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index e8da6e7144..90247f39c5 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -67,6 +67,7 @@ pub const MAX_SNAPSHOT_DATA_FILE_SIZE: u64 = 32 * 1024 * 1024 * 1024; // 32 GiB pub const MAX_LEADER_SCHEDULE_STAKES: Epoch = 5; type BankStatusCache = StatusCache>; +pub type BankSlotDelta = SlotDelta>; type TransactionAccountRefCells = Vec>>; type TransactionLoaderRefCells = Vec)>>; @@ -143,7 +144,7 @@ pub struct StatusCacheRc { } impl StatusCacheRc { - pub fn slot_deltas(&self, slots: &[Slot]) -> Vec>> { + pub fn slot_deltas(&self, slots: &[Slot]) -> Vec { let sc = self.status_cache.read().unwrap(); sc.slot_deltas(slots) } @@ -159,7 +160,7 @@ impl StatusCacheRc { .collect() } - pub fn append(&self, slot_deltas: &[SlotDelta>]) { + pub fn append(&self, slot_deltas: &[BankSlotDelta]) { let mut sc = self.status_cache.write().unwrap(); sc.append(slot_deltas); }