Skip to content

Commit

Permalink
Merge pull request #1917 from EspressoSystems/bf/stricter-tests
Browse files Browse the repository at this point in the history
Make Test Stricter
  • Loading branch information
bfish713 authored Oct 16, 2023
2 parents a5f311c + f0ca683 commit 4da489b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion crates/testing/src/overall_safety_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ impl Default for OverallSafetyPropertiesDescription {
check_leaf: false,
check_state: true,
check_block: true,
num_failed_views: 10,
num_failed_views: 0,
transaction_threshold: 0,
// very strict
threshold_calculator: Arc::new(|_num_live, num_total| 2 * num_total / 3 + 1),
Expand Down
19 changes: 10 additions & 9 deletions crates/testing/src/test_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ pub struct TestMetadata {
impl Default for TimingData {
fn default() -> Self {
Self {
next_view_timeout: 10000,
next_view_timeout: 1000,
timeout_ratio: (11, 10),
round_start_delay: 1,
start_delay: 1,
round_start_delay: 100,
start_delay: 100,
propose_min_round_time: Duration::new(0, 0),
propose_max_round_time: Duration::new(5, 0),
propose_max_round_time: Duration::from_millis(100),
}
}
}
Expand Down Expand Up @@ -125,7 +125,7 @@ impl TestMetadata {
}

/// Default setting with 20 nodes and 10 views of successful views.
pub fn default_more_nodes_less_success() -> TestMetadata {
pub fn default_more_nodes() -> TestMetadata {
TestMetadata {
total_nodes: 20,
start_nodes: 20,
Expand All @@ -139,12 +139,13 @@ impl TestMetadata {
completion_task_description: CompletionTaskDescription::TimeBasedCompletionTaskBuilder(
TimeBasedCompletionTaskDescription {
// Increase the duration to get the expected number of successful views.
duration: Duration::new(40, 0),
duration: Duration::new(140, 0),
},
),
overall_safety_properties: OverallSafetyPropertiesDescription {
num_successful_views: 10,
..Default::default()
overall_safety_properties: Default::default(),
timing_data: TimingData {
next_view_timeout: 1000,
..TimingData::default()
},
..TestMetadata::default()
}
Expand Down
17 changes: 11 additions & 6 deletions crates/testing/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async fn test_with_failures_one() {

async_compatibility_layer::logging::setup_logging();
async_compatibility_layer::logging::setup_backtrace();
let mut metadata = TestMetadata::default_more_nodes_less_success();
let mut metadata = TestMetadata::default_more_nodes();
// The first 14 (i.e., 20 - f) nodes are in the DA committee and we may shutdown the
// remaining 6 (i.e., f) nodes. We could remove this restriction after fixing the
// following issue.
Expand All @@ -50,8 +50,9 @@ async fn test_with_failures_one() {
}];

metadata.spinning_properties = SpinningTaskDescription {
node_changes: vec![(Duration::new(4, 0), dead_nodes)],
node_changes: vec![(Duration::new(1, 0), dead_nodes)],
};
metadata.overall_safety_properties.num_failed_views = 2;
metadata
.gen_launcher::<SequencingTestTypes, SequencingMemoryImpl>()
.launch()
Expand All @@ -77,7 +78,7 @@ async fn test_with_failures_half_f() {

async_compatibility_layer::logging::setup_logging();
async_compatibility_layer::logging::setup_backtrace();
let mut metadata = TestMetadata::default_more_nodes_less_success();
let mut metadata = TestMetadata::default_more_nodes();
// The first 14 (i.e., 20 - f) nodes are in the DA committee and we may shutdown the
// remaining 6 (i.e., f) nodes. We could remove this restriction after fixing the
// following issue.
Expand All @@ -99,8 +100,9 @@ async fn test_with_failures_half_f() {
];

metadata.spinning_properties = SpinningTaskDescription {
node_changes: vec![(Duration::new(4, 0), dead_nodes)],
node_changes: vec![(Duration::new(1, 0), dead_nodes)],
};
metadata.overall_safety_properties.num_failed_views = 6;
metadata
.gen_launcher::<SequencingTestTypes, SequencingMemoryImpl>()
.launch()
Expand All @@ -126,7 +128,10 @@ async fn test_with_failures_f() {

async_compatibility_layer::logging::setup_logging();
async_compatibility_layer::logging::setup_backtrace();
let mut metadata = TestMetadata::default_more_nodes_less_success();
let mut metadata = TestMetadata::default_more_nodes();
metadata.overall_safety_properties.num_failed_views = 6;
// Make sure we keep commiting rounds after the bad leaders, but not the full 50 because of the numerous timeouts
metadata.overall_safety_properties.num_successful_views = 22;
// The first 14 (i.e., 20 - f) nodes are in the DA committee and we may shutdown the
// remaining 6 (i.e., f) nodes. We could remove this restriction after fixing the
// following issue.
Expand Down Expand Up @@ -160,7 +165,7 @@ async fn test_with_failures_f() {
];

metadata.spinning_properties = SpinningTaskDescription {
node_changes: vec![(Duration::new(4, 0), dead_nodes)],
node_changes: vec![(Duration::new(1, 0), dead_nodes)],
};
metadata
.gen_launcher::<SequencingTestTypes, SequencingMemoryImpl>()
Expand Down

0 comments on commit 4da489b

Please sign in to comment.