make batch size check compile time panic

This commit is contained in:
realbigsean 2023-02-13 16:50:33 -05:00
parent 8f9c5cfca9
commit 4c3561dcaf
No known key found for this signature in database
GPG Key ID: BE1B3DB104F6C788

View File

@ -562,13 +562,12 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
/// blocks and blobs. /// blocks and blobs.
#[allow(unused)] #[allow(unused)]
pub fn batch_type(&self, epoch: types::Epoch) -> ByRangeRequestType { pub fn batch_type(&self, epoch: types::Epoch) -> ByRangeRequestType {
if super::backfill_sync::BACKFILL_EPOCHS_PER_BATCH * super::range_sync::EPOCHS_PER_BATCH const _: () = assert!(
!= 1 super::backfill_sync::BACKFILL_EPOCHS_PER_BATCH == 1
{ && super::range_sync::EPOCHS_PER_BATCH == 1,
panic!( "To deal with alignment with 4844 boundaries, batches need to be of just one epoch"
"To deal with alignment with 4844 boundaries, batches need to be of just one epoch" );
);
}
#[cfg(test)] #[cfg(test)]
{ {
// Keep tests only for blocks. // Keep tests only for blocks.