Prune redundant const SLOT_MS (#29278)
* Alias redundant const SLOT_MS to DEFAULT_MS_PER_SLOT * Slate SLOT_MS for deprecation * Add doc comments Co-authored-by: Brooks Prumo <brooks@prumo.org>
This commit is contained in:
parent
ec06cf7311
commit
86b2e545e1
|
@ -19,7 +19,7 @@ use {
|
|||
sorted_storages::SortedStorages,
|
||||
},
|
||||
solana_sdk::{
|
||||
clock::{Slot, SLOT_MS},
|
||||
clock::{Slot, DEFAULT_MS_PER_SLOT},
|
||||
hash::Hash,
|
||||
pubkey::Pubkey,
|
||||
},
|
||||
|
@ -51,7 +51,7 @@ impl AccountsHashVerifier {
|
|||
snapshot_config: SnapshotConfig,
|
||||
) -> Self {
|
||||
// If there are no accounts packages to process, limit how often we re-check
|
||||
const LOOP_LIMITER: Duration = Duration::from_millis(SLOT_MS);
|
||||
const LOOP_LIMITER: Duration = Duration::from_millis(DEFAULT_MS_PER_SLOT);
|
||||
let exit = exit.clone();
|
||||
let cluster_info = cluster_info.clone();
|
||||
let t_accounts_hash_verifier = Builder::new()
|
||||
|
|
|
@ -22,7 +22,7 @@ use {
|
|||
},
|
||||
solana_runtime::bank::Bank,
|
||||
solana_sdk::{
|
||||
clock::{Slot, SLOT_MS},
|
||||
clock::{Slot, DEFAULT_MS_PER_SLOT},
|
||||
pubkey::Pubkey,
|
||||
signature::Signable,
|
||||
signer::keypair::Keypair,
|
||||
|
@ -554,7 +554,7 @@ impl AncestorHashesService {
|
|||
&mut request_throttle,
|
||||
);
|
||||
|
||||
sleep(Duration::from_millis(SLOT_MS));
|
||||
sleep(Duration::from_millis(DEFAULT_MS_PER_SLOT));
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use {
|
|||
solana_bucket_map::bucket_map::{BucketMap, BucketMapConfig},
|
||||
solana_measure::measure::Measure,
|
||||
solana_sdk::{
|
||||
clock::{Slot, SLOT_MS},
|
||||
clock::{Slot, DEFAULT_MS_PER_SLOT},
|
||||
timing::AtomicInterval,
|
||||
},
|
||||
std::{
|
||||
|
@ -22,7 +22,7 @@ use {
|
|||
};
|
||||
pub type Age = u8;
|
||||
|
||||
const AGE_MS: u64 = SLOT_MS; // match one age per slot time
|
||||
const AGE_MS: u64 = DEFAULT_MS_PER_SLOT; // match one age per slot time
|
||||
|
||||
// 10 GB limit for in-mem idx. In practice, we don't get this high. This tunes how aggressively to save items we expect to use soon.
|
||||
pub const DEFAULT_DISK_INDEX: Option<usize> = Some(10_000);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//! by their slot number, and some slots do not contain a block.
|
||||
//!
|
||||
//! An approximation of the passage of real-world time can be calculated by
|
||||
//! multiplying a number of slots by [`SLOT_MS`], which is a constant target
|
||||
//! multiplying a number of slots by [`DEFAULT_MS_PER_SLOT`], which is a constant target
|
||||
//! time for the network to produce slots. Note though that this method suffers
|
||||
//! a variable amount of drift, as the network does not produce slots at exactly
|
||||
//! the target rate, and the greater number of slots being calculated for, the
|
||||
|
@ -33,11 +33,9 @@ static_assertions::const_assert_eq!(MS_PER_TICK, 6);
|
|||
/// The number of milliseconds per tick (6).
|
||||
pub const MS_PER_TICK: u64 = 1000 / DEFAULT_TICKS_PER_SECOND;
|
||||
|
||||
#[cfg(test)]
|
||||
static_assertions::const_assert_eq!(SLOT_MS, 400);
|
||||
|
||||
#[deprecated(since = "1.15.0", note = "Please use DEFAULT_MS_PER_SLOT instead")]
|
||||
/// The expected duration of a slot (400 milliseconds).
|
||||
pub const SLOT_MS: u64 = (DEFAULT_TICKS_PER_SLOT * 1000) / DEFAULT_TICKS_PER_SECOND;
|
||||
pub const SLOT_MS: u64 = DEFAULT_MS_PER_SLOT;
|
||||
|
||||
// At 160 ticks/s, 64 ticks per slot implies that leader rotation and voting will happen
|
||||
// every 400 ms. A fast voting cadence ensures faster finality and convergence
|
||||
|
@ -74,6 +72,7 @@ pub const NUM_CONSECUTIVE_LEADER_SLOTS: u64 = 4;
|
|||
|
||||
#[cfg(test)]
|
||||
static_assertions::const_assert_eq!(DEFAULT_MS_PER_SLOT, 400);
|
||||
/// The expected duration of a slot (400 milliseconds).
|
||||
pub const DEFAULT_MS_PER_SLOT: u64 = 1_000 * DEFAULT_TICKS_PER_SLOT / DEFAULT_TICKS_PER_SECOND;
|
||||
pub const DEFAULT_S_PER_SLOT: f64 = DEFAULT_TICKS_PER_SLOT as f64 / DEFAULT_TICKS_PER_SECOND as f64;
|
||||
|
||||
|
|
Loading…
Reference in New Issue