merge cleanuo

This commit is contained in:
realbigsean
2023-03-21 15:49:35 -04:00
parent 2bfb0bfc5e
commit 5e98326878
4 changed files with 76 additions and 60 deletions

View File

@@ -987,19 +987,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
&self,
block_root: &Hash256,
) -> Result<Option<BlobSidecarList<T::EthSpec>>, Error> {
// If there is no data availability boundary, the Eip4844 fork is disabled.
if let Some(finalized_data_availability_boundary) =
self.finalized_data_availability_boundary()
{
self.early_attester_cache
.get_blobs(*block_root)
.map_or_else(
|| self.get_blobs(block_root, finalized_data_availability_boundary),
|blobs| Ok(Some(blobs)),
)
} else {
Ok(None)
}
self.early_attester_cache
.get_blobs(*block_root)
.map_or_else(|| self.get_blobs(block_root), |blobs| Ok(Some(blobs)))
}
/// Returns the block at the given root, if any.
@@ -2667,11 +2657,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
pub async fn process_blob(
self: &Arc<Self>,
blob: BlobSidecar<T::EthSpec>,
blob: Arc<BlobSidecar<T::EthSpec>>,
count_unrealized: CountUnrealized,
) -> Result<AvailabilityProcessingStatus, BlockError<T::EthSpec>> {
self.check_availability_and_maybe_import(
|chain| chain.data_availability_checker.put_blob(Arc::new(blob)),
|chain| chain.data_availability_checker.put_blob(blob),
count_unrealized,
)
.await

View File

@@ -9,7 +9,6 @@ use crate::gossip_blob_cache::AvailabilityCheckError;
use crate::BeaconChainError;
use derivative::Derivative;
use state_processing::per_block_processing::eip4844::eip4844::verify_kzg_commitments_against_transactions;
use types::blob_sidecar::BlobSidecarList;
use types::{
BeaconBlockRef, BeaconStateError, BlobSidecar, BlobSidecarList, Epoch, EthSpec, Hash256,
KzgCommitment, SignedBeaconBlock, SignedBeaconBlockHeader, SignedBlobSidecar, Slot,
@@ -131,11 +130,11 @@ impl From<BeaconStateError> for BlobError {
/// the p2p network.
#[derive(Debug)]
pub struct GossipVerifiedBlob<T: EthSpec> {
blob: BlobSidecar<T>,
blob: Arc<BlobSidecar<T>>,
}
impl<T: EthSpec> GossipVerifiedBlob<T> {
pub fn to_blob(self) -> BlobSidecar<T> {
pub fn to_blob(self) -> Arc<BlobSidecar<T>> {
self.blob
}
}