Decouple turns from segments in PoRep (#5004)

* Decouple Segments from Turns in Storage

* Get replicator local cluster tests running in a reasonable amount of time

* Fix unused imports

* Document new RPC APIs

* Check for exit while polling
This commit is contained in:
Sagar Dhawan
2019-07-10 13:33:29 -07:00
committed by GitHub
parent a383ea532f
commit 35ec7a5156
11 changed files with 183 additions and 99 deletions

View File

@@ -23,7 +23,7 @@ use solana_sdk::genesis_block::GenesisBlock;
use solana_sdk::poh_config::PohConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::timing::{timestamp, DEFAULT_SLOTS_PER_SEGMENT};
use solana_sdk::timing::{timestamp, DEFAULT_SLOTS_PER_TURN};
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::Receiver;
@@ -35,7 +35,7 @@ pub struct ValidatorConfig {
pub sigverify_disabled: bool,
pub voting_disabled: bool,
pub blockstream: Option<String>,
pub storage_rotate_count: u64,
pub storage_slots_per_turn: u64,
pub account_paths: Option<String>,
pub rpc_config: JsonRpcConfig,
pub snapshot_path: Option<String>,
@@ -44,15 +44,11 @@ pub struct ValidatorConfig {
impl Default for ValidatorConfig {
fn default() -> Self {
// TODO: remove this, temporary parameter to configure
// storage amount differently for test configurations
// so tests don't take forever to run.
const NUM_HASHES_FOR_STORAGE_ROTATE: u64 = DEFAULT_SLOTS_PER_SEGMENT;
Self {
sigverify_disabled: false,
voting_disabled: false,
blockstream: None,
storage_rotate_count: NUM_HASHES_FOR_STORAGE_ROTATE,
storage_slots_per_turn: DEFAULT_SLOTS_PER_TURN,
account_paths: None,
rpc_config: JsonRpcConfig::default(),
snapshot_path: None,
@@ -157,7 +153,11 @@ impl Validator {
keypair.clone(),
)));
let storage_state = StorageState::new(&bank.last_blockhash(), bank.slots_per_segment());
let storage_state = StorageState::new(
&bank.last_blockhash(),
config.storage_slots_per_turn,
bank.slots_per_segment(),
);
let rpc_service = if node.info.rpc.port() == 0 {
None
@@ -240,7 +240,6 @@ impl Validator {
&cluster_info,
sockets,
blocktree.clone(),
config.storage_rotate_count,
&storage_state,
config.blockstream.as_ref(),
ledger_signal_receiver,