diff --git a/accounts-bench/src/main.rs b/accounts-bench/src/main.rs index e23be3ce7..01524b071 100644 --- a/accounts-bench/src/main.rs +++ b/accounts-bench/src/main.rs @@ -6,7 +6,8 @@ use rayon::prelude::*; use solana_measure::measure::Measure; use solana_runtime::{ accounts::{create_test_accounts, update_accounts_bench, Accounts}, - accounts_index::{AccountSecondaryIndexes, Ancestors}, + accounts_index::AccountSecondaryIndexes, + ancestors::Ancestors, }; use solana_sdk::{genesis_config::ClusterType, pubkey::Pubkey}; use std::{env, fs, path::PathBuf}; diff --git a/runtime/benches/accounts.rs b/runtime/benches/accounts.rs index 99f60c670..d7a27ad5a 100644 --- a/runtime/benches/accounts.rs +++ b/runtime/benches/accounts.rs @@ -8,7 +8,8 @@ use rand::Rng; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use solana_runtime::{ accounts::{create_test_accounts, AccountAddressFilter, Accounts}, - accounts_index::{AccountSecondaryIndexes, Ancestors}, + accounts_index::AccountSecondaryIndexes, + ancestors::Ancestors, bank::*, }; use solana_sdk::{ diff --git a/runtime/src/accounts.rs b/runtime/src/accounts.rs index d6223ac72..43d264e4a 100644 --- a/runtime/src/accounts.rs +++ b/runtime/src/accounts.rs @@ -2,7 +2,8 @@ use crate::{ accounts_db::{ AccountsDb, BankHashInfo, ErrorCounters, LoadHint, LoadedAccount, ScanStorageResult, }, - accounts_index::{AccountSecondaryIndexes, Ancestors, IndexKey}, + accounts_index::{AccountSecondaryIndexes, IndexKey}, + ancestors::Ancestors, bank::{ NonceRollbackFull, NonceRollbackInfo, TransactionCheckResult, TransactionExecutionResult, }, diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index e368208fe..168b1357d 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -23,8 +23,9 @@ use crate::{ accounts_hash::{AccountsHash, CalculateHashIntermediate, HashStats, PreviousPass}, accounts_index::{ AccountIndexGetResult, AccountSecondaryIndexes, AccountsIndex, AccountsIndexRootsStats, - Ancestors, IndexKey, IsCached, SlotList, SlotSlice, ZeroLamport, + IndexKey, IsCached, SlotList, SlotSlice, ZeroLamport, }, + ancestors::Ancestors, append_vec::{AppendVec, StoredAccountMeta, StoredMeta, StoredMetaWriteVersion}, contains::Contains, read_only_accounts_cache::ReadOnlyAccountsCache, diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 9fe583450..76761a44f 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -1,4 +1,5 @@ use crate::{ + ancestors::Ancestors, contains::Contains, inline_spl_token_v2_0::{self, SPL_TOKEN_ACCOUNT_MINT_OFFSET, SPL_TOKEN_ACCOUNT_OWNER_OFFSET}, secondary_index::*, @@ -15,7 +16,7 @@ use solana_sdk::{ use std::{ collections::{ btree_map::{self, BTreeMap}, - HashMap, HashSet, + HashSet, }, ops::{ Bound, @@ -32,7 +33,6 @@ pub const ITER_BATCH_SIZE: usize = 1000; pub type SlotList = Vec<(Slot, T)>; pub type SlotSlice<'s, T> = &'s [(Slot, T)]; -pub type Ancestors = HashMap; pub type RefCount = u64; pub type AccountMap = BTreeMap; diff --git a/runtime/src/ancestors.rs b/runtime/src/ancestors.rs new file mode 100644 index 000000000..d4c167206 --- /dev/null +++ b/runtime/src/ancestors.rs @@ -0,0 +1,4 @@ +use solana_sdk::clock::Slot; +use std::collections::HashMap; + +pub type Ancestors = HashMap; diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 90317eedd..e1ad5f433 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -39,7 +39,8 @@ use crate::{ TransactionLoadResult, TransactionLoaders, }, accounts_db::{ErrorCounters, SnapshotStorages}, - accounts_index::{AccountSecondaryIndexes, Ancestors, IndexKey}, + accounts_index::{AccountSecondaryIndexes, IndexKey}, + ancestors::Ancestors, blockhash_queue::BlockhashQueue, builtins::{self, ActivationType}, epoch_stakes::{EpochStakes, NodeVoteAccounts}, @@ -5185,9 +5186,8 @@ pub(crate) mod tests { use super::*; use crate::{ accounts_db::SHRINK_RATIO, - accounts_index::{ - AccountIndex, AccountMap, AccountSecondaryIndexes, Ancestors, ITER_BATCH_SIZE, - }, + accounts_index::{AccountIndex, AccountMap, AccountSecondaryIndexes, ITER_BATCH_SIZE}, + ancestors::Ancestors, genesis_utils::{ activate_all_features, bootstrap_validator_stake_lamports, create_genesis_config_with_leader, create_genesis_config_with_vote_accounts, diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 825075b0b..abc3f7617 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -6,6 +6,7 @@ pub mod accounts_cache; pub mod accounts_db; pub mod accounts_hash; pub mod accounts_index; +pub mod ancestors; pub mod append_vec; pub mod bank; pub mod bank_client; diff --git a/runtime/src/message_processor.rs b/runtime/src/message_processor.rs index 07dcfd1dd..2e5ef6003 100644 --- a/runtime/src/message_processor.rs +++ b/runtime/src/message_processor.rs @@ -1,5 +1,5 @@ use crate::{ - accounts::Accounts, accounts_index::Ancestors, instruction_recorder::InstructionRecorder, + accounts::Accounts, ancestors::Ancestors, instruction_recorder::InstructionRecorder, log_collector::LogCollector, native_loader::NativeLoader, rent_collector::RentCollector, }; use log::*; diff --git a/runtime/src/serde_snapshot.rs b/runtime/src/serde_snapshot.rs index 41044fbb8..0cfc7b2b9 100644 --- a/runtime/src/serde_snapshot.rs +++ b/runtime/src/serde_snapshot.rs @@ -2,7 +2,8 @@ use { crate::{ accounts::Accounts, accounts_db::{AccountStorageEntry, AccountsDb, AppendVecId, BankHashInfo}, - accounts_index::{AccountSecondaryIndexes, Ancestors}, + accounts_index::AccountSecondaryIndexes, + ancestors::Ancestors, append_vec::{AppendVec, StoredMetaWriteVersion}, bank::{Bank, BankFieldsToDeserialize, BankRc, Builtins}, blockhash_queue::BlockhashQueue, diff --git a/runtime/src/status_cache.rs b/runtime/src/status_cache.rs index 84cce7389..e66537ae6 100644 --- a/runtime/src/status_cache.rs +++ b/runtime/src/status_cache.rs @@ -1,4 +1,4 @@ -use crate::accounts_index::Ancestors; +use crate::ancestors::Ancestors; use log::*; use rand::{thread_rng, Rng}; diff --git a/runtime/tests/accounts.rs b/runtime/tests/accounts.rs index c58a71445..f04021aff 100644 --- a/runtime/tests/accounts.rs +++ b/runtime/tests/accounts.rs @@ -3,7 +3,7 @@ use rand::{thread_rng, Rng}; use rayon::prelude::*; use solana_runtime::{ accounts_db::{AccountsDb, LoadHint}, - accounts_index::Ancestors, + ancestors::Ancestors, }; use solana_sdk::genesis_config::ClusterType; use solana_sdk::{