change DEFAULT_NUM_TICKS_PER_SECOND to DEFAULT_TICKS_PER_SECOND (#5559)
This commit is contained in:
parent
2c2de12e88
commit
93ae98812b
|
@ -11,7 +11,7 @@ use solana_sdk::fee_calculator::FeeCalculator;
|
||||||
use solana_sdk::hash::Hash;
|
use solana_sdk::hash::Hash;
|
||||||
use solana_sdk::pubkey::Pubkey;
|
use solana_sdk::pubkey::Pubkey;
|
||||||
use solana_sdk::signature::{KeypairUtil, Signature};
|
use solana_sdk::signature::{KeypairUtil, Signature};
|
||||||
use solana_sdk::timing::{DEFAULT_NUM_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
|
use solana_sdk::timing::{DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
|
||||||
use solana_sdk::transaction::{self, Transaction, TransactionError};
|
use solana_sdk::transaction::{self, Transaction, TransactionError};
|
||||||
use std::error;
|
use std::error;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
@ -135,7 +135,7 @@ impl RpcClient {
|
||||||
if cfg!(not(test)) {
|
if cfg!(not(test)) {
|
||||||
// Retry ~twice during a slot
|
// Retry ~twice during a slot
|
||||||
sleep(Duration::from_millis(
|
sleep(Duration::from_millis(
|
||||||
500 * DEFAULT_TICKS_PER_SLOT / DEFAULT_NUM_TICKS_PER_SECOND,
|
500 * DEFAULT_TICKS_PER_SLOT / DEFAULT_TICKS_PER_SECOND,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -181,7 +181,7 @@ impl RpcClient {
|
||||||
// Delay ~1 tick between write transactions in an attempt to reduce AccountInUse errors
|
// Delay ~1 tick between write transactions in an attempt to reduce AccountInUse errors
|
||||||
// when all the write transactions modify the same program account (eg, deploying a
|
// when all the write transactions modify the same program account (eg, deploying a
|
||||||
// new program)
|
// new program)
|
||||||
sleep(Duration::from_millis(1000 / DEFAULT_NUM_TICKS_PER_SECOND));
|
sleep(Duration::from_millis(1000 / DEFAULT_TICKS_PER_SECOND));
|
||||||
}
|
}
|
||||||
|
|
||||||
let signature = self.send_transaction(&transaction).ok();
|
let signature = self.send_transaction(&transaction).ok();
|
||||||
|
@ -195,7 +195,7 @@ impl RpcClient {
|
||||||
if cfg!(not(test)) {
|
if cfg!(not(test)) {
|
||||||
// Retry ~twice during a slot
|
// Retry ~twice during a slot
|
||||||
sleep(Duration::from_millis(
|
sleep(Duration::from_millis(
|
||||||
500 * DEFAULT_TICKS_PER_SLOT / DEFAULT_NUM_TICKS_PER_SECOND,
|
500 * DEFAULT_TICKS_PER_SLOT / DEFAULT_TICKS_PER_SECOND,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ impl RpcClient {
|
||||||
|
|
||||||
// Retry ~twice during a slot
|
// Retry ~twice during a slot
|
||||||
sleep(Duration::from_millis(
|
sleep(Duration::from_millis(
|
||||||
500 * DEFAULT_TICKS_PER_SLOT / DEFAULT_NUM_TICKS_PER_SECOND,
|
500 * DEFAULT_TICKS_PER_SLOT / DEFAULT_TICKS_PER_SECOND,
|
||||||
));
|
));
|
||||||
num_retries -= 1;
|
num_retries -= 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::rpc_request::{RpcError, RpcRequest};
|
||||||
use log::*;
|
use log::*;
|
||||||
use reqwest;
|
use reqwest;
|
||||||
use reqwest::header::CONTENT_TYPE;
|
use reqwest::header::CONTENT_TYPE;
|
||||||
use solana_sdk::timing::{DEFAULT_NUM_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
|
use solana_sdk::timing::{DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ impl GenericRpcClientRequest for RpcClientRequest {
|
||||||
|
|
||||||
// Sleep for approximately half a slot
|
// Sleep for approximately half a slot
|
||||||
sleep(Duration::from_millis(
|
sleep(Duration::from_millis(
|
||||||
500 * DEFAULT_TICKS_PER_SLOT / DEFAULT_NUM_TICKS_PER_SECOND,
|
500 * DEFAULT_TICKS_PER_SLOT / DEFAULT_TICKS_PER_SECOND,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ use solana_runtime::locked_accounts_results::LockedAccountsResults;
|
||||||
use solana_sdk::poh_config::PohConfig;
|
use solana_sdk::poh_config::PohConfig;
|
||||||
use solana_sdk::pubkey::Pubkey;
|
use solana_sdk::pubkey::Pubkey;
|
||||||
use solana_sdk::timing::{
|
use solana_sdk::timing::{
|
||||||
self, DEFAULT_NUM_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE,
|
self, DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE,
|
||||||
MAX_TRANSACTION_FORWARDING_DELAY,
|
MAX_TRANSACTION_FORWARDING_DELAY,
|
||||||
};
|
};
|
||||||
use solana_sdk::transaction::{self, Transaction, TransactionError};
|
use solana_sdk::transaction::{self, Transaction, TransactionError};
|
||||||
|
@ -700,7 +700,7 @@ impl BankingStage {
|
||||||
.saturating_sub(MAX_TRANSACTION_FORWARDING_DELAY)
|
.saturating_sub(MAX_TRANSACTION_FORWARDING_DELAY)
|
||||||
.saturating_sub(
|
.saturating_sub(
|
||||||
(FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET * bank.ticks_per_slot()
|
(FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET * bank.ticks_per_slot()
|
||||||
/ DEFAULT_NUM_TICKS_PER_SECOND) as usize,
|
/ DEFAULT_TICKS_PER_SECOND) as usize,
|
||||||
),
|
),
|
||||||
&mut error_counters,
|
&mut error_counters,
|
||||||
);
|
);
|
||||||
|
|
|
@ -20,14 +20,14 @@ use solana_sdk::{
|
||||||
signature::{Keypair, KeypairUtil, Signature},
|
signature::{Keypair, KeypairUtil, Signature},
|
||||||
system_transaction,
|
system_transaction,
|
||||||
timing::{
|
timing::{
|
||||||
duration_as_ms, DEFAULT_NUM_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT,
|
duration_as_ms, DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT,
|
||||||
NUM_CONSECUTIVE_LEADER_SLOTS,
|
NUM_CONSECUTIVE_LEADER_SLOTS,
|
||||||
},
|
},
|
||||||
transport::TransportError,
|
transport::TransportError,
|
||||||
};
|
};
|
||||||
use std::{collections::HashSet, path::Path, thread::sleep, time::Duration};
|
use std::{collections::HashSet, path::Path, thread::sleep, time::Duration};
|
||||||
|
|
||||||
const DEFAULT_SLOT_MILLIS: u64 = (DEFAULT_TICKS_PER_SLOT * 1000) / DEFAULT_NUM_TICKS_PER_SECOND;
|
const DEFAULT_SLOT_MILLIS: u64 = (DEFAULT_TICKS_PER_SLOT * 1000) / DEFAULT_TICKS_PER_SECOND;
|
||||||
|
|
||||||
/// Spend and verify from every node in the network
|
/// Spend and verify from every node in the network
|
||||||
pub fn spend_and_verify_all_nodes<S: ::std::hash::BuildHasher>(
|
pub fn spend_and_verify_all_nodes<S: ::std::hash::BuildHasher>(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::message::Message;
|
use crate::message::Message;
|
||||||
use crate::timing::{DEFAULT_NUM_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
|
use crate::timing::{DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
|
||||||
use log::*;
|
use log::*;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
|
||||||
|
@ -28,7 +28,7 @@ pub struct FeeCalculator {
|
||||||
/// TODO: determine good values for these
|
/// TODO: determine good values for these
|
||||||
pub const DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE: u64 = 42;
|
pub const DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE: u64 = 42;
|
||||||
pub const DEFAULT_TARGET_SIGNATURES_PER_SLOT: usize =
|
pub const DEFAULT_TARGET_SIGNATURES_PER_SLOT: usize =
|
||||||
710_000 * DEFAULT_TICKS_PER_SLOT as usize / DEFAULT_NUM_TICKS_PER_SECOND as usize;
|
710_000 * DEFAULT_TICKS_PER_SLOT as usize / DEFAULT_TICKS_PER_SECOND as usize;
|
||||||
pub const DEFAULT_BURN_PERCENT: u8 = 127;
|
pub const DEFAULT_BURN_PERCENT: u8 = 127;
|
||||||
|
|
||||||
impl Default for FeeCalculator {
|
impl Default for FeeCalculator {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::timing::DEFAULT_NUM_TICKS_PER_SECOND;
|
use crate::timing::DEFAULT_TICKS_PER_SECOND;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
|
@ -24,6 +24,6 @@ impl PohConfig {
|
||||||
|
|
||||||
impl Default for PohConfig {
|
impl Default for PohConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new_sleep(Duration::from_millis(1000 / DEFAULT_NUM_TICKS_PER_SECOND))
|
Self::new_sleep(Duration::from_millis(1000 / DEFAULT_TICKS_PER_SECOND))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
// The default tick rate that the cluster attempts to achieve. Note that the actual tick
|
// The default tick rate that the cluster attempts to achieve. Note that the actual tick
|
||||||
// rate at any given time should be expected to drift
|
// rate at any given time should be expected to drift
|
||||||
pub const DEFAULT_NUM_TICKS_PER_SECOND: u64 = 10;
|
pub const DEFAULT_TICKS_PER_SECOND: u64 = 10;
|
||||||
|
|
||||||
// At 10 ticks/s, 4 ticks per slot implies that leader rotation and voting will happen
|
// At 10 ticks/s, 4 ticks per slot implies that leader rotation and voting will happen
|
||||||
// every 400 ms. A fast voting cadence ensures faster finality and convergence
|
// every 400 ms. A fast voting cadence ensures faster finality and convergence
|
||||||
|
|
|
@ -1295,7 +1295,7 @@ fn process_ping(
|
||||||
if signal_receiver
|
if signal_receiver
|
||||||
.recv_timeout(Duration::from_millis(
|
.recv_timeout(Duration::from_millis(
|
||||||
500 * solana_sdk::timing::DEFAULT_TICKS_PER_SLOT
|
500 * solana_sdk::timing::DEFAULT_TICKS_PER_SLOT
|
||||||
/ solana_sdk::timing::DEFAULT_NUM_TICKS_PER_SECOND,
|
/ solana_sdk::timing::DEFAULT_TICKS_PER_SECOND,
|
||||||
))
|
))
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue