mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
Partial columns cleanup (#9321)
#8314 left a few ugly potentially panicking location behind - all of them believed to be unreachable, but this PR fixes them regardless for good hygiene. Update to `ethereum_ssz 0.10.4` for two new helpers: `not_inplace` and `clone_zeroed`. Remove remaining `expect` and `todo!` in favour of these helpers and one new fallible (but practically infallible) method. Co-Authored-By: Daniel Knopik <daniel@dknopik.de>
This commit is contained in:
@@ -250,19 +250,16 @@ impl<E: EthSpec> DataColumnSidecarFulu<E> {
|
||||
}
|
||||
|
||||
/// Convert this full data column into a verifiable partial data column.
|
||||
pub fn to_partial(&self) -> PartialDataColumn<E> {
|
||||
/// Note: This is not expected to ever fail.
|
||||
pub fn to_partial(&self) -> Result<PartialDataColumn<E>, PartialDataColumnSidecarError> {
|
||||
let cell_count = self.column.len();
|
||||
let mut bitmap =
|
||||
CellBitmap::<E>::with_capacity(cell_count).expect("our column has the same bound");
|
||||
for idx in 0..cell_count {
|
||||
bitmap
|
||||
.set(idx, true)
|
||||
.expect("The correct size is initialized right above");
|
||||
}
|
||||
let mut bitmap = CellBitmap::<E>::with_capacity(cell_count)
|
||||
.map_err(|_| PartialDataColumnSidecarError::UnexpectedBounds)?;
|
||||
bitmap.not_inplace();
|
||||
|
||||
let block_root = self.block_root();
|
||||
|
||||
PartialDataColumn {
|
||||
Ok(PartialDataColumn {
|
||||
block_root,
|
||||
index: self.index,
|
||||
sidecar: PartialDataColumnSidecar {
|
||||
@@ -276,7 +273,7 @@ impl<E: EthSpec> DataColumnSidecarFulu<E> {
|
||||
})
|
||||
.into(),
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user