Simplify handlers

This commit is contained in:
Michael Sproul
2026-05-07 18:06:51 +10:00
parent 6e2a27cc71
commit ed4de4ee52
2 changed files with 13 additions and 108 deletions

View File

@@ -760,11 +760,6 @@ impl<E: EthSpec> ForkChoiceComplianceHandler<E> {
_phantom: PhantomData, _phantom: PhantomData,
} }
} }
pub fn only_fork(mut self, fork: ForkName) -> Self {
self.only_fork = Some(fork);
self
}
} }
impl<E: EthSpec + TypeName> Handler for ForkChoiceComplianceHandler<E> { impl<E: EthSpec + TypeName> Handler for ForkChoiceComplianceHandler<E> {
@@ -787,25 +782,7 @@ impl<E: EthSpec + TypeName> Handler for ForkChoiceComplianceHandler<E> {
} }
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool { fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
// Compliance tests are only generated for fulu and gloas (post-Electra). cfg!(feature = "fake_crypto") && fork_name.fulu_enabled()
if !fork_name.fulu_enabled() {
return false;
}
// Gloas anchor states currently fail to initialise the test harness with
// "Head block not found in store" after the recent payload-envelope DB
// changes (see https://github.com/sigp/lighthouse/pull/8886). Skip gloas
// here until that path is fixed; fulu compliance still runs.
if fork_name.gloas_enabled() {
return false;
}
if let Some(only) = self.only_fork
&& only != fork_name
{
return false;
}
// Compliance generators emit bogus BLS signatures (`bls_setting: 2`); SSZ-decoding
// them with real BLS yields BLST_BAD_ENCODING. They must run with `fake_crypto`.
cfg!(feature = "fake_crypto")
} }
fn disabled_forks(&self) -> Vec<ForkName> { fn disabled_forks(&self) -> Vec<ForkName> {

View File

@@ -1079,106 +1079,34 @@ fn fork_choice_get_parent_payload_status() {
ForkChoiceHandler::<MainnetEthSpec>::new("get_parent_payload_status").run(); ForkChoiceHandler::<MainnetEthSpec>::new("get_parent_payload_status").run();
} }
// Compliance tests surface real consensus deltas (proposer-boost timing, viable-tree
// weights) that we want to be able to run on demand without blocking CI. They are gated
// behind `#[ignore]` and run via `scripts/compliance-fc-report.sh` (which passes
// `--include-ignored` to cargo test). To run them directly:
// cargo test --release --features "ef_tests,fake_crypto" -p ef_tests --test tests \
// fork_choice_compliance_ -- --include-ignored
#[test] #[test]
#[ignore] fn fork_choice_compliance_attester_slashing_test() {
fn fork_choice_compliance_attester_slashing_test_fulu() { ForkChoiceComplianceHandler::<MinimalEthSpec>::new("attester_slashing_test").run();
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("attester_slashing_test")
.only_fork(ForkName::Fulu)
.run();
} }
#[test] #[test]
#[ignore] fn fork_choice_compliance_block_cover_test() {
fn fork_choice_compliance_attester_slashing_test_gloas() { ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_cover_test").run();
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("attester_slashing_test")
.only_fork(ForkName::Gloas)
.run();
} }
#[test] #[test]
#[ignore] fn fork_choice_compliance_block_tree_test() {
fn fork_choice_compliance_block_cover_test_fulu() { ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_tree_test").run();
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_cover_test")
.only_fork(ForkName::Fulu)
.run();
} }
#[test] #[test]
#[ignore] fn fork_choice_compliance_block_weight_test() {
fn fork_choice_compliance_block_cover_test_gloas() { ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_weight_test").run();
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_cover_test")
.only_fork(ForkName::Gloas)
.run();
} }
#[test] #[test]
#[ignore] fn fork_choice_compliance_invalid_message_test() {
fn fork_choice_compliance_block_tree_test_fulu() { ForkChoiceComplianceHandler::<MinimalEthSpec>::new("invalid_message_test").run();
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_tree_test")
.only_fork(ForkName::Fulu)
.run();
} }
#[test] #[test]
#[ignore] fn fork_choice_compliance_shuffling_test() {
fn fork_choice_compliance_block_tree_test_gloas() { ForkChoiceComplianceHandler::<MinimalEthSpec>::new("shuffling_test").run();
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_tree_test")
.only_fork(ForkName::Gloas)
.run();
}
#[test]
#[ignore]
fn fork_choice_compliance_block_weight_test_fulu() {
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_weight_test")
.only_fork(ForkName::Fulu)
.run();
}
#[test]
#[ignore]
fn fork_choice_compliance_block_weight_test_gloas() {
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("block_weight_test")
.only_fork(ForkName::Gloas)
.run();
}
#[test]
#[ignore]
fn fork_choice_compliance_invalid_message_test_fulu() {
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("invalid_message_test")
.only_fork(ForkName::Fulu)
.run();
}
#[test]
#[ignore]
fn fork_choice_compliance_invalid_message_test_gloas() {
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("invalid_message_test")
.only_fork(ForkName::Gloas)
.run();
}
#[test]
#[ignore]
fn fork_choice_compliance_shuffling_test_fulu() {
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("shuffling_test")
.only_fork(ForkName::Fulu)
.run();
}
#[test]
#[ignore]
fn fork_choice_compliance_shuffling_test_gloas() {
ForkChoiceComplianceHandler::<MinimalEthSpec>::new("shuffling_test")
.only_fork(ForkName::Gloas)
.run();
} }
#[test] #[test]