First pass

This commit is contained in:
Pawan Dhananjay
2024-08-29 16:11:19 -07:00
parent 653126f42e
commit 25feedfde3
29 changed files with 262 additions and 130 deletions

View File

@@ -1669,7 +1669,23 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
.get_bytes(DBColumn::BeaconBlob.into(), block_root.as_bytes())?
{
Some(ref blobs_bytes) => {
let blobs = BlobSidecarList::from_ssz_bytes(blobs_bytes)?;
// We insert a VariableList of BlobSidecars into the db, but retrieve
// a plain vec since we don't know the length limit of the list without
// knowing the slot.
// The encoding of a VariableList is same as a regular vec.
let blobs = BlobSidecarVec::from_ssz_bytes(blobs_bytes)?;
let max_blobs_per_block = blobs
.first()
.map(|blob| {
self.spec
.max_blobs_per_block(blob.slot().epoch(E::slots_per_epoch()))
})
// This is the case where we have no blobs for the slot, doesn't matter what value we keep for max here
// TODO(pawan): double check that this is the case
// we could also potentially deal with just vecs in the db since we only add length validated sidecar
// lists to the db
.unwrap_or(6);
let blobs = BlobSidecarList::from_vec(blobs, max_blobs_per_block as usize);
self.block_cache
.lock()
.put_blobs(*block_root, blobs.clone());

View File

@@ -1,7 +1,7 @@
use crate::{DBColumn, Error, StoreItem};
use ssz::{Decode, Encode};
use types::{
BlobSidecarList, EthSpec, ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella,
EthSpec, ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella,
ExecutionPayloadDeneb, ExecutionPayloadElectra,
};
@@ -26,7 +26,6 @@ impl_store_item!(ExecutionPayloadBellatrix);
impl_store_item!(ExecutionPayloadCapella);
impl_store_item!(ExecutionPayloadDeneb);
impl_store_item!(ExecutionPayloadElectra);
impl_store_item!(BlobSidecarList);
/// This fork-agnostic implementation should be only used for writing.
///