Skip to content
Open
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
23 changes: 23 additions & 0 deletions crates/net/p2p/src/beacon/scoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1614,8 +1614,31 @@ mod tests {
}
}

/// Installs the PQ committee configuration for the whole process.
/// The other PQ tests of this binary read it from other threads.
/// So the test runs alone, in a child process of this test binary.
#[test]
fn pq_expected_aggregators_rotate_with_x_committee_counts() {
// Set to this test's name in the child only.
const CHILD: &str = "ETHLAMBDA_ROTATION_TEST_CHILD";
// The test's path in this binary, without the crate's name.
let (_, module) = module_path!().split_once("::").unwrap();
let name = format!("{module}::pq_expected_aggregators_rotate_with_x_committee_counts");
if std::env::var(CHILD).ok().as_deref() != Some(name.as_str()) {
let output = std::process::Command::new(std::env::current_exe().unwrap())
.args([name.as_str(), "--exact"])
.env(CHILD, &name)
.output()
.unwrap();
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
output.status.success() && stdout.contains("test result: ok. 1 passed"),
"the child run failed or ran nothing:\n{stdout}{}",
String::from_utf8_lossy(&output.stderr)
);
return;
}

ethlambda_types::beacon::config::set_x_committee_counts_for_test(&[16, 8, 4, 2, 1]);
let active = 32_768;
let per = AGGREGATORS_PER_COMMITTEE as f64;
Expand Down