Change leader rotation time to a multiple of ticks per block (#2414)

* Change leader rotation time to a multiple of ticks per block

* fix component dependencies

* review comments
This commit is contained in:
Pankaj Garg 2019-01-15 12:07:58 -08:00 committed by GitHub
parent fec47a09a9
commit fa4608a95d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -19,10 +19,11 @@ use solana_vote_signer::rpc::LocalVoteSigner;
use std::io::Cursor; use std::io::Cursor;
use std::sync::Arc; use std::sync::Arc;
pub const DEFAULT_BOOTSTRAP_HEIGHT: u64 = 1000; pub const TICKS_PER_BLOCK: u64 = 4;
pub const DEFAULT_LEADER_ROTATION_INTERVAL: u64 = 100; pub const DEFAULT_BOOTSTRAP_HEIGHT: u64 = TICKS_PER_BLOCK * 256;
pub const DEFAULT_SEED_ROTATION_INTERVAL: u64 = 1000; pub const DEFAULT_LEADER_ROTATION_INTERVAL: u64 = TICKS_PER_BLOCK * 32;
pub const DEFAULT_ACTIVE_WINDOW_LENGTH: u64 = 1000; pub const DEFAULT_SEED_ROTATION_INTERVAL: u64 = TICKS_PER_BLOCK * 256;
pub const DEFAULT_ACTIVE_WINDOW_LENGTH: u64 = TICKS_PER_BLOCK * 256;
pub struct LeaderSchedulerConfig { pub struct LeaderSchedulerConfig {
// The interval at which to rotate the leader, should be much less than // The interval at which to rotate the leader, should be much less than

View File

@ -7,6 +7,7 @@ use crate::entry::{EntryReceiver, EntrySender};
use solana_sdk::hash::Hash; use solana_sdk::hash::Hash;
use crate::entry::EntrySlice; use crate::entry::EntrySlice;
use crate::leader_scheduler::TICKS_PER_BLOCK;
use crate::packet::BlobError; use crate::packet::BlobError;
use crate::result::{Error, Result}; use crate::result::{Error, Result};
use crate::service::Service; use crate::service::Service;
@ -25,7 +26,6 @@ use std::thread::{self, Builder, JoinHandle};
use std::time::Duration; use std::time::Duration;
use std::time::Instant; use std::time::Instant;
pub const BLOCK_TICK_COUNT: u64 = 4;
pub const MAX_ENTRY_RECV_PER_ITER: usize = 512; pub const MAX_ENTRY_RECV_PER_ITER: usize = 512;
#[derive(Debug, PartialEq, Eq, Clone)] #[derive(Debug, PartialEq, Eq, Clone)]
@ -104,7 +104,7 @@ impl ReplayStage {
let my_id = keypair.pubkey(); let my_id = keypair.pubkey();
// Next vote tick is ceiling of (current tick/ticks per block) // Next vote tick is ceiling of (current tick/ticks per block)
let mut num_ticks_to_next_vote = BLOCK_TICK_COUNT - (bank.tick_height() % BLOCK_TICK_COUNT); let mut num_ticks_to_next_vote = TICKS_PER_BLOCK - (bank.tick_height() % TICKS_PER_BLOCK);
let mut start_entry_index = 0; let mut start_entry_index = 0;
for (i, entry) in entries.iter().enumerate() { for (i, entry) in entries.iter().enumerate() {
inc_new_counter_info!("replicate-stage_bank-tick", bank.tick_height() as usize); inc_new_counter_info!("replicate-stage_bank-tick", bank.tick_height() as usize);
@ -157,7 +157,7 @@ impl ReplayStage {
break; break;
} }
start_entry_index = i + 1; start_entry_index = i + 1;
num_ticks_to_next_vote = BLOCK_TICK_COUNT; num_ticks_to_next_vote = TICKS_PER_BLOCK;
} }
} }