Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub use self::overseer::{
create_default_subsystems, OverseerGen, OverseerGenArgs, RealOverseerGen,
};

#[cfg(test)]
#[cfg(all(test, feature = "disputes"))]
mod tests;

#[cfg(feature = "full-node")]
Expand Down
67 changes: 25 additions & 42 deletions node/service/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(dead_code)]
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

Expand Down Expand Up @@ -138,15 +137,6 @@ fn garbage_vrf() -> (VRFOutput, VRFProof) {
(VRFOutput(o.to_output()), VRFProof(p))
}

// nice to have
const A1: Hash = Hash::repeat_byte(0xA1);
const A2: Hash = Hash::repeat_byte(0xA2);
const A3: Hash = Hash::repeat_byte(0xA3);
const A5: Hash = Hash::repeat_byte(0xA5);

const B2: Hash = Hash::repeat_byte(0xB2);
const B3: Hash = Hash::repeat_byte(0xB3);

/// Representation of a local representation
/// to extract information for finalization target
/// extraction.
Expand Down Expand Up @@ -543,11 +533,11 @@ fn chain_0() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A1,
best_chain_containing_block: Some(A5),
highest_approved_ancestor_block: Some(A3),
undisputed_chain: Some(A2),
expected_finality_target_result: Some(A2),
target_block: a1,
best_chain_containing_block: Some(a5),
highest_approved_ancestor_block: Some(a3),
undisputed_chain: Some(a2),
expected_finality_target_result: Some(a2),
}
}

Expand All @@ -571,11 +561,11 @@ fn chain_1() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A1,
best_chain_containing_block: Some(B3),
highest_approved_ancestor_block: Some(B2),
undisputed_chain: Some(B2),
expected_finality_target_result: Some(B2),
target_block: a1,
best_chain_containing_block: Some(b3),
highest_approved_ancestor_block: Some(b2),
undisputed_chain: Some(b2),
expected_finality_target_result: Some(b2),
}
}

Expand All @@ -599,11 +589,11 @@ fn chain_2() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A3,
best_chain_containing_block: Some(A3),
highest_approved_ancestor_block: Some(A3),
undisputed_chain: Some(A1),
expected_finality_target_result: Some(A1),
target_block: a3,
best_chain_containing_block: Some(a3),
highest_approved_ancestor_block: Some(a3),
undisputed_chain: Some(a1),
expected_finality_target_result: Some(a1),
}
}

Expand All @@ -627,11 +617,11 @@ fn chain_3() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A2,
best_chain_containing_block: Some(A3),
highest_approved_ancestor_block: Some(A3),
undisputed_chain: Some(A2),
expected_finality_target_result: Some(A2),
target_block: a2,
best_chain_containing_block: Some(a3),
highest_approved_ancestor_block: Some(a3),
undisputed_chain: Some(a2),
expected_finality_target_result: Some(a2),
}
}

Expand Down Expand Up @@ -680,11 +670,11 @@ fn chain_5() -> CaseVars {

CaseVars {
chain: builder.init(),
target_block: A2,
best_chain_containing_block: Some(A2),
highest_approved_ancestor_block: Some(A2),
undisputed_chain: Some(A2),
expected_finality_target_result: Some(A2),
target_block: a2,
best_chain_containing_block: Some(a2),
highest_approved_ancestor_block: Some(a2),
undisputed_chain: Some(a2),
expected_finality_target_result: Some(a2),
}
}

Expand Down Expand Up @@ -725,43 +715,36 @@ fn chain_6() -> CaseVars {
}
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_0() {
run_specialized_test_w_harness(chain_0);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_1() {
run_specialized_test_w_harness(chain_1);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_2() {
run_specialized_test_w_harness(chain_2);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_3() {
run_specialized_test_w_harness(chain_3);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_4_target_hash_value_not_contained() {
run_specialized_test_w_harness(chain_4);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_5_best_is_target_hash() {
run_specialized_test_w_harness(chain_5);
}

#[cfg(feature = "disputes")]
#[test]
fn chain_sel_6_approval_lag() {
run_specialized_test_w_harness(chain_6);
Expand Down