Move BankForks to solana_runtime (#10637)

* Move BankForks to solana_runtime

* Update imports
This commit is contained in:
Greg Fitzgerald
2020-06-17 09:27:03 -06:00
committed by GitHub
parent 336339ac33
commit 6ee222363e
56 changed files with 450 additions and 130 deletions

View File

@ -2,7 +2,7 @@
//
// This can be expensive since we have to walk the append vecs being cleaned up.
use solana_ledger::bank_forks::BankForks;
use solana_runtime::bank_forks::BankForks;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, RwLock,

View File

@ -5,9 +5,8 @@
// set and halt the node if a mismatch is detected.
use crate::cluster_info::{ClusterInfo, MAX_SNAPSHOT_HASHES};
use solana_ledger::{
snapshot_package::AccountsPackage, snapshot_package::AccountsPackageReceiver,
snapshot_package::AccountsPackageSender,
use solana_runtime::snapshot_package::{
AccountsPackage, AccountsPackageReceiver, AccountsPackageSender,
};
use solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey};
use std::collections::{HashMap, HashSet};
@ -176,7 +175,7 @@ mod tests {
use super::*;
use crate::cluster_info::make_accounts_hashes_message;
use crate::contact_info::ContactInfo;
use solana_ledger::bank_forks::CompressionType;
use solana_runtime::bank_forks::CompressionType;
use solana_sdk::{
hash::hash,
signature::{Keypair, Signer},

View File

@ -3,8 +3,7 @@ use crate::{
fork_choice::ForkChoice,
progress_map::{ForkStats, ProgressMap},
};
use solana_ledger::bank_forks::BankForks;
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use solana_sdk::timing;
use std::time::Instant;
use std::{

View File

@ -37,7 +37,7 @@ use itertools::Itertools;
use rayon::iter::IntoParallelIterator;
use rayon::iter::ParallelIterator;
use rayon::ThreadPool;
use solana_ledger::{bank_forks::BankForks, staking_utils};
use solana_ledger::staking_utils;
use solana_measure::measure::Measure;
use solana_measure::thread_mem_usage;
use solana_metrics::{datapoint_debug, inc_new_counter_debug, inc_new_counter_error};
@ -50,6 +50,7 @@ use solana_perf::packet::{
PACKET_DATA_SIZE,
};
use solana_rayon_threadlimit::get_thread_count;
use solana_runtime::bank_forks::BankForks;
use solana_sdk::hash::Hash;
use solana_sdk::{
clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_SLOTS_PER_EPOCH},

View File

@ -14,11 +14,11 @@ use crossbeam_channel::{
};
use itertools::izip;
use log::*;
use solana_ledger::bank_forks::BankForks;
use solana_metrics::inc_new_counter_debug;
use solana_perf::packet::{self, Packets};
use solana_runtime::{
bank::Bank,
bank_forks::BankForks,
epoch_stakes::{EpochAuthorizedVoters, EpochStakes},
};
use solana_sdk::{

View File

@ -2,8 +2,7 @@ use crate::{
cluster_info::ClusterInfo, contact_info::ContactInfo, epoch_slots::EpochSlots,
pubkey_references::LockedPubkeyReferences, serve_repair::RepairType,
};
use solana_ledger::bank_forks::BankForks;
use solana_runtime::epoch_stakes::NodeIdToVoteAccounts;
use solana_runtime::{bank_forks::BankForks, epoch_stakes::NodeIdToVoteAccounts};
use solana_sdk::{clock::Slot, pubkey::Pubkey};
use std::{
collections::{HashMap, HashSet},

View File

@ -4,8 +4,7 @@ use crate::{
pubkey_references::PubkeyReferences,
};
use chrono::prelude::*;
use solana_ledger::bank_forks::BankForks;
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use solana_sdk::{
account::Account,
clock::{Slot, UnixTimestamp},
@ -666,9 +665,9 @@ pub mod test {
progress_map::ForkProgress,
replay_stage::{HeaviestForkFailures, ReplayStage},
};
use solana_ledger::bank_forks::BankForks;
use solana_runtime::{
bank::Bank,
bank_forks::BankForks,
genesis_utils::{
create_genesis_config_with_vote_accounts, GenesisConfigInfo, ValidatorVoteKeypairs,
},

View File

@ -3,8 +3,7 @@ use crate::{
progress_map::ProgressMap,
replay_stage::HeaviestForkFailures,
};
use solana_ledger::bank_forks::BankForks;
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use std::{
collections::{HashMap, HashSet},
sync::{Arc, RwLock},

View File

@ -4,8 +4,8 @@ use crate::cluster_info::{ClusterInfo, VALIDATOR_PORT_RANGE};
use crate::contact_info::ContactInfo;
use rand::{thread_rng, Rng};
use solana_client::thin_client::{create_client, ThinClient};
use solana_ledger::bank_forks::BankForks;
use solana_perf::recycler::Recycler;
use solana_runtime::bank_forks::BankForks;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, Signer};
use solana_streamer::streamer;

View File

@ -4,8 +4,7 @@ use crate::{
heaviest_subtree_fork_choice::HeaviestSubtreeForkChoice,
progress_map::ProgressMap,
};
use solana_ledger::bank_forks::BankForks;
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use std::{
collections::{HashMap, HashSet},
sync::{Arc, RwLock},

View File

@ -1,5 +1,5 @@
#[cfg(test)]
use solana_ledger::bank_forks::BankForks;
use solana_runtime::bank_forks::BankForks;
use solana_runtime::{bank::Bank, epoch_stakes::EpochStakes};
use solana_sdk::{
clock::{Epoch, Slot},

View File

@ -3,11 +3,8 @@ use crate::{
consensus::StakeLockout, pubkey_references::PubkeyReferences,
replay_stage::SUPERMINORITY_THRESHOLD,
};
use solana_ledger::{
bank_forks::BankForks,
blockstore_processor::{ConfirmationProgress, ConfirmationTiming},
};
use solana_runtime::bank::Bank;
use solana_ledger::blockstore_processor::{ConfirmationProgress, ConfirmationTiming};
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use solana_sdk::{account::Account, clock::Slot, hash::Hash, pubkey::Pubkey};
use std::{
collections::{BTreeMap, HashMap, HashSet},

View File

@ -9,11 +9,10 @@ use crate::{
};
use crossbeam_channel::{Receiver as CrossbeamReceiver, Sender as CrossbeamSender};
use solana_ledger::{
bank_forks::BankForks,
blockstore::{Blockstore, CompletedSlotsReceiver, SlotMeta},
shred::Nonce,
};
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use solana_sdk::{clock::Slot, epoch_schedule::EpochSchedule, pubkey::Pubkey, timing::timestamp};
use std::{
collections::HashMap,

View File

@ -20,17 +20,15 @@ use crate::{
rpc_subscriptions::RpcSubscriptions,
};
use solana_ledger::{
bank_forks::BankForks,
block_error::BlockError,
blockstore::Blockstore,
blockstore_processor::{self, BlockstoreProcessorError, TransactionStatusSender},
entry::VerifyRecyclers,
leader_schedule_cache::LeaderScheduleCache,
snapshot_package::AccountsPackageSender,
};
use solana_measure::thread_mem_usage;
use solana_metrics::inc_new_counter_info;
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks, snapshot_package::AccountsPackageSender};
use solana_sdk::{
clock::{Slot, NUM_CONSECUTIVE_LEADER_SLOTS},
genesis_config::OperatingMode,

View File

@ -4,7 +4,7 @@ use crate::cluster_info;
use crate::poh_recorder;
use solana_ledger::block_error;
use solana_ledger::blockstore;
use solana_ledger::snapshot_utils;
use solana_runtime::snapshot_utils;
use solana_sdk::transaction;
use std::any::Any;

View File

@ -11,7 +11,6 @@ use crate::{
};
use crossbeam_channel::Receiver;
use solana_ledger::{
bank_forks::BankForks,
blockstore::{Blockstore, CompletedSlotsReceiver},
leader_schedule_cache::LeaderScheduleCache,
staking_utils,
@ -19,6 +18,7 @@ use solana_ledger::{
use solana_measure::measure::Measure;
use solana_metrics::inc_new_counter_error;
use solana_perf::packet::Packets;
use solana_runtime::bank_forks::BankForks;
use solana_sdk::clock::{Epoch, Slot};
use solana_sdk::epoch_schedule::EpochSchedule;
use solana_sdk::pubkey::Pubkey;

View File

@ -23,12 +23,11 @@ use solana_client::{
rpc_response::*,
};
use solana_faucet::faucet::request_airdrop_transaction;
use solana_ledger::{
bank_forks::BankForks, blockstore::Blockstore, blockstore_db::BlockstoreError,
get_tmp_ledger_path,
};
use solana_ledger::{blockstore::Blockstore, blockstore_db::BlockstoreError, get_tmp_ledger_path};
use solana_perf::packet::PACKET_DATA_SIZE;
use solana_runtime::{accounts::AccountAddressFilter, bank::Bank, log_collector::LogCollector};
use solana_runtime::{
accounts::AccountAddressFilter, bank::Bank, bank_forks::BankForks, log_collector::LogCollector,
};
use solana_sdk::{
clock::{Epoch, Slot, UnixTimestamp},
commitment_config::{CommitmentConfig, CommitmentLevel},

View File

@ -8,7 +8,9 @@ use solana_client::rpc_response::{
Response as RpcResponse, RpcAccount, RpcKeyedAccount, RpcSignatureResult,
};
#[cfg(test)]
use solana_ledger::{bank_forks::BankForks, blockstore::Blockstore};
use solana_ledger::blockstore::Blockstore;
#[cfg(test)]
use solana_runtime::bank_forks::BankForks;
use solana_sdk::{
clock::Slot, commitment_config::CommitmentConfig, pubkey::Pubkey, signature::Signature,
};
@ -364,12 +366,12 @@ mod tests {
use serial_test_derive::serial;
use solana_budget_program::{self, budget_instruction};
use solana_ledger::{
bank_forks::BankForks,
genesis_utils::{create_genesis_config, GenesisConfigInfo},
get_tmp_ledger_path,
};
use solana_runtime::{
bank::Bank,
bank_forks::BankForks,
genesis_utils::{create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs},
};
use solana_sdk::{

View File

@ -74,12 +74,11 @@ mod tests {
use super::*;
use crate::commitment::BlockCommitmentCache;
use solana_ledger::{
bank_forks::BankForks,
blockstore::Blockstore,
genesis_utils::{create_genesis_config, GenesisConfigInfo},
get_tmp_ledger_path,
};
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use std::{
net::{IpAddr, Ipv4Addr},
sync::RwLock,

View File

@ -10,9 +10,9 @@ use jsonrpc_http_server::{
RequestMiddlewareAction, ServerBuilder,
};
use regex::Regex;
use solana_ledger::{
use solana_ledger::blockstore::Blockstore;
use solana_runtime::{
bank_forks::{BankForks, SnapshotConfig},
blockstore::Blockstore,
snapshot_utils,
};
use solana_sdk::{hash::Hash, native_token::lamports_to_sol, pubkey::Pubkey};
@ -350,11 +350,10 @@ mod tests {
rpc::create_validator_exit,
};
use solana_ledger::{
bank_forks::CompressionType,
genesis_utils::{create_genesis_config, GenesisConfigInfo},
get_tmp_ledger_path,
};
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::CompressionType};
use solana_sdk::signature::Signer;
use std::net::{IpAddr, Ipv4Addr};

View File

@ -11,8 +11,8 @@ use serde::Serialize;
use solana_client::rpc_response::{
Response, RpcAccount, RpcKeyedAccount, RpcResponseContext, RpcSignatureResult,
};
use solana_ledger::{bank_forks::BankForks, blockstore::Blockstore};
use solana_runtime::bank::Bank;
use solana_ledger::blockstore::Blockstore;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use solana_sdk::{
account::Account,
clock::{Slot, UnixTimestamp},

View File

@ -1,7 +1,6 @@
use crate::cluster_info::ClusterInfo;
use solana_ledger::bank_forks::BankForks;
use solana_metrics::{datapoint_warn, inc_new_counter_info};
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use solana_sdk::{clock::Slot, signature::Signature};
use std::{
collections::HashMap,

View File

@ -1,7 +1,6 @@
//! The `shred_fetch_stage` pulls shreds from UDP sockets and sends it to a channel.
use bv::BitVec;
use solana_ledger::bank_forks::BankForks;
use solana_ledger::blockstore::MAX_DATA_SHREDS_PER_SLOT;
use solana_ledger::shred::{
CODING_SHRED, DATA_SHRED, OFFSET_OF_SHRED_INDEX, OFFSET_OF_SHRED_SLOT, OFFSET_OF_SHRED_TYPE,
@ -10,6 +9,7 @@ use solana_ledger::shred::{
use solana_perf::cuda_runtime::PinnedVec;
use solana_perf::packet::{limited_deserialize, Packet, PacketsRecycler};
use solana_perf::recycler::Recycler;
use solana_runtime::bank_forks::BankForks;
use solana_sdk::clock::Slot;
use solana_streamer::streamer::{self, PacketReceiver, PacketSender};
use std::collections::HashMap;

View File

@ -1,12 +1,12 @@
#![allow(clippy::implicit_hasher)]
use crate::sigverify;
use crate::sigverify_stage::SigVerifier;
use solana_ledger::bank_forks::BankForks;
use solana_ledger::leader_schedule_cache::LeaderScheduleCache;
use solana_ledger::shred::{OFFSET_OF_SHRED_SLOT, SIZE_OF_SHRED_SLOT};
use solana_ledger::sigverify_shreds::verify_shreds_gpu;
use solana_perf::packet::{limited_deserialize, Packets};
use solana_perf::recycler_cache::RecyclerCache;
use solana_runtime::bank_forks::BankForks;
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, RwLock};

View File

@ -1,5 +1,5 @@
use crate::cluster_info::{ClusterInfo, MAX_SNAPSHOT_HASHES};
use solana_ledger::{snapshot_package::AccountsPackageReceiver, snapshot_utils};
use solana_runtime::{snapshot_package::AccountsPackageReceiver, snapshot_utils};
use solana_sdk::{clock::Slot, hash::Hash};
use std::{
sync::{
@ -78,12 +78,13 @@ impl SnapshotPackagerService {
mod tests {
use super::*;
use bincode::serialize_into;
use solana_ledger::bank_forks::CompressionType;
use solana_ledger::{
use solana_runtime::{
accounts_db::AccountStorageEntry,
bank::BankSlotDelta,
bank_forks::CompressionType,
snapshot_package::AccountsPackage,
snapshot_utils::{self, SNAPSHOT_STATUS_CACHE_FILE_NAME},
};
use solana_runtime::{accounts_db::AccountStorageEntry, bank::BankSlotDelta};
use solana_sdk::hash::Hash;
use std::{
fs::{self, remove_dir_all, OpenOptions},

View File

@ -13,9 +13,8 @@ use crate::{
sigverify_stage::SigVerifyStage,
};
use crossbeam_channel::unbounded;
use solana_ledger::{
bank_forks::BankForks, blockstore::Blockstore, blockstore_processor::TransactionStatusSender,
};
use solana_ledger::{blockstore::Blockstore, blockstore_processor::TransactionStatusSender};
use solana_runtime::bank_forks::BankForks;
use std::{
net::UdpSocket,
sync::{

View File

@ -22,11 +22,10 @@ use crate::{
use crossbeam_channel::unbounded;
use solana_ledger::leader_schedule_cache::LeaderScheduleCache;
use solana_ledger::{
bank_forks::BankForks,
blockstore::{Blockstore, CompletedSlotsReceiver},
blockstore_processor::TransactionStatusSender,
snapshot_package::AccountsPackageSender,
};
use solana_runtime::{bank_forks::BankForks, snapshot_package::AccountsPackageSender};
use solana_sdk::{
pubkey::Pubkey,
signature::{Keypair, Signer},

View File

@ -24,16 +24,18 @@ use crate::{
};
use crossbeam_channel::unbounded;
use solana_ledger::{
bank_forks::{BankForks, SnapshotConfig},
bank_forks_utils,
blockstore::{Blockstore, CompletedSlotsReceiver},
blockstore_processor, create_new_tmp_ledger,
hardened_unpack::{open_genesis_config, MAX_GENESIS_ARCHIVE_UNPACKED_SIZE},
leader_schedule::FixedSchedule,
leader_schedule_cache::LeaderScheduleCache,
};
use solana_metrics::datapoint_info;
use solana_runtime::bank::Bank;
use solana_runtime::{
bank::Bank,
bank_forks::{BankForks, SnapshotConfig},
hardened_unpack::{open_genesis_config, MAX_GENESIS_ARCHIVE_UNPACKED_SIZE},
};
use solana_sdk::{
clock::Slot,
epoch_schedule::MAX_LEADER_SCHEDULE_EPOCH_OFFSET,

View File

@ -16,7 +16,6 @@ use rayon::iter::IntoParallelRefMutIterator;
use rayon::iter::ParallelIterator;
use rayon::ThreadPool;
use solana_ledger::{
bank_forks::BankForks,
blockstore::{self, Blockstore, BlockstoreInsertionMetrics, MAX_DATA_SHREDS_PER_SLOT},
leader_schedule_cache::LeaderScheduleCache,
shred::{Nonce, Shred},
@ -24,7 +23,7 @@ use solana_ledger::{
use solana_metrics::{inc_new_counter_debug, inc_new_counter_error};
use solana_perf::packet::Packets;
use solana_rayon_threadlimit::get_thread_count;
use solana_runtime::bank::Bank;
use solana_runtime::{bank::Bank, bank_forks::BankForks};
use solana_sdk::{packet::PACKET_DATA_SIZE, pubkey::Pubkey, timing::duration_as_ms};
use solana_streamer::streamer::PacketSender;
use std::{