-
Notifications
You must be signed in to change notification settings - Fork 814
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update PeerDAS spec tests to
1.5.0-beta.0
and fix failing unit tests.
- Loading branch information
1 parent
056a375
commit 283f940
Showing
6 changed files
with
110 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
testing/ef_tests/src/cases/compute_columns_for_custody_groups.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use super::*; | ||
use serde::Deserialize; | ||
use std::marker::PhantomData; | ||
use types::data_column_custody_group::{compute_columns_for_custody_group, CustodyIndex}; | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
#[serde(bound = "E: EthSpec", deny_unknown_fields)] | ||
pub struct ComputeColumnsForCustodyGroups<E: EthSpec> { | ||
/// The custody group index. | ||
pub custody_group: CustodyIndex, | ||
/// The list of resulting custody columns. | ||
pub result: Vec<u64>, | ||
#[serde(skip)] | ||
_phantom: PhantomData<E>, | ||
} | ||
|
||
impl<E: EthSpec> LoadCase for ComputeColumnsForCustodyGroups<E> { | ||
fn load_from_dir(path: &Path, _fork_name: ForkName) -> Result<Self, Error> { | ||
decode::yaml_decode_file(path.join("meta.yaml").as_path()) | ||
} | ||
} | ||
|
||
impl<E: EthSpec> Case for ComputeColumnsForCustodyGroups<E> { | ||
fn is_enabled_for_fork(_fork_name: ForkName) -> bool { | ||
false | ||
} | ||
|
||
fn is_enabled_for_feature(feature_name: FeatureName) -> bool { | ||
feature_name == FeatureName::Fulu | ||
} | ||
|
||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> { | ||
let spec = E::default_spec(); | ||
let computed_columns = compute_columns_for_custody_group(self.custody_group, &spec) | ||
.expect("should compute custody columns from group") | ||
.collect::<Vec<_>>(); | ||
|
||
let expected = &self.result; | ||
if computed_columns == *expected { | ||
Ok(()) | ||
} else { | ||
Err(Error::NotEqual(format!( | ||
"Got {computed_columns:?}\nExpected {expected:?}" | ||
))) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters