Reformat imports to a consistent style for imports
rustfmt.toml configuration: imports_granularity = "One" group_imports = "One"
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
use crate::blockstore::*;
|
||||
use solana_sdk::{clock::Slot, hash::Hash};
|
||||
use {
|
||||
crate::blockstore::*,
|
||||
solana_sdk::{clock::Slot, hash::Hash},
|
||||
};
|
||||
|
||||
pub struct AncestorIterator<'a> {
|
||||
current: Option<Slot>,
|
||||
@ -74,10 +76,12 @@ impl<'a> Iterator for AncestorIteratorWithHash<'a> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use solana_sdk::hash::Hash;
|
||||
use std::{collections::HashMap, path::Path};
|
||||
use trees::tr;
|
||||
use {
|
||||
super::*,
|
||||
solana_sdk::hash::Hash,
|
||||
std::{collections::HashMap, path::Path},
|
||||
trees::tr,
|
||||
};
|
||||
|
||||
fn setup_forks(ledger_path: &Path) -> Blockstore {
|
||||
let blockstore = Blockstore::open(ledger_path).unwrap();
|
||||
|
@ -1,26 +1,27 @@
|
||||
use crate::{
|
||||
blockstore::Blockstore,
|
||||
blockstore_processor::{
|
||||
self, BlockstoreProcessorError, BlockstoreProcessorResult, CacheBlockMetaSender,
|
||||
ProcessOptions, TransactionStatusSender,
|
||||
use {
|
||||
crate::{
|
||||
blockstore::Blockstore,
|
||||
blockstore_processor::{
|
||||
self, BlockstoreProcessorError, BlockstoreProcessorResult, CacheBlockMetaSender,
|
||||
ProcessOptions, TransactionStatusSender,
|
||||
},
|
||||
leader_schedule_cache::LeaderScheduleCache,
|
||||
},
|
||||
leader_schedule_cache::LeaderScheduleCache,
|
||||
log::*,
|
||||
solana_entry::entry::VerifyRecyclers,
|
||||
solana_runtime::{
|
||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||
bank_forks::BankForks,
|
||||
snapshot_archive_info::SnapshotArchiveInfoGetter,
|
||||
snapshot_config::SnapshotConfig,
|
||||
snapshot_hash::{FullSnapshotHash, IncrementalSnapshotHash, StartingSnapshotHashes},
|
||||
snapshot_package::AccountsPackageSender,
|
||||
snapshot_utils,
|
||||
},
|
||||
solana_sdk::{clock::Slot, genesis_config::GenesisConfig},
|
||||
std::{fs, path::PathBuf, process, result},
|
||||
};
|
||||
|
||||
use log::*;
|
||||
use solana_entry::entry::VerifyRecyclers;
|
||||
use solana_runtime::{
|
||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||
bank_forks::BankForks,
|
||||
snapshot_archive_info::SnapshotArchiveInfoGetter,
|
||||
snapshot_config::SnapshotConfig,
|
||||
snapshot_hash::{FullSnapshotHash, IncrementalSnapshotHash, StartingSnapshotHashes},
|
||||
snapshot_package::AccountsPackageSender,
|
||||
snapshot_utils,
|
||||
};
|
||||
use solana_sdk::{clock::Slot, genesis_config::GenesisConfig};
|
||||
use std::{fs, path::PathBuf, process, result};
|
||||
|
||||
pub type LoadResult = result::Result<
|
||||
(
|
||||
BankForks,
|
||||
|
@ -1,15 +1,17 @@
|
||||
use crate::blockstore::Blockstore;
|
||||
use log::*;
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_sdk::clock::Slot;
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
result::Result,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
use {
|
||||
crate::blockstore::Blockstore,
|
||||
log::*,
|
||||
solana_measure::measure::Measure,
|
||||
solana_sdk::clock::Slot,
|
||||
std::{
|
||||
collections::HashSet,
|
||||
result::Result,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
},
|
||||
time::Duration,
|
||||
},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
// Attempt to upload this many blocks in parallel
|
||||
|
@ -3914,30 +3914,32 @@ fn adjust_ulimit_nofile(enforce_ulimit_nofile: bool) -> Result<()> {
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||
leader_schedule::{FixedSchedule, LeaderSchedule},
|
||||
shred::{max_ticks_per_n_shreds, DataShredHeader},
|
||||
use {
|
||||
super::*,
|
||||
crate::{
|
||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||
leader_schedule::{FixedSchedule, LeaderSchedule},
|
||||
shred::{max_ticks_per_n_shreds, DataShredHeader},
|
||||
},
|
||||
assert_matches::assert_matches,
|
||||
bincode::serialize,
|
||||
itertools::Itertools,
|
||||
rand::{seq::SliceRandom, thread_rng},
|
||||
solana_account_decoder::parse_token::UiTokenAmount,
|
||||
solana_entry::entry::{next_entry, next_entry_mut},
|
||||
solana_runtime::bank::{Bank, RewardType},
|
||||
solana_sdk::{
|
||||
hash::{self, hash, Hash},
|
||||
instruction::CompiledInstruction,
|
||||
packet::PACKET_DATA_SIZE,
|
||||
pubkey::Pubkey,
|
||||
signature::Signature,
|
||||
transaction::{Transaction, TransactionError},
|
||||
},
|
||||
solana_storage_proto::convert::generated,
|
||||
solana_transaction_status::{InnerInstructions, Reward, Rewards, TransactionTokenBalance},
|
||||
std::{sync::mpsc::channel, thread::Builder, time::Duration},
|
||||
};
|
||||
use assert_matches::assert_matches;
|
||||
use bincode::serialize;
|
||||
use itertools::Itertools;
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use solana_account_decoder::parse_token::UiTokenAmount;
|
||||
use solana_entry::entry::{next_entry, next_entry_mut};
|
||||
use solana_runtime::bank::{Bank, RewardType};
|
||||
use solana_sdk::{
|
||||
hash::{self, hash, Hash},
|
||||
instruction::CompiledInstruction,
|
||||
packet::PACKET_DATA_SIZE,
|
||||
pubkey::Pubkey,
|
||||
signature::Signature,
|
||||
transaction::{Transaction, TransactionError},
|
||||
};
|
||||
use solana_storage_proto::convert::generated;
|
||||
use solana_transaction_status::{InnerInstructions, Reward, Rewards, TransactionTokenBalance};
|
||||
use std::{sync::mpsc::channel, thread::Builder, time::Duration};
|
||||
|
||||
// used for tests only
|
||||
pub(crate) fn make_slot_entries_with_transactions(num_entries: u64) -> Vec<Entry> {
|
||||
|
@ -1,5 +1,4 @@
|
||||
use super::*;
|
||||
use std::time::Instant;
|
||||
use {super::*, std::time::Instant};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct PurgeStats {
|
||||
@ -392,16 +391,18 @@ impl Blockstore {
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
blockstore::tests::make_slot_entries_with_transactions, get_tmp_ledger_path_auto_delete,
|
||||
};
|
||||
use bincode::serialize;
|
||||
use solana_entry::entry::next_entry_mut;
|
||||
use solana_sdk::{
|
||||
hash::{hash, Hash},
|
||||
message::Message,
|
||||
transaction::Transaction,
|
||||
use {
|
||||
super::*,
|
||||
crate::{
|
||||
blockstore::tests::make_slot_entries_with_transactions, get_tmp_ledger_path_auto_delete,
|
||||
},
|
||||
bincode::serialize,
|
||||
solana_entry::entry::next_entry_mut,
|
||||
solana_sdk::{
|
||||
hash::{hash, Hash},
|
||||
message::Message,
|
||||
transaction::Transaction,
|
||||
},
|
||||
};
|
||||
|
||||
// check that all columns are either empty or start at `min_slot`
|
||||
|
@ -1,38 +1,38 @@
|
||||
use crate::blockstore_meta;
|
||||
use bincode::{deserialize, serialize};
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use log::*;
|
||||
use prost::Message;
|
||||
pub use rocksdb::Direction as IteratorDirection;
|
||||
use rocksdb::{
|
||||
self,
|
||||
compaction_filter::CompactionFilter,
|
||||
compaction_filter_factory::{CompactionFilterContext, CompactionFilterFactory},
|
||||
ColumnFamily, ColumnFamilyDescriptor, CompactionDecision, DBIterator, DBRawIterator,
|
||||
DBRecoveryMode, IteratorMode as RocksIteratorMode, Options, WriteBatch as RWriteBatch, DB,
|
||||
};
|
||||
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
use solana_runtime::hardened_unpack::UnpackError;
|
||||
use solana_sdk::{
|
||||
clock::{Slot, UnixTimestamp},
|
||||
pubkey::Pubkey,
|
||||
signature::Signature,
|
||||
};
|
||||
use solana_storage_proto::convert::generated;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
ffi::{CStr, CString},
|
||||
fs,
|
||||
marker::PhantomData,
|
||||
path::Path,
|
||||
sync::{
|
||||
atomic::{AtomicU64, Ordering},
|
||||
Arc,
|
||||
use {
|
||||
crate::blockstore_meta,
|
||||
bincode::{deserialize, serialize},
|
||||
byteorder::{BigEndian, ByteOrder},
|
||||
log::*,
|
||||
prost::Message,
|
||||
rocksdb::{
|
||||
self,
|
||||
compaction_filter::CompactionFilter,
|
||||
compaction_filter_factory::{CompactionFilterContext, CompactionFilterFactory},
|
||||
ColumnFamily, ColumnFamilyDescriptor, CompactionDecision, DBIterator, DBRawIterator,
|
||||
DBRecoveryMode, IteratorMode as RocksIteratorMode, Options, WriteBatch as RWriteBatch, DB,
|
||||
},
|
||||
serde::{de::DeserializeOwned, Serialize},
|
||||
solana_runtime::hardened_unpack::UnpackError,
|
||||
solana_sdk::{
|
||||
clock::{Slot, UnixTimestamp},
|
||||
pubkey::Pubkey,
|
||||
signature::Signature,
|
||||
},
|
||||
solana_storage_proto::convert::generated,
|
||||
std::{
|
||||
collections::{HashMap, HashSet},
|
||||
ffi::{CStr, CString},
|
||||
fs,
|
||||
marker::PhantomData,
|
||||
path::Path,
|
||||
sync::{
|
||||
atomic::{AtomicU64, Ordering},
|
||||
Arc,
|
||||
},
|
||||
},
|
||||
thiserror::Error,
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
const MAX_WRITE_BUFFER_SIZE: u64 = 256 * 1024 * 1024; // 256MB
|
||||
|
||||
@ -1431,8 +1431,7 @@ fn excludes_from_compaction(cf_name: &str) -> bool {
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use crate::blockstore_db::columns::ShredData;
|
||||
use {super::*, crate::blockstore_db::columns::ShredData};
|
||||
|
||||
#[test]
|
||||
fn test_compaction_filter() {
|
||||
|
@ -303,9 +303,11 @@ pub struct ProgramCost {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use std::iter::repeat;
|
||||
use {
|
||||
super::*,
|
||||
rand::{seq::SliceRandom, thread_rng},
|
||||
std::iter::repeat,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_erasure_meta_status() {
|
||||
|
@ -1,63 +1,65 @@
|
||||
use crate::{
|
||||
block_error::BlockError, blockstore::Blockstore, blockstore_db::BlockstoreError,
|
||||
blockstore_meta::SlotMeta, leader_schedule_cache::LeaderScheduleCache,
|
||||
};
|
||||
use chrono_humanize::{Accuracy, HumanTime, Tense};
|
||||
use crossbeam_channel::Sender;
|
||||
use itertools::Itertools;
|
||||
use log::*;
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use rayon::{prelude::*, ThreadPool};
|
||||
use solana_entry::entry::{
|
||||
self, create_ticks, Entry, EntrySlice, EntryType, EntryVerificationStatus, VerifyRecyclers,
|
||||
};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_metrics::{datapoint_error, inc_new_counter_debug};
|
||||
use solana_rayon_threadlimit::get_thread_count;
|
||||
use solana_runtime::{
|
||||
accounts_db::{AccountShrinkThreshold, AccountsDbConfig},
|
||||
accounts_index::AccountSecondaryIndexes,
|
||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||
bank::{
|
||||
Bank, ExecuteTimings, InnerInstructionsList, RentDebits, TransactionBalancesSet,
|
||||
TransactionExecutionResult, TransactionLogMessages, TransactionResults,
|
||||
use {
|
||||
crate::{
|
||||
block_error::BlockError, blockstore::Blockstore, blockstore_db::BlockstoreError,
|
||||
blockstore_meta::SlotMeta, leader_schedule_cache::LeaderScheduleCache,
|
||||
},
|
||||
bank_forks::BankForks,
|
||||
bank_utils,
|
||||
block_cost_limits::*,
|
||||
commitment::VOTE_THRESHOLD_SIZE,
|
||||
snapshot_config::SnapshotConfig,
|
||||
snapshot_package::{AccountsPackageSender, SnapshotType},
|
||||
snapshot_utils::{self, BankFromArchiveTimings},
|
||||
transaction_batch::TransactionBatch,
|
||||
vote_account::VoteAccount,
|
||||
vote_sender_types::ReplayVoteSender,
|
||||
};
|
||||
use solana_sdk::timing;
|
||||
use solana_sdk::{
|
||||
clock::{Slot, MAX_PROCESSING_AGE},
|
||||
feature_set,
|
||||
genesis_config::GenesisConfig,
|
||||
hash::Hash,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signature},
|
||||
transaction::{
|
||||
Result, SanitizedTransaction, TransactionError, TransactionVerificationMode,
|
||||
VersionedTransaction,
|
||||
chrono_humanize::{Accuracy, HumanTime, Tense},
|
||||
crossbeam_channel::Sender,
|
||||
itertools::Itertools,
|
||||
log::*,
|
||||
rand::{seq::SliceRandom, thread_rng},
|
||||
rayon::{prelude::*, ThreadPool},
|
||||
solana_entry::entry::{
|
||||
self, create_ticks, Entry, EntrySlice, EntryType, EntryVerificationStatus, VerifyRecyclers,
|
||||
},
|
||||
solana_measure::measure::Measure,
|
||||
solana_metrics::{datapoint_error, inc_new_counter_debug},
|
||||
solana_rayon_threadlimit::get_thread_count,
|
||||
solana_runtime::{
|
||||
accounts_db::{AccountShrinkThreshold, AccountsDbConfig},
|
||||
accounts_index::AccountSecondaryIndexes,
|
||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||
bank::{
|
||||
Bank, ExecuteTimings, InnerInstructionsList, RentDebits, TransactionBalancesSet,
|
||||
TransactionExecutionResult, TransactionLogMessages, TransactionResults,
|
||||
},
|
||||
bank_forks::BankForks,
|
||||
bank_utils,
|
||||
block_cost_limits::*,
|
||||
commitment::VOTE_THRESHOLD_SIZE,
|
||||
snapshot_config::SnapshotConfig,
|
||||
snapshot_package::{AccountsPackageSender, SnapshotType},
|
||||
snapshot_utils::{self, BankFromArchiveTimings},
|
||||
transaction_batch::TransactionBatch,
|
||||
vote_account::VoteAccount,
|
||||
vote_sender_types::ReplayVoteSender,
|
||||
},
|
||||
solana_sdk::{
|
||||
clock::{Slot, MAX_PROCESSING_AGE},
|
||||
feature_set,
|
||||
genesis_config::GenesisConfig,
|
||||
hash::Hash,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signature},
|
||||
timing,
|
||||
transaction::{
|
||||
Result, SanitizedTransaction, TransactionError, TransactionVerificationMode,
|
||||
VersionedTransaction,
|
||||
},
|
||||
},
|
||||
solana_transaction_status::token_balances::{
|
||||
collect_token_balances, TransactionTokenBalancesSet,
|
||||
},
|
||||
std::{
|
||||
cell::RefCell,
|
||||
collections::{HashMap, HashSet},
|
||||
path::PathBuf,
|
||||
result,
|
||||
sync::{Arc, RwLock},
|
||||
time::{Duration, Instant},
|
||||
},
|
||||
thiserror::Error,
|
||||
};
|
||||
use solana_transaction_status::token_balances::{
|
||||
collect_token_balances, TransactionTokenBalancesSet,
|
||||
};
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
collections::{HashMap, HashSet},
|
||||
path::PathBuf,
|
||||
result,
|
||||
sync::{Arc, RwLock},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
// it tracks the block cost available capacity - number of compute-units allowed
|
||||
// by max blockl cost limit
|
||||
@ -1505,38 +1507,40 @@ pub fn fill_blockstore_slot_with_ticks(
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use crate::genesis_utils::{
|
||||
create_genesis_config, create_genesis_config_with_leader, GenesisConfigInfo,
|
||||
use {
|
||||
super::*,
|
||||
crate::genesis_utils::{
|
||||
create_genesis_config, create_genesis_config_with_leader, GenesisConfigInfo,
|
||||
},
|
||||
crossbeam_channel::unbounded,
|
||||
matches::assert_matches,
|
||||
rand::{thread_rng, Rng},
|
||||
solana_entry::entry::{create_ticks, next_entry, next_entry_mut},
|
||||
solana_runtime::genesis_utils::{
|
||||
self, create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs,
|
||||
},
|
||||
solana_sdk::{
|
||||
account::{AccountSharedData, WritableAccount},
|
||||
epoch_schedule::EpochSchedule,
|
||||
hash::Hash,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
system_instruction::SystemError,
|
||||
system_transaction,
|
||||
transaction::{Transaction, TransactionError},
|
||||
},
|
||||
solana_vote_program::{
|
||||
self,
|
||||
vote_state::{VoteState, VoteStateVersions, MAX_LOCKOUT_HISTORY},
|
||||
vote_transaction,
|
||||
},
|
||||
std::{
|
||||
collections::BTreeSet,
|
||||
sync::{mpsc::channel, RwLock},
|
||||
},
|
||||
tempfile::TempDir,
|
||||
trees::tr,
|
||||
};
|
||||
use crossbeam_channel::unbounded;
|
||||
use matches::assert_matches;
|
||||
use rand::{thread_rng, Rng};
|
||||
use solana_entry::entry::{create_ticks, next_entry, next_entry_mut};
|
||||
use solana_runtime::genesis_utils::{
|
||||
self, create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs,
|
||||
};
|
||||
use solana_sdk::{
|
||||
account::{AccountSharedData, WritableAccount},
|
||||
epoch_schedule::EpochSchedule,
|
||||
hash::Hash,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
system_instruction::SystemError,
|
||||
system_transaction,
|
||||
transaction::{Transaction, TransactionError},
|
||||
};
|
||||
use solana_vote_program::{
|
||||
self,
|
||||
vote_state::{VoteState, VoteStateVersions, MAX_LOCKOUT_HISTORY},
|
||||
vote_transaction,
|
||||
};
|
||||
use std::{
|
||||
collections::BTreeSet,
|
||||
sync::{mpsc::channel, RwLock},
|
||||
};
|
||||
use tempfile::TempDir;
|
||||
use trees::tr;
|
||||
|
||||
fn test_process_blockstore(
|
||||
genesis_config: &GenesisConfig,
|
||||
|
@ -109,9 +109,7 @@ impl Session {
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod test {
|
||||
use super::*;
|
||||
use log::*;
|
||||
use solana_sdk::clock::Slot;
|
||||
use {super::*, log::*, solana_sdk::clock::Slot};
|
||||
|
||||
/// Specifies the contents of a 16-data-shred and 4-coding-shred erasure set
|
||||
/// Exists to be passed to `generate_blockstore_with_coding`
|
||||
|
@ -1,11 +1,10 @@
|
||||
use itertools::Itertools;
|
||||
use rand::distributions::{Distribution, WeightedIndex};
|
||||
use rand_chacha::{rand_core::SeedableRng, ChaChaRng};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::identity;
|
||||
use std::ops::Index;
|
||||
use std::sync::Arc;
|
||||
use {
|
||||
itertools::Itertools,
|
||||
rand::distributions::{Distribution, WeightedIndex},
|
||||
rand_chacha::{rand_core::SeedableRng, ChaChaRng},
|
||||
solana_sdk::pubkey::Pubkey,
|
||||
std::{collections::HashMap, convert::identity, ops::Index, sync::Arc},
|
||||
};
|
||||
|
||||
// Used for testing
|
||||
#[derive(Clone, Debug)]
|
||||
@ -101,9 +100,7 @@ impl Index<u64> for LeaderSchedule {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use rand::Rng;
|
||||
use std::iter::repeat_with;
|
||||
use {super::*, rand::Rng, std::iter::repeat_with};
|
||||
|
||||
#[test]
|
||||
fn test_leader_schedule_index() {
|
||||
|
@ -1,19 +1,21 @@
|
||||
use crate::{
|
||||
blockstore::Blockstore,
|
||||
leader_schedule::{FixedSchedule, LeaderSchedule},
|
||||
leader_schedule_utils,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use log::*;
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_sdk::{
|
||||
clock::{Epoch, Slot},
|
||||
epoch_schedule::EpochSchedule,
|
||||
pubkey::Pubkey,
|
||||
};
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap, VecDeque},
|
||||
sync::{Arc, RwLock},
|
||||
use {
|
||||
crate::{
|
||||
blockstore::Blockstore,
|
||||
leader_schedule::{FixedSchedule, LeaderSchedule},
|
||||
leader_schedule_utils,
|
||||
},
|
||||
itertools::Itertools,
|
||||
log::*,
|
||||
solana_runtime::bank::Bank,
|
||||
solana_sdk::{
|
||||
clock::{Epoch, Slot},
|
||||
epoch_schedule::EpochSchedule,
|
||||
pubkey::Pubkey,
|
||||
},
|
||||
std::{
|
||||
collections::{hash_map::Entry, HashMap, VecDeque},
|
||||
sync::{Arc, RwLock},
|
||||
},
|
||||
};
|
||||
|
||||
type CachedSchedules = (HashMap<Epoch, Arc<LeaderSchedule>>, VecDeque<u64>);
|
||||
@ -248,24 +250,31 @@ impl LeaderScheduleCache {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
blockstore::make_slot_entries,
|
||||
genesis_utils::{
|
||||
bootstrap_validator_stake_lamports, create_genesis_config,
|
||||
create_genesis_config_with_leader, GenesisConfigInfo,
|
||||
use {
|
||||
super::*,
|
||||
crate::{
|
||||
blockstore::make_slot_entries,
|
||||
genesis_utils::{
|
||||
bootstrap_validator_stake_lamports, create_genesis_config,
|
||||
create_genesis_config_with_leader, GenesisConfigInfo,
|
||||
},
|
||||
get_tmp_ledger_path_auto_delete,
|
||||
staking_utils::tests::setup_vote_and_stake_accounts,
|
||||
},
|
||||
solana_runtime::bank::Bank,
|
||||
solana_sdk::{
|
||||
clock::NUM_CONSECUTIVE_LEADER_SLOTS,
|
||||
epoch_schedule::{
|
||||
EpochSchedule, DEFAULT_LEADER_SCHEDULE_SLOT_OFFSET, DEFAULT_SLOTS_PER_EPOCH,
|
||||
MINIMUM_SLOTS_PER_EPOCH,
|
||||
},
|
||||
signature::{Keypair, Signer},
|
||||
},
|
||||
std::{
|
||||
sync::{mpsc::channel, Arc},
|
||||
thread::Builder,
|
||||
},
|
||||
get_tmp_ledger_path_auto_delete,
|
||||
staking_utils::tests::setup_vote_and_stake_accounts,
|
||||
};
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_sdk::clock::NUM_CONSECUTIVE_LEADER_SLOTS;
|
||||
use solana_sdk::epoch_schedule::{
|
||||
EpochSchedule, DEFAULT_LEADER_SCHEDULE_SLOT_OFFSET, DEFAULT_SLOTS_PER_EPOCH,
|
||||
MINIMUM_SLOTS_PER_EPOCH,
|
||||
};
|
||||
use solana_sdk::signature::{Keypair, Signer};
|
||||
use std::{sync::mpsc::channel, sync::Arc, thread::Builder};
|
||||
|
||||
#[test]
|
||||
fn test_new_cache() {
|
||||
|
@ -1,10 +1,11 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::leader_schedule::LeaderSchedule;
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_sdk::{
|
||||
clock::{Epoch, Slot, NUM_CONSECUTIVE_LEADER_SLOTS},
|
||||
pubkey::Pubkey,
|
||||
use {
|
||||
crate::leader_schedule::LeaderSchedule,
|
||||
solana_runtime::bank::Bank,
|
||||
solana_sdk::{
|
||||
clock::{Epoch, Slot, NUM_CONSECUTIVE_LEADER_SLOTS},
|
||||
pubkey::Pubkey,
|
||||
},
|
||||
std::collections::HashMap,
|
||||
};
|
||||
|
||||
/// Return the leader schedule for the given epoch.
|
||||
@ -78,9 +79,11 @@ fn sort_stakes(stakes: &mut Vec<(Pubkey, u64)>) {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use solana_runtime::genesis_utils::{
|
||||
bootstrap_validator_stake_lamports, create_genesis_config_with_leader,
|
||||
use {
|
||||
super::*,
|
||||
solana_runtime::genesis_utils::{
|
||||
bootstrap_validator_stake_lamports, create_genesis_config_with_leader,
|
||||
},
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
@ -1,5 +1,7 @@
|
||||
use crate::{blockstore::*, blockstore_meta::SlotMeta};
|
||||
use solana_sdk::clock::Slot;
|
||||
use {
|
||||
crate::{blockstore::*, blockstore_meta::SlotMeta},
|
||||
solana_sdk::clock::Slot,
|
||||
};
|
||||
|
||||
pub struct NextSlotsIterator<'a> {
|
||||
pending_slots: Vec<Slot>,
|
||||
@ -34,10 +36,10 @@ impl<'a> Iterator for NextSlotsIterator<'a> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::blockstore_processor::fill_blockstore_slot_with_ticks;
|
||||
use solana_sdk::hash::Hash;
|
||||
use std::collections::HashSet;
|
||||
use {
|
||||
super::*, crate::blockstore_processor::fill_blockstore_slot_with_ticks,
|
||||
solana_sdk::hash::Hash, std::collections::HashSet,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_next_slots_iterator() {
|
||||
|
@ -1,7 +1,8 @@
|
||||
use crate::blockstore_db::Result;
|
||||
use crate::{blockstore::*, blockstore_meta::SlotMeta};
|
||||
use log::*;
|
||||
use solana_sdk::clock::Slot;
|
||||
use {
|
||||
crate::{blockstore::*, blockstore_db::Result, blockstore_meta::SlotMeta},
|
||||
log::*,
|
||||
solana_sdk::clock::Slot,
|
||||
};
|
||||
|
||||
pub struct RootedSlotIterator<'a> {
|
||||
next_slots: Vec<Slot>,
|
||||
@ -76,9 +77,10 @@ impl<'a> Iterator for RootedSlotIterator<'a> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::blockstore_processor::fill_blockstore_slot_with_ticks;
|
||||
use solana_sdk::hash::Hash;
|
||||
use {
|
||||
super::*, crate::blockstore_processor::fill_blockstore_slot_with_ticks,
|
||||
solana_sdk::hash::Hash,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_rooted_slot_iterator() {
|
||||
|
@ -1119,15 +1119,17 @@ pub fn verify_test_data_shred(
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use bincode::serialized_size;
|
||||
use matches::assert_matches;
|
||||
use rand::{seq::SliceRandom, Rng};
|
||||
use solana_sdk::{
|
||||
hash::{self, hash},
|
||||
shred_version, system_transaction,
|
||||
use {
|
||||
super::*,
|
||||
bincode::serialized_size,
|
||||
matches::assert_matches,
|
||||
rand::{seq::SliceRandom, Rng},
|
||||
solana_sdk::{
|
||||
hash::{self, hash},
|
||||
shred_version, system_transaction,
|
||||
},
|
||||
std::{collections::HashSet, convert::TryInto, iter::repeat_with, sync::Arc},
|
||||
};
|
||||
use std::{collections::HashSet, convert::TryInto, iter::repeat_with, sync::Arc};
|
||||
|
||||
#[test]
|
||||
fn test_shred_constants() {
|
||||
|
@ -1,29 +1,30 @@
|
||||
#![allow(clippy::implicit_hasher)]
|
||||
use crate::shred::{ShredType, SIZE_OF_NONCE};
|
||||
use rayon::{
|
||||
iter::{
|
||||
IndexedParallelIterator, IntoParallelIterator, IntoParallelRefMutIterator, ParallelIterator,
|
||||
use {
|
||||
crate::shred::{ShredType, SIZE_OF_NONCE},
|
||||
rayon::{
|
||||
iter::{
|
||||
IndexedParallelIterator, IntoParallelIterator, IntoParallelRefMutIterator,
|
||||
ParallelIterator,
|
||||
},
|
||||
ThreadPool,
|
||||
},
|
||||
ThreadPool,
|
||||
sha2::{Digest, Sha512},
|
||||
solana_metrics::inc_new_counter_debug,
|
||||
solana_perf::{
|
||||
cuda_runtime::PinnedVec,
|
||||
packet::{limited_deserialize, Packet, Packets},
|
||||
perf_libs,
|
||||
recycler_cache::RecyclerCache,
|
||||
sigverify::{self, batch_size, TxOffset},
|
||||
},
|
||||
solana_rayon_threadlimit::get_thread_count,
|
||||
solana_sdk::{
|
||||
clock::Slot,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signature, Signer},
|
||||
},
|
||||
std::{collections::HashMap, mem::size_of, sync::Arc},
|
||||
};
|
||||
use sha2::{Digest, Sha512};
|
||||
use solana_metrics::inc_new_counter_debug;
|
||||
use solana_perf::{
|
||||
cuda_runtime::PinnedVec,
|
||||
packet::{limited_deserialize, Packet, Packets},
|
||||
perf_libs,
|
||||
recycler_cache::RecyclerCache,
|
||||
sigverify::{self, batch_size, TxOffset},
|
||||
};
|
||||
use solana_rayon_threadlimit::get_thread_count;
|
||||
use solana_sdk::{
|
||||
clock::Slot,
|
||||
pubkey::Pubkey,
|
||||
signature::Signature,
|
||||
signature::{Keypair, Signer},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use std::{collections::HashMap, mem::size_of};
|
||||
|
||||
pub const SIGN_SHRED_GPU_MIN: usize = 256;
|
||||
|
||||
@ -451,9 +452,11 @@ pub fn sign_shreds_gpu(
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use crate::shred::{Shred, Shredder, SIZE_OF_DATA_SHRED_PAYLOAD};
|
||||
use solana_sdk::signature::{Keypair, Signer};
|
||||
use {
|
||||
super::*,
|
||||
crate::shred::{Shred, Shredder, SIZE_OF_DATA_SHRED_PAYLOAD},
|
||||
solana_sdk::signature::{Keypair, Signer},
|
||||
};
|
||||
|
||||
fn run_test_sigverify_shred_cpu(slot: Slot) {
|
||||
solana_logger::setup();
|
||||
|
Reference in New Issue
Block a user