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:
Daniel Knopik
2026-05-21 05:25:02 +02:00
committed by GitHub
parent 2c76ee5b6b
commit a9637c1650
6 changed files with 47 additions and 39 deletions

View File

@@ -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(),
},
}
})
}
}