have 2 distinct functions for having enough and missing data columns

This commit is contained in:
Agnish Ghosh 2024-10-11 21:42:28 +05:30
parent 6f2b6c3056
commit 826a4f60f8
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8
5 changed files with 26 additions and 8 deletions

View File

@ -116,9 +116,27 @@ func checkForInitialDcSidecars*(quarantine: DataColumnQuarantine,
return false
true
func hasDataColumns*(quarantine: DataColumnQuarantine,
func hasMissingDataColumns*(quarantine: DataColumnQuarantine,
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool =
let
localSubnetCount =
if quarantine.supernode:
DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint64
else:
CUSTODY_REQUIREMENT.uint64
localCustodyColumns =
get_custody_columns(quarantine.nodeid,
max(SAMPLES_PER_SLOT.uint64,
localSubnetCount))
for i in localCustodyColumns:
if (blck.root, ColumnIndex i) notin quarantine.data_columns:
return false
true
func hasEnoughDataColumns*(quarantine: DataColumnQuarantine,
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool =
var counter = 0
let
localSubnetCount =
if quarantine.supernode:

View File

@ -31,7 +31,7 @@ from ../consensus_object_pools/block_quarantine import
from ../consensus_object_pools/blob_quarantine import
BlobQuarantine, hasBlobs, popBlobs, put
from ../consensus_object_pools/data_column_quarantine import
DataColumnQuarantine, hasDataColumns, popDataColumns, put
DataColumnQuarantine, hasEnoughDataColumns, popDataColumns, put
from ../validators/validator_monitor import
MsgSource, ValidatorMonitor, registerAttestationInBlock, registerBeaconBlock,
registerSyncAggregateInBlock
@ -868,7 +868,7 @@ proc storeBlock(
# discard self.consensusManager.quarantine[].addBlobless(
# dag.finalizedHead.slot, forkyBlck)
if self.dataColumnQuarantine[].hasDataColumns(forkyBlck):
if self.dataColumnQuarantine[].hasEnoughDataColumns(forkyBlck):
let data_columns = self.dataColumnQuarantine[].popDataColumns(
forkyBlck.root, forkyBlck)
self[].enqueueBlock(MsgSource.gossip, quarantined, Opt.none(BlobSidecars), Opt.some(data_columns))

View File

@ -274,7 +274,7 @@ proc processSignedBeaconBlock*(
let data_columns =
when typeof(signedBlock).kind >= ConsensusFork.Deneb:
if self.dataColumnQuarantine[].hasDataColumns(signedBlock):
if self.dataColumnQuarantine[].hasEnoughDataColumns(signedBlock):
Opt.some(self.dataColumnQuarantine[].popDataColumns(signedBlock.root, signedBlock))
else:
discard self.quarantine[].addColumnless(self.dag.finalizedHead.slot,
@ -406,7 +406,7 @@ proc processDataColumnSidecar*(
self.processReconstructionFromGossip(forkyBlck, columns)
for rc in reconstructed_columns.get:
self.dataColumnQuarantine[].put(newClone(rc))
if self.dataColumnQuarantine[].hasDataColumns(forkyBlck):
if self.dataColumnQuarantine[].hasEnoughDataColumns(forkyBlck):
self.blockProcessor[].enqueueBlock(
MsgSource.gossip, columnless,
Opt.none(BlobSidecars),

View File

@ -1551,7 +1551,7 @@ proc tryReconstructingDataColumns* (self: BeaconNode,
# storedColumn number is less than the NUMBER_OF_COLUMNS
# then reconstruction is not possible, and if all the data columns
# are already stored then we do not need to reconstruct at all
if not storedColumns.len < NUMBER_OF_COLUMNS div 2:
if not storedColumns.len < NUMBER_OF_COLUMNS div 2 and storedColumns.len != NUMBER_OF_COLUMNS:
# Recover blobs from saved data column sidecars
let recovered_cps = recover_cells_and_proofs(data_column_sidecars, signed_block)
if not recovered_cps.isOk:

View File

@ -541,7 +541,7 @@ proc getMissingDataColumns(rman: RequestManager): seq[DataColumnIdentifier] =
debug "Not handling missing data columns early in slot"
continue
if not rman.dataColumnQuarantine[].hasDataColumns(forkyBlck):
if not rman.dataColumnQuarantine[].hasMissingDataColumns(forkyBlck):
let missing = rman.dataColumnQuarantine[].dataColumnFetchRecord(forkyBlck)
if len(missing.indices) == 0:
warn "quarantine is missing data columns, but missing indices are empty",