mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
Fix BlobsByRange by reverting PR6462 (#6526)
* Revert "Remove generic E from RequestId (#6462)"
This reverts commit 772929fae2.
This commit is contained in:
@@ -8,6 +8,7 @@ use ssz_derive::{Decode, Encode};
|
||||
use ssz_types::{typenum::U256, VariableList};
|
||||
use std::collections::BTreeMap;
|
||||
use std::fmt::Display;
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
use strum::IntoStaticStr;
|
||||
@@ -93,19 +94,27 @@ pub struct Ping {
|
||||
variant_attributes(derive(Clone, Debug, PartialEq, Serialize),)
|
||||
)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct MetadataRequest;
|
||||
pub struct MetadataRequest<E: EthSpec> {
|
||||
_phantom_data: PhantomData<E>,
|
||||
}
|
||||
|
||||
impl MetadataRequest {
|
||||
impl<E: EthSpec> MetadataRequest<E> {
|
||||
pub fn new_v1() -> Self {
|
||||
Self::V1(MetadataRequestV1 {})
|
||||
Self::V1(MetadataRequestV1 {
|
||||
_phantom_data: PhantomData,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn new_v2() -> Self {
|
||||
Self::V2(MetadataRequestV2 {})
|
||||
Self::V2(MetadataRequestV2 {
|
||||
_phantom_data: PhantomData,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn new_v3() -> Self {
|
||||
Self::V3(MetadataRequestV3 {})
|
||||
Self::V3(MetadataRequestV3 {
|
||||
_phantom_data: PhantomData,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,14 +324,11 @@ pub struct BlobsByRangeRequest {
|
||||
|
||||
/// The number of slots from the start slot.
|
||||
pub count: u64,
|
||||
|
||||
/// maximum number of blobs in a single block.
|
||||
pub max_blobs_per_block: usize,
|
||||
}
|
||||
|
||||
impl BlobsByRangeRequest {
|
||||
pub fn max_blobs_requested(&self) -> u64 {
|
||||
self.count.saturating_mul(self.max_blobs_per_block as u64)
|
||||
pub fn max_blobs_requested<E: EthSpec>(&self) -> u64 {
|
||||
self.count.saturating_mul(E::max_blobs_per_block() as u64)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +344,7 @@ pub struct DataColumnsByRangeRequest {
|
||||
}
|
||||
|
||||
impl DataColumnsByRangeRequest {
|
||||
pub fn max_requested(&self) -> u64 {
|
||||
pub fn max_requested<E: EthSpec>(&self) -> u64 {
|
||||
self.count.saturating_mul(self.columns.len() as u64)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user