Skip to content

Commit befef72

Browse files
committed
add Fuly BlobsByRoot
1 parent b9149f6 commit befef72

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

beacon_node/network/src/network_beacon_processor/rpc_methods.rs

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,22 +279,42 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
279279
.collect::<Vec<_>>();
280280
let mut send_blob_count = 0;
281281

282+
let fulu_start_slot = self
283+
.chain
284+
.spec
285+
.fulu_fork_epoch
286+
.map(|epoch| epoch.start_slot(T::EthSpec::slots_per_epoch()));
287+
282288
let mut blob_list_results = HashMap::new();
283289
for id in request.blob_ids.as_slice() {
290+
let BlobIdentifier {
291+
block_root: root,
292+
index,
293+
} = id;
294+
284295
// First attempt to get the blobs from the RPC cache.
285296
if let Ok(Some(blob)) = self.chain.data_availability_checker.get_blob(id) {
297+
// Check if the blob requested is from a Fulu slot, if so, skip the current blob id and proceed to the next
298+
if let Some(fulu_slot) = fulu_start_slot {
299+
if blob.slot() >= fulu_slot {
300+
debug!(
301+
%peer_id,
302+
request_root = %root,
303+
blob_slot = %blob.slot(),
304+
%fulu_slot,
305+
"BlobsByRoot request is at or after Fulu slot, returning empty response"
306+
);
307+
continue;
308+
}
309+
}
310+
286311
self.send_response(
287312
peer_id,
288313
inbound_request_id,
289314
Response::BlobsByRoot(Some(blob)),
290315
);
291316
send_blob_count += 1;
292317
} else {
293-
let BlobIdentifier {
294-
block_root: root,
295-
index,
296-
} = id;
297-
298318
let blob_list_result = match blob_list_results.entry(root) {
299319
Entry::Vacant(entry) => {
300320
entry.insert(self.chain.get_blobs_checking_early_attester_cache(root))
@@ -306,6 +326,20 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
306326
Ok(blobs_sidecar_list) => {
307327
'inner: for blob_sidecar in blobs_sidecar_list.iter() {
308328
if blob_sidecar.index == *index {
329+
// Same logic as above to check for Fulu slot
330+
if let Some(fulu_slot) = fulu_start_slot {
331+
if blob_sidecar.slot() >= fulu_slot {
332+
debug!(
333+
%peer_id,
334+
request_root = %root,
335+
blob_slot = %blob_sidecar.slot(),
336+
%fulu_slot,
337+
"BlobsByRoot request is at or after Fulu slot, returning empty response"
338+
);
339+
break 'inner;
340+
}
341+
}
342+
309343
self.send_response(
310344
peer_id,
311345
inbound_request_id,

0 commit comments

Comments
 (0)