Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get blobs from the EL's blob pool #5829

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
Use correct blob indices
michaelsproul committed May 30, 2024
commit 01c99db392f3ae2bf9260af5b3fa18a87db6fab1
24 changes: 19 additions & 5 deletions beacon_node/beacon_chain/src/block_verification.rs
Original file line number Diff line number Diff line change
@@ -1342,6 +1342,15 @@ impl<T: BeaconChainTypes> ExecutionPendingBlock<T> {
"Blobs from EL - start request";
"num_blob_tx" => num_blob_tx,
);
let mut blob_index = 0;
let blob_start_indices = blob_ids
.iter()
.map(|blob_id| {
let i = blob_index;
blob_index += blob_id.versioned_hashes.len();
i
})
.collect::<Vec<_>>();
let response = execution_layer.get_blobs(blob_ids).await.map_err(|e| {
BlockError::ExecutionPayloadError(ExecutionPayloadError::RequestFailed(e))
})?;
@@ -1364,12 +1373,17 @@ impl<T: BeaconChainTypes> ExecutionPendingBlock<T> {
);
}
let mut fixed_blob_sidecar_list = FixedBlobSidecarList::default();
for (i, (blob, kzg_proof)) in response
.blobs
for (i, (blob, kzg_proof)) in blob_start_indices
.into_iter()
.flatten()
.flat_map(|blob| blob.blobs.into_iter().zip(blob.proofs))
.enumerate()
.zip(response.blobs)
.filter_map(|(start_index, blobs)| blobs.map(|blobs| (start_index, blobs)))
.flat_map(|(start_index, blob)| {
blob.blobs
.into_iter()
.zip(blob.proofs)
.enumerate()
.map(move |(i, v)| (start_index + i, v))
})
{
match BlobSidecar::new(i, blob, &block, kzg_proof) {
Ok(blob) => {
4 changes: 2 additions & 2 deletions beacon_node/execution_layer/src/versioned_hashes.rs
Original file line number Diff line number Diff line change
@@ -60,8 +60,8 @@ pub fn extract_versioned_hashes_from_transactions<E: EthSpec>(

#[derive(Deserialize, Serialize)]
pub struct BlobTransactionId {
tx_hash: Hash256,
versioned_hashes: Vec<VersionedHash>,
pub tx_hash: Hash256,
pub versioned_hashes: Vec<VersionedHash>,
}

pub fn extract_blob_transaction_ids<E: EthSpec>(