mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 11:41:51 +00:00
Refactor feature testing for spec tests (#6737)
* Refactor spec testing for features and simplify usage. * Fix `SszStatic` tests for PeerDAS: exclude eip7594 test vectors when testing Electra types. * Merge branch 'unstable' into refactor-ef-tests-features
This commit is contained in:
@@ -21,6 +21,14 @@ impl<E: EthSpec> LoadCase for GetCustodyColumns<E> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Case for GetCustodyColumns<E> {
|
||||
fn is_enabled_for_fork(_fork_name: ForkName) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name == FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
let spec = E::default_spec();
|
||||
let node_id = U256::from_str_radix(&self.node_id, 10)
|
||||
@@ -33,6 +41,7 @@ impl<E: EthSpec> Case for GetCustodyColumns<E> {
|
||||
)
|
||||
.expect("should compute custody columns")
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let expected = &self.result;
|
||||
if computed == *expected {
|
||||
Ok(())
|
||||
|
||||
@@ -31,10 +31,6 @@ impl<E: EthSpec> Case for KZGBlobToKZGCommitment<E> {
|
||||
fork_name == ForkName::Deneb
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name != FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
let kzg = get_kzg();
|
||||
let commitment = parse_blob::<E>(&self.input.blob).and_then(|blob| {
|
||||
|
||||
@@ -32,10 +32,6 @@ impl<E: EthSpec> Case for KZGComputeBlobKZGProof<E> {
|
||||
fork_name == ForkName::Deneb
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name != FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
let parse_input = |input: &KZGComputeBlobKZGProofInput| -> Result<_, Error> {
|
||||
let blob = parse_blob::<E>(&input.blob)?;
|
||||
|
||||
@@ -26,8 +26,12 @@ impl<E: EthSpec> LoadCase for KZGComputeCellsAndKZGProofs<E> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Case for KZGComputeCellsAndKZGProofs<E> {
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name == ForkName::Deneb
|
||||
fn is_enabled_for_fork(_fork_name: ForkName) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name == FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
|
||||
@@ -39,10 +39,6 @@ impl<E: EthSpec> Case for KZGComputeKZGProof<E> {
|
||||
fork_name == ForkName::Deneb
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name != FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
let parse_input = |input: &KZGComputeKZGProofInput| -> Result<_, Error> {
|
||||
let blob = parse_blob::<E>(&input.blob)?;
|
||||
|
||||
@@ -27,8 +27,12 @@ impl<E: EthSpec> LoadCase for KZGRecoverCellsAndKZGProofs<E> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Case for KZGRecoverCellsAndKZGProofs<E> {
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name == ForkName::Deneb
|
||||
fn is_enabled_for_fork(_fork_name: ForkName) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name == FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
|
||||
@@ -116,10 +116,6 @@ impl<E: EthSpec> Case for KZGVerifyBlobKZGProof<E> {
|
||||
fork_name == ForkName::Deneb
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name != FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
let parse_input = |input: &KZGVerifyBlobKZGProofInput| -> Result<(Blob<E>, KzgCommitment, KzgProof), Error> {
|
||||
let blob = parse_blob::<E>(&input.blob)?;
|
||||
|
||||
@@ -33,10 +33,6 @@ impl<E: EthSpec> Case for KZGVerifyBlobKZGProofBatch<E> {
|
||||
fork_name == ForkName::Deneb
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name != FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
let parse_input = |input: &KZGVerifyBlobKZGProofBatchInput| -> Result<_, Error> {
|
||||
let blobs = input
|
||||
|
||||
@@ -29,8 +29,12 @@ impl<E: EthSpec> LoadCase for KZGVerifyCellKZGProofBatch<E> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Case for KZGVerifyCellKZGProofBatch<E> {
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name == ForkName::Deneb
|
||||
fn is_enabled_for_fork(_fork_name: ForkName) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name == FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
|
||||
@@ -33,10 +33,6 @@ impl<E: EthSpec> Case for KZGVerifyKZGProof<E> {
|
||||
fork_name == ForkName::Deneb
|
||||
}
|
||||
|
||||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool {
|
||||
feature_name != FeatureName::Eip7594
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
let parse_input = |input: &KZGVerifyKZGProofInput| -> Result<_, Error> {
|
||||
let commitment = parse_commitment(&input.commitment)?;
|
||||
|
||||
Reference in New Issue
Block a user