Move stake_weighted_timestamp module (#18114)

* Move timestamp module into runtime

* Less public

* Remove unused enum
This commit is contained in:
Tyera Eulberg
2021-06-21 16:14:54 -06:00
committed by GitHub
parent 2087f5da94
commit 19fe1dd463
4 changed files with 10 additions and 15 deletions

View File

@ -50,6 +50,10 @@ use crate::{
log_collector::LogCollector, log_collector::LogCollector,
message_processor::{ExecuteDetailsTimings, Executors, MessageProcessor}, message_processor::{ExecuteDetailsTimings, Executors, MessageProcessor},
rent_collector::RentCollector, rent_collector::RentCollector,
stake_weighted_timestamp::{
calculate_stake_weighted_timestamp, MaxAllowableDrift, MAX_ALLOWABLE_DRIFT_PERCENTAGE,
MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST, MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW,
},
stakes::Stakes, stakes::Stakes,
status_cache::{SlotDelta, StatusCache}, status_cache::{SlotDelta, StatusCache},
system_instruction_processor::{get_system_account_kind, SystemAccountKind}, system_instruction_processor::{get_system_account_kind, SystemAccountKind},
@ -97,10 +101,6 @@ use solana_sdk::{
slot_hashes::SlotHashes, slot_hashes::SlotHashes,
slot_history::SlotHistory, slot_history::SlotHistory,
stake::{self, state::Delegation}, stake::{self, state::Delegation},
stake_weighted_timestamp::{
calculate_stake_weighted_timestamp, MaxAllowableDrift, MAX_ALLOWABLE_DRIFT_PERCENTAGE,
MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST, MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW,
},
system_transaction, system_transaction,
sysvar::{self}, sysvar::{self},
timing::years_as_slots, timing::years_as_slots,

View File

@ -36,6 +36,7 @@ pub mod serde_snapshot;
pub mod snapshot_package; pub mod snapshot_package;
pub mod snapshot_utils; pub mod snapshot_utils;
pub mod sorted_storages; pub mod sorted_storages;
pub mod stake_weighted_timestamp;
pub mod stakes; pub mod stakes;
pub mod status_cache; pub mod status_cache;
mod system_instruction_processor; mod system_instruction_processor;

View File

@ -11,22 +11,17 @@ use std::{
time::Duration, time::Duration,
}; };
pub const MAX_ALLOWABLE_DRIFT_PERCENTAGE: u32 = 50; pub(crate) const MAX_ALLOWABLE_DRIFT_PERCENTAGE: u32 = 50;
pub const MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST: u32 = 25; pub(crate) const MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST: u32 = 25;
pub const MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW: u32 = 80; pub(crate) const MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW: u32 = 80;
pub enum EstimateType {
Bounded(MaxAllowableDrift), // Value represents max allowable drift percentage
Unbounded, // Deprecated. Remove in the Solana v1.6.0 timeframe
}
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct MaxAllowableDrift { pub(crate) struct MaxAllowableDrift {
pub fast: u32, // Max allowable drift percentage faster than poh estimate pub fast: u32, // Max allowable drift percentage faster than poh estimate
pub slow: u32, // Max allowable drift percentage slower than poh estimate pub slow: u32, // Max allowable drift percentage slower than poh estimate
} }
pub fn calculate_stake_weighted_timestamp<I, K, V, T>( pub(crate) fn calculate_stake_weighted_timestamp<I, K, V, T>(
unique_timestamps: I, unique_timestamps: I,
stakes: &HashMap<Pubkey, (u64, T /*Account|ArcVoteAccount*/)>, stakes: &HashMap<Pubkey, (u64, T /*Account|ArcVoteAccount*/)>,
slot: Slot, slot: Slot,

View File

@ -44,7 +44,6 @@ pub mod secp256k1_instruction;
pub mod shred_version; pub mod shred_version;
pub mod signature; pub mod signature;
pub mod signer; pub mod signer;
pub mod stake_weighted_timestamp;
pub mod system_transaction; pub mod system_transaction;
pub mod timing; pub mod timing;
pub mod transaction; pub mod transaction;