handle no blobs from peers instead of empty blobs in range requests

This commit is contained in:
Diva M
2022-12-22 17:30:04 -05:00
parent 33d01a7911
commit cd6655dba9
6 changed files with 317 additions and 268 deletions

View File

@@ -1,13 +1,17 @@
use crate::{Blob, EthSpec, Hash256, SignedRoot, Slot};
use crate::test_utils::TestRandom;
use crate::{Blob, EthSpec, Hash256, SignedBeaconBlock, SignedRoot, Slot};
use kzg::KzgProof;
use serde_derive::{Deserialize, Serialize};
use ssz::Encode;
use ssz_derive::{Decode, Encode};
use ssz_types::VariableList;
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, PartialEq, Default)]
#[derive(
Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, PartialEq, Default, TestRandom,
)]
#[serde(bound = "T: EthSpec")]
pub struct BlobsSidecar<T: EthSpec> {
pub beacon_block_root: Hash256,
@@ -23,6 +27,7 @@ impl<T: EthSpec> BlobsSidecar<T> {
pub fn empty() -> Self {
Self::default()
}
#[allow(clippy::integer_arithmetic)]
pub fn max_size() -> usize {
// Fixed part