From 35f0636101e030c93fc0b9d3fbd73f673e723d3f Mon Sep 17 00:00:00 2001 From: Agnish Ghosh Date: Fri, 11 Oct 2024 03:22:26 +0530 Subject: [PATCH] setlens --- .../data_column_quarantine.nim | 10 +++++----- beacon_chain/spec/eip7594_helpers.nim | 12 ++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/beacon_chain/consensus_object_pools/data_column_quarantine.nim b/beacon_chain/consensus_object_pools/data_column_quarantine.nim index ccea556c4..7cd044861 100644 --- a/beacon_chain/consensus_object_pools/data_column_quarantine.nim +++ b/beacon_chain/consensus_object_pools/data_column_quarantine.nim @@ -130,16 +130,16 @@ func hasDataColumns*(quarantine: DataColumnQuarantine, max(SAMPLES_PER_SLOT.uint64, localSubnetCount)) if quarantine.supernode: - for i in localCustodyColumns: - if (blck.root, ColumnIndex i) in quarantine.data_columns: - inc counter - if counter >= (NUMBER_OF_COLUMNS div 2): + let + collectedColumns = quarantine.gatherDataColumns(blck) + if collectedColumns.len >= (localCustodyColumns.len div 2): return true else: for i in localCustodyColumns: if (blck.root, ColumnIndex i) notin quarantine.data_columns: return false - true + else: + return true func dataColumnFetchRecord*(quarantine: DataColumnQuarantine, blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): DataColumnFetchRecord = diff --git a/beacon_chain/spec/eip7594_helpers.nim b/beacon_chain/spec/eip7594_helpers.nim index 5ee5cf348..88e44aa1a 100644 --- a/beacon_chain/spec/eip7594_helpers.nim +++ b/beacon_chain/spec/eip7594_helpers.nim @@ -191,7 +191,8 @@ proc recover_cells_and_proofs*( return err ("DataColumns do not have the same length") var - recovered_cps = newSeqOfCap[CellsAndProofs](blobCount) + recovered_cps = newSeq[CellsAndProofs] + recovered_cps.setLen(blobCount) for blobIdx in 0 ..< blobCount: var @@ -199,11 +200,14 @@ proc recover_cells_and_proofs*( cell_ids = newSeqOfCap[CellID](columnCount) ckzgCells = newSeqOfCap[KzgCell](columnCount) - for i in 0..