* Move stake_weighted_timestamp module (#18114)
* Move timestamp module into runtime
* Less public
* Remove unused enum
(cherry picked from commit 19fe1dd463
)
# Conflicts:
# runtime/src/bank.rs
# runtime/src/lib.rs
* Fix conflicts
Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
@ -18,6 +18,10 @@ use crate::{
|
||||
log_collector::LogCollector,
|
||||
message_processor::{ExecuteDetailsTimings, Executors, MessageProcessor},
|
||||
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,
|
||||
status_cache::{SlotDelta, StatusCache},
|
||||
system_instruction_processor::{get_system_account_kind, SystemAccountKind},
|
||||
@ -63,10 +67,6 @@ use solana_sdk::{
|
||||
signature::{Keypair, Signature},
|
||||
slot_hashes::SlotHashes,
|
||||
slot_history::SlotHistory,
|
||||
stake_weighted_timestamp::{
|
||||
calculate_stake_weighted_timestamp, MaxAllowableDrift, MAX_ALLOWABLE_DRIFT_PERCENTAGE,
|
||||
MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST, MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW,
|
||||
},
|
||||
system_transaction,
|
||||
sysvar::{self},
|
||||
timing::years_as_slots,
|
||||
|
@ -31,6 +31,7 @@ pub mod secondary_index;
|
||||
pub mod serde_snapshot;
|
||||
pub mod snapshot_package;
|
||||
pub mod snapshot_utils;
|
||||
pub mod stake_weighted_timestamp;
|
||||
pub mod stakes;
|
||||
pub mod status_cache;
|
||||
mod system_instruction_processor;
|
||||
|
@ -11,22 +11,17 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
pub const MAX_ALLOWABLE_DRIFT_PERCENTAGE: u32 = 50;
|
||||
pub const MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST: u32 = 25;
|
||||
pub 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
|
||||
}
|
||||
pub(crate) const MAX_ALLOWABLE_DRIFT_PERCENTAGE: u32 = 50;
|
||||
pub(crate) const MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST: u32 = 25;
|
||||
pub(crate) const MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW: u32 = 80;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MaxAllowableDrift {
|
||||
pub(crate) struct MaxAllowableDrift {
|
||||
pub fast: u32, // Max allowable drift percentage faster 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,
|
||||
stakes: &HashMap<Pubkey, (u64, T /*Account|ArcVoteAccount*/)>,
|
||||
slot: Slot,
|
@ -43,7 +43,6 @@ pub mod secp256k1_instruction;
|
||||
pub mod shred_version;
|
||||
pub mod signature;
|
||||
pub mod signer;
|
||||
pub mod stake_weighted_timestamp;
|
||||
pub mod system_transaction;
|
||||
pub mod timing;
|
||||
pub mod transaction;
|
||||
|
Reference in New Issue
Block a user