mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-29 10:54:24 +00:00
Add slow LMD Ghost working tests.
This commit is contained in:
21
eth2/fork_choice/tests/lmd_ghost_test_vectors.yaml
Normal file
21
eth2/fork_choice/tests/lmd_ghost_test_vectors.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
title: Fork-choice Tests
|
||||
summary: A collection of abstract fork-choice tests for lmd ghost.
|
||||
test_suite: Fork-Choice
|
||||
|
||||
test_cases:
|
||||
- blocks:
|
||||
- id: 'b0'
|
||||
parent: 'b0'
|
||||
- id: 'b1'
|
||||
parent: 'b0'
|
||||
- id: 'b2'
|
||||
parent: 'b1'
|
||||
- id: 'b3'
|
||||
parent: 'b1'
|
||||
weights:
|
||||
- b0: 0
|
||||
- b1: 0
|
||||
- b2: 5
|
||||
- b3: 10
|
||||
heads:
|
||||
- id: 'b3'
|
||||
@@ -1,5 +1,5 @@
|
||||
title: Fork-choice Tests
|
||||
summary: A collection of abstract fork-choice tests.
|
||||
summary: A collection of abstract fork-choice tests for bitwise lmd ghost.
|
||||
test_suite: Fork-Choice
|
||||
|
||||
test_cases:
|
||||
|
||||
@@ -25,13 +25,23 @@ use types::{
|
||||
};
|
||||
use yaml_rust::yaml;
|
||||
|
||||
// run tests
|
||||
#[test]
|
||||
fn test_optimised_lmd_ghost() {
|
||||
test_yaml_vectors(
|
||||
ForkChoiceAlgorithm::OptimisedLMDGhost,
|
||||
"tests/optimised_lmd_ghost_test_vectors.yaml",
|
||||
100,
|
||||
"debug",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_slow_lmd_ghost() {
|
||||
test_yaml_vectors(
|
||||
ForkChoiceAlgorithm::SlowLMDGhost,
|
||||
"tests/lmd_ghost_test_vectors.yaml",
|
||||
100,
|
||||
"debug",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -40,9 +50,10 @@ fn test_yaml_vectors(
|
||||
fork_choice_algo: ForkChoiceAlgorithm,
|
||||
yaml_file_path: &str,
|
||||
max_validators: usize,
|
||||
log_level: &str,
|
||||
) {
|
||||
// set up logging
|
||||
Builder::from_env(Env::default().default_filter_or("debug")).init();
|
||||
Builder::from_env(Env::default().default_filter_or(log_level)).init();
|
||||
|
||||
// load test cases from yaml
|
||||
let test_cases = load_test_cases_from_yaml(yaml_file_path);
|
||||
|
||||
Reference in New Issue
Block a user