Skip to content

Commit

Permalink
remove some unused parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed Oct 15, 2024
1 parent 20910cb commit 06e7835
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 53 deletions.
19 changes: 1 addition & 18 deletions crates/testing/src/test_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use hotshot_example_types::{
use hotshot_types::{
consensus::ConsensusMetricsValue,
traits::node_implementation::{NodeType, Versions},
ExecutionType, HotShotConfig, ValidatorConfig,
HotShotConfig, ValidatorConfig,
};
use tide_disco::Url;
use vec1::Vec1;
Expand All @@ -43,12 +43,8 @@ pub type TransactionValidator = Arc<dyn Fn(&Vec<(u64, u64)>) -> Result<()> + Sen
pub struct TimingData {
/// Base duration for next-view timeout, in milliseconds
pub next_view_timeout: u64,
/// The exponential backoff ration for the next-view timeout
pub timeout_ratio: (u64, u64),
/// The delay a leader inserts before starting pre-commit, in milliseconds
pub round_start_delay: u64,
/// Delay after init before starting consensus, in milliseconds
pub start_delay: u64,
/// The maximum amount of time a leader can wait to get a block from a builder
pub builder_timeout: Duration,
/// time to wait until we request data associated with a proposal
Expand Down Expand Up @@ -286,9 +282,7 @@ impl Default for TimingData {
fn default() -> Self {
Self {
next_view_timeout: 4000,
timeout_ratio: (11, 10),
round_start_delay: 100,
start_delay: 100,
builder_timeout: Duration::from_millis(500),
data_request_delay: Duration::from_millis(200),
secondary_network_delay: Duration::from_millis(1000),
Expand Down Expand Up @@ -319,8 +313,6 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> TestDescription
},
timing_data: TimingData {
next_view_timeout: 2000,
timeout_ratio: (1, 1),
start_delay: 20000,
round_start_delay: 25,
..TimingData::default()
},
Expand Down Expand Up @@ -348,7 +340,6 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> TestDescription
expected_views_to_fail: HashMap::new(),
},
timing_data: TimingData {
start_delay: 120_000,
round_start_delay: 25,
..TimingData::default()
},
Expand Down Expand Up @@ -487,10 +478,8 @@ where
// let da_committee_nodes = known_nodes[0..da_committee_size].to_vec();
let config = HotShotConfig {
// TODO this doesn't exist anymore
execution_type: ExecutionType::Incremental,
start_threshold: (1, 1),
num_nodes_with_stake: NonZeroUsize::new(num_nodes_with_stake).unwrap(),
// Currently making this zero for simplicity
known_da_nodes,
num_bootstrap: num_bootstrap_nodes,
known_nodes_with_stake,
Expand All @@ -500,9 +489,7 @@ where
fixed_leader_for_gpuvid: 1,
next_view_timeout: 500,
view_sync_timeout: Duration::from_millis(250),
timeout_ratio: (11, 10),
round_start_delay: 25,
start_delay: 1,
builder_timeout: Duration::from_millis(1000),
data_request_delay: Duration::from_millis(200),
// Placeholder until we spin up the builder
Expand All @@ -518,9 +505,7 @@ where
};
let TimingData {
next_view_timeout,
timeout_ratio,
round_start_delay,
start_delay,
builder_timeout,
data_request_delay,
secondary_network_delay,
Expand All @@ -530,9 +515,7 @@ where
// TODO this should really be using the timing config struct
|a: &mut HotShotConfig<TYPES::SignatureKey>| {
a.next_view_timeout = next_view_timeout;
a.timeout_ratio = timeout_ratio;
a.round_start_delay = round_start_delay;
a.start_delay = start_delay;
a.builder_timeout = builder_timeout;
a.data_request_delay = data_request_delay;
a.view_sync_timeout = view_sync_timeout;
Expand Down
8 changes: 0 additions & 8 deletions crates/testing/tests/tests_5/combined_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ async fn test_combined_network() {
timing_data: TimingData {
round_start_delay: 25,
next_view_timeout: 10_000,
start_delay: 120_000,

..Default::default()
},
overall_safety_properties: OverallSafetyPropertiesDescription {
Expand Down Expand Up @@ -113,8 +111,6 @@ async fn test_combined_network_reup() {
timing_data: TimingData {
round_start_delay: 25,
next_view_timeout: 10_000,
start_delay: 120_000,

..Default::default()
},
overall_safety_properties: OverallSafetyPropertiesDescription {
Expand Down Expand Up @@ -166,8 +162,6 @@ async fn test_combined_network_half_dc() {
timing_data: TimingData {
round_start_delay: 25,
next_view_timeout: 10_000,
start_delay: 120_000,

..Default::default()
},
overall_safety_properties: OverallSafetyPropertiesDescription {
Expand Down Expand Up @@ -246,8 +240,6 @@ async fn test_stress_combined_network_fuzzy() {
timing_data: TimingData {
round_start_delay: 25,
next_view_timeout: 10_000,
start_delay: 120_000,

..Default::default()
},

Expand Down
2 changes: 0 additions & 2 deletions crates/testing/tests/tests_5/push_cdn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ async fn push_cdn_network() {
timing_data: TimingData {
round_start_delay: 25,
next_view_timeout: 10_000,
start_delay: 120_000,

..Default::default()
},
overall_safety_properties: OverallSafetyPropertiesDescription {
Expand Down
1 change: 0 additions & 1 deletion crates/testing/tests/tests_5/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ async fn test_timeout_libp2p() {
async_compatibility_layer::logging::setup_backtrace();
let timing_data = TimingData {
next_view_timeout: 2000,
start_delay: 2000,
round_start_delay: 1000,
..Default::default()
};
Expand Down
2 changes: 0 additions & 2 deletions crates/testing/tests/tests_5/unreliable_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ async fn libp2p_network_async() {
},
),
timing_data: TimingData {
timeout_ratio: (1, 1),
next_view_timeout: 25000,
..TestDescription::<TestTypes, Libp2pImpl, TestVersions>::default_multiple_rounds()
.timing_data
Expand Down Expand Up @@ -150,7 +149,6 @@ async fn test_memory_network_async() {
},
),
timing_data: TimingData {
timeout_ratio: (1, 1),
next_view_timeout: 1000,
..TestDescription::<TestTypes, MemoryImpl, TestVersions>::default_multiple_rounds()
.timing_data
Expand Down
5 changes: 1 addition & 4 deletions crates/types/src/hotshot_config_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use vec1::Vec1;

use crate::{
constants::REQUEST_DATA_DELAY, traits::signature_key::SignatureKey,
upgrade_config::UpgradeConfig, ExecutionType, HotShotConfig, PeerConfig, ValidatorConfig,
upgrade_config::UpgradeConfig, HotShotConfig, PeerConfig, ValidatorConfig,
};

/// Default builder URL, used as placeholder
Expand Down Expand Up @@ -70,7 +70,6 @@ pub struct HotShotConfigFile<KEY: SignatureKey> {
impl<KEY: SignatureKey> From<HotShotConfigFile<KEY>> for HotShotConfig<KEY> {
fn from(val: HotShotConfigFile<KEY>) -> Self {
HotShotConfig {
execution_type: ExecutionType::Continuous,
start_threshold: val.start_threshold,
num_nodes_with_stake: val.num_nodes_with_stake,
known_da_nodes: val.known_da_nodes,
Expand All @@ -81,9 +80,7 @@ impl<KEY: SignatureKey> From<HotShotConfigFile<KEY>> for HotShotConfig<KEY> {
fixed_leader_for_gpuvid: val.fixed_leader_for_gpuvid,
next_view_timeout: val.next_view_timeout,
view_sync_timeout: val.view_sync_timeout,
timeout_ratio: val.timeout_ratio,
round_start_delay: val.round_start_delay,
start_delay: val.start_delay,
num_bootstrap: val.num_bootstrap,
builder_timeout: val.builder_timeout,
data_request_delay: val
Expand Down
19 changes: 1 addition & 18 deletions crates/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@ where
{
assert_future::<F::Output, _>(Box::pin(fut))
}
/// the type of consensus to run. Either:
/// wait for a signal to start a view,
/// or constantly run
/// you almost always want continuous
/// incremental is just for testing
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]
pub enum ExecutionType {
/// constantly increment view as soon as view finishes
Continuous,
/// wait for a signal
Incremental,
}

#[derive(serde::Serialize, serde::Deserialize, Clone, Derivative, Display)]
#[serde(bound(deserialize = ""))]
Expand Down Expand Up @@ -178,8 +166,6 @@ impl<KEY: SignatureKey> Default for PeerConfig<KEY> {
#[derive(Clone, custom_debug::Debug, serde::Serialize, serde::Deserialize)]
#[serde(bound(deserialize = ""))]
pub struct HotShotConfig<KEY: SignatureKey> {
/// Whether to run one view or continuous views
pub execution_type: ExecutionType,
/// The proportion of nodes required before the orchestrator issues the ready signal,
/// expressed as (numerator, denominator)
pub start_threshold: (u64, u64),
Expand All @@ -202,12 +188,9 @@ pub struct HotShotConfig<KEY: SignatureKey> {
pub next_view_timeout: u64,
/// Duration of view sync round timeouts
pub view_sync_timeout: Duration,
/// The exponential backoff ration for the next-view timeout
pub timeout_ratio: (u64, u64),

/// The delay a leader inserts before starting pre-commit, in milliseconds
pub round_start_delay: u64,
/// Delay after init before starting consensus, in milliseconds
pub start_delay: u64,
/// Number of network bootstrap nodes
pub num_bootstrap: usize,
/// The maximum amount of time a leader can wait to get a block from a builder
Expand Down

0 comments on commit 06e7835

Please sign in to comment.