From 773b21b34e155e59e05548ecaa90193e67b9f34b Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Thu, 7 Jan 2021 09:49:42 -0600 Subject: [PATCH] consolidate DEFAULT_HASHES_PER_TICK (#14463) --- core/src/validator.rs | 5 +---- genesis/src/main.rs | 3 +-- sdk/program/src/clock.rs | 2 ++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/validator.rs b/core/src/validator.rs index f2cbe1c03f..363f1b1888 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -1498,10 +1498,7 @@ mod tests { let poh_config = PohConfig { target_tick_duration: Duration::from_millis(solana_sdk::clock::MS_PER_TICK), // make PoH rate really fast to cause the panic condition - hashes_per_tick: Some( - 100 * solana_sdk::clock::DEFAULT_HASHES_PER_SECOND - / solana_sdk::clock::DEFAULT_TICKS_PER_SECOND, - ), + hashes_per_tick: Some(100 * solana_sdk::clock::DEFAULT_HASHES_PER_TICK), ..PohConfig::default() }; let genesis_config = GenesisConfig { diff --git a/genesis/src/main.rs b/genesis/src/main.rs index ee129c5384..caa7992165 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -462,8 +462,7 @@ fn main() -> Result<(), Box> { poh_config.hashes_per_tick = Some(hashes_per_tick); } ClusterType::Devnet | ClusterType::Testnet | ClusterType::MainnetBeta => { - poh_config.hashes_per_tick = - Some(clock::DEFAULT_HASHES_PER_SECOND / clock::DEFAULT_TICKS_PER_SECOND); + poh_config.hashes_per_tick = Some(clock::DEFAULT_HASHES_PER_TICK); } }, "sleep" => { diff --git a/sdk/program/src/clock.rs b/sdk/program/src/clock.rs index 436cb92f10..f9e8d38aa3 100644 --- a/sdk/program/src/clock.rs +++ b/sdk/program/src/clock.rs @@ -13,6 +13,8 @@ pub const DEFAULT_TICKS_PER_SLOT: u64 = 64; // GCP n1-standard hardware and also a xeon e5-2520 v4 are about this rate of hashes/s pub const DEFAULT_HASHES_PER_SECOND: u64 = 2_000_000; +pub const DEFAULT_HASHES_PER_TICK: u64 = DEFAULT_HASHES_PER_SECOND / DEFAULT_TICKS_PER_SECOND; + // 1 Dev Epoch = 400 ms * 8192 ~= 55 minutes pub const DEFAULT_DEV_SLOTS_PER_EPOCH: u64 = 8192;