931daa40d7
## Issue Addressed Resolves #2545 ## Proposed Changes Adds the long-overdue EF tests for fork choice. Although we had pretty good coverage via other implementations that closely followed our approach, it is nonetheless important for us to implement these tests too. During testing I found that we were using a hard-coded `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` value rather than one from the `ChainSpec`. This caused a failure during a minimal preset test. This doesn't represent a risk to mainnet or testnets, since the hard-coded value matched the mainnet preset. ## Failing Cases There is one failing case which is presently marked as `SkippedKnownFailure`: ``` case 4 ("new_finalized_slot_is_justified_checkpoint_ancestor") from /home/paul/development/lighthouse/testing/ef_tests/consensus-spec-tests/tests/minimal/phase0/fork_choice/on_block/pyspec_tests/new_finalized_slot_is_justified_checkpoint_ancestor failed with NotEqual: head check failed: Got Head { slot: Slot(40), root: 0x9183dbaed4191a862bd307d476e687277fc08469fc38618699863333487703e7 } | Expected Head { slot: Slot(24), root: 0x105b49b51bf7103c182aa58860b039550a89c05a4675992e2af703bd02c84570 } ``` This failure is due to #2741. It's not a particularly high priority issue at the moment, so we fix it after merging this PR.
47 lines
1.6 KiB
Rust
47 lines
1.6 KiB
Rust
#[derive(Debug, PartialEq, Clone)]
|
|
pub enum Error {
|
|
/// The value in the test didn't match our value.
|
|
NotEqual(String),
|
|
/// The test specified a failure and we did not experience one.
|
|
DidntFail(String),
|
|
/// Failed to parse the test (internal error).
|
|
FailedToParseTest(String),
|
|
/// Test case contained invalid BLS data.
|
|
InvalidBLSInput(String),
|
|
/// Skipped the test because the BLS setting was mismatched.
|
|
SkippedBls,
|
|
/// Skipped the test because it's known to fail.
|
|
SkippedKnownFailure,
|
|
/// The test failed due to some internal error preventing the test from running.
|
|
InternalError(String),
|
|
}
|
|
|
|
impl Error {
|
|
pub fn name(&self) -> &str {
|
|
match self {
|
|
Error::NotEqual(_) => "NotEqual",
|
|
Error::DidntFail(_) => "DidntFail",
|
|
Error::FailedToParseTest(_) => "FailedToParseTest",
|
|
Error::InvalidBLSInput(_) => "InvalidBLSInput",
|
|
Error::SkippedBls => "SkippedBls",
|
|
Error::SkippedKnownFailure => "SkippedKnownFailure",
|
|
Error::InternalError(_) => "InternalError",
|
|
}
|
|
}
|
|
|
|
pub fn message(&self) -> &str {
|
|
match self {
|
|
Error::NotEqual(m) => m.as_str(),
|
|
Error::DidntFail(m) => m.as_str(),
|
|
Error::FailedToParseTest(m) => m.as_str(),
|
|
Error::InvalidBLSInput(m) => m.as_str(),
|
|
Error::InternalError(m) => m.as_str(),
|
|
_ => self.name(),
|
|
}
|
|
}
|
|
|
|
pub fn is_skipped(&self) -> bool {
|
|
matches!(self, Error::SkippedBls | Error::SkippedKnownFailure)
|
|
}
|
|
}
|