add 'gossip blob cache' and start to clean up processing and transition types

This commit is contained in:
realbigsean
2023-03-06 12:04:31 -05:00
committed by Pawan Dhananjay
parent 956ac7cbe9
commit 736a24e35a
8 changed files with 225 additions and 128 deletions

View File

@@ -3,9 +3,9 @@ use crate::{Blob, EthSpec, Hash256, SignedRoot, Slot};
use derivative::Derivative;
use kzg::{KzgCommitment, KzgProof};
use serde_derive::{Deserialize, Serialize};
use bls::Signature;
use ssz::Encode;
use ssz_derive::{Decode, Encode};
use ssz_types::VariableList;
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
@@ -52,6 +52,10 @@ pub type BlobSidecarList<T> = VariableList<BlobSidecar<T>, <T as EthSpec>::MaxBl
impl<T: EthSpec> SignedRoot for BlobSidecar<T> {}
impl<T: EthSpec> BlobSidecar<T> {
pub fn id(&self) -> BlobIdentifier {
BlobIdentifier::new(self.block_root, self.index)
}
pub fn empty() -> Self {
Self::default()
}

View File

@@ -25,6 +25,7 @@ pub mod beacon_block_body;
pub mod beacon_block_header;
pub mod beacon_committee;
pub mod beacon_state;
pub mod blob_sidecar;
pub mod bls_to_execution_change;
pub mod builder_bid;
pub mod chain_spec;
@@ -219,6 +220,7 @@ pub type BLSFieldElement = Uint256;
pub type Blob<T> = FixedVector<u8, <T as EthSpec>::BytesPerBlob>;
pub type VersionedHash = Hash256;
pub type Hash64 = ethereum_types::H64;
pub type BlobsSidecar<T> = VariableList<BlobSidecar<T>, <T as EthSpec>::MaxBlobsPerBlock>;
pub use bls::{
AggregatePublicKey, AggregateSignature, Keypair, PublicKey, PublicKeyBytes, SecretKey,
@@ -229,3 +231,4 @@ pub use kzg::{KzgCommitment, KzgProof};
pub use ssz_types::{typenum, typenum::Unsigned, BitList, BitVector, FixedVector, VariableList};
pub use superstruct::superstruct;
use crate::blob_sidecar::BlobSidecar;

View File

@@ -35,14 +35,6 @@ impl From<SignedBeaconBlockHash> for Hash256 {
}
}
#[derive(Debug)]
pub enum BlobReconstructionError {
/// No blobs for the specified block where we would expect blobs.
UnavailableBlobs,
/// Blobs provided for a pre-Eip4844 fork.
InconsistentFork,
}
/// A `BeaconBlock` and a signature from its proposer.
#[superstruct(
variants(Base, Altair, Merge, Capella, Eip4844),