Skip to content

Commit fb3bed3

Browse files
committed
fix: add check of min met
1 parent 2496bb9 commit fb3bed3

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,13 @@ impl<E: EthSpec> PendingComponents<E> {
367367
}
368368

369369
// Log when minimum proofs requirement is met
370-
let proof_ids: Vec<_> = self.verified_execution_proofs
370+
let proof_ids: Vec<_> = self
371+
.verified_execution_proofs
371372
.iter()
372373
.map(|p| p.proof_id.as_u8().to_string())
373374
.collect();
374375

375-
let slot = self.verified_execution_proofs
376-
.first()
377-
.map(|p| p.slot);
376+
let slot = self.verified_execution_proofs.first().map(|p| p.slot);
378377

379378
self.span.in_scope(|| {
380379
if let Some(slot) = slot {
@@ -420,9 +419,15 @@ impl<E: EthSpec> PendingComponents<E> {
420419
if proof_count > 0 {
421420
let slot = self.block.as_ref().map(|b| b.as_block().slot());
422421
if let Some(slot) = slot {
423-
info!("[Ethproofs] Block ready for validation with {} execution proofs slot={}", proof_count, slot);
422+
info!(
423+
"[Ethproofs] Block ready for validation with {} execution proofs slot={}",
424+
proof_count, slot
425+
);
424426
} else {
425-
info!("[Ethproofs] Block ready for validation with {} execution proofs", proof_count);
427+
info!(
428+
"[Ethproofs] Block ready for validation with {} execution proofs",
429+
proof_count
430+
);
426431
}
427432
}
428433
debug!("Block and all data components are available");
@@ -706,6 +711,18 @@ impl<T: BeaconChainTypes> DataAvailabilityCheckerInner<T> {
706711
return Ok(Availability::MissingComponents(block_root));
707712
}
708713

714+
// TODO(ethproofs): Added for demo.
715+
// Check if we already have the minimum required proofs
716+
// If so, don't add more to avoid unnecessary processing
717+
if let Some(min_proofs) = self.spec.zkvm_min_proofs_required() {
718+
if let Some(pending) = self.critical.read().peek(&block_root) {
719+
if pending.execution_proof_subnet_count() >= min_proofs {
720+
// Already have minimum required proofs, skip adding more
721+
return Ok(Availability::MissingComponents(block_root));
722+
}
723+
}
724+
}
725+
709726
// Try to get epoch from existing pending components (if block already arrived)
710727
// Otherwise use Epoch::new(0) as placeholder (will be corrected when block arrives)
711728
// Also the component cannot be marked as available, if the block is missing

0 commit comments

Comments
 (0)