add missing fields to get blob sidecars request (#5987)

* add missing fields to get blob sidecars request

* add fork versioned  response impl

* only compute the block root once

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into add-missing-fields-get-blob-sidecars

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into add-missing-fields-get-blob-sidecars

* fetch root first

fetch from cache if its a head block

* fmt

* always load from db
This commit is contained in:
Eitan Seri-Levi
2024-08-19 01:28:45 -07:00
committed by GitHub
parent b6d15bc299
commit 042915859d
4 changed files with 89 additions and 51 deletions

View File

@@ -1,9 +1,10 @@
use crate::test_utils::TestRandom;
use crate::ForkName;
use crate::{
beacon_block_body::BLOB_KZG_COMMITMENTS_INDEX, BeaconBlockHeader, BeaconStateError, Blob,
Epoch, EthSpec, FixedVector, Hash256, SignedBeaconBlockHeader, Slot, VariableList,
};
use crate::{KzgProofs, SignedBeaconBlock};
use crate::{ForkVersionDeserialize, KzgProofs, SignedBeaconBlock};
use bls::Signature;
use derivative::Derivative;
use kzg::{Blob as KzgBlob, Kzg, KzgCommitment, KzgProof, BYTES_PER_BLOB, BYTES_PER_FIELD_ELEMENT};
@@ -273,3 +274,12 @@ pub type BlobSidecarList<E> = VariableList<Arc<BlobSidecar<E>>, <E as EthSpec>::
pub type FixedBlobSidecarList<E> =
FixedVector<Option<Arc<BlobSidecar<E>>>, <E as EthSpec>::MaxBlobsPerBlock>;
pub type BlobsList<E> = VariableList<Blob<E>, <E as EthSpec>::MaxBlobCommitmentsPerBlock>;
impl<E: EthSpec> ForkVersionDeserialize for BlobSidecarList<E> {
fn deserialize_by_fork<'de, D: serde::Deserializer<'de>>(
value: serde_json::value::Value,
_: ForkName,
) -> Result<Self, D::Error> {
serde_json::from_value::<BlobSidecarList<E>>(value).map_err(serde::de::Error::custom)
}
}