missing data column logic

This commit is contained in:
Agnish Ghosh 2024-10-13 16:21:59 +05:30
parent 4462f08ccf
commit 1f3e2a94db
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8
2 changed files with 23 additions and 6 deletions

View File

@ -90,7 +90,17 @@ func gatherDataColumns*(quarantine: DataColumnQuarantine,
electra.SignedBeaconBlock): electra.SignedBeaconBlock):
seq[ref DataColumnSidecar] = seq[ref DataColumnSidecar] =
var columns: seq[ref DataColumnSidecar] var columns: seq[ref DataColumnSidecar]
for i in 0..<NUMBER_OF_COLUMNS: 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:
let idx = ColumnIndex(i) let idx = ColumnIndex(i)
if quarantine.data_columns.hasKey( if quarantine.data_columns.hasKey(
(blck.root, idx)): (blck.root, idx)):
@ -129,6 +139,7 @@ func checkForInitialDcSidecars*(quarantine: DataColumnQuarantine,
func hasMissingDataColumns*(quarantine: DataColumnQuarantine, func hasMissingDataColumns*(quarantine: DataColumnQuarantine,
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool = blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool =
var counter = 0
let let
localSubnetCount = localSubnetCount =
if quarantine.supernode: if quarantine.supernode:
@ -142,8 +153,14 @@ func hasMissingDataColumns*(quarantine: DataColumnQuarantine,
for i in localCustodyColumns: for i in localCustodyColumns:
if (blck.root, ColumnIndex i) notin quarantine.data_columns and if (blck.root, ColumnIndex i) notin quarantine.data_columns and
len(blck.message.body.blob_kzg_commitments) != 0: len(blck.message.body.blob_kzg_commitments) != 0:
return false inc counter
true if quarantine.supernode and counter == NUMBER_OF_COLUMNS:
return true
elif quarantine.supernode == false and
counter == max(SAMPLES_PER_SLOT, CUSTODY_REQUIREMENT):
return true
else:
return false
func hasEnoughDataColumns*(quarantine: DataColumnQuarantine, func hasEnoughDataColumns*(quarantine: DataColumnQuarantine,
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool = blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool =

View File

@ -398,9 +398,9 @@ proc processDataColumnSidecar*(
let columnless = o.unsafeGet() let columnless = o.unsafeGet()
withBlck(columnless): withBlck(columnless):
when consensusFork >= ConsensusFork.Deneb: when consensusFork >= ConsensusFork.Deneb:
if self.dataColumnQuarantine[].hasMissingDataColumns(forkyBlck) and if self.dataColumnQuarantine[].gatherDataColumns(forkyBlck).len ==
self.dataColumnQuarantine[].gatherDataColumns(forkyBlck).len == max(SAMPLES_PER_SLOT, CUSTODY_REQUIREMENT) and
max(SAMPLES_PER_SLOT, CUSTODY_REQUIREMENT): self.dataColumnQuarantine[].hasMissingDataColumns(forkyBlck):
self.blockProcessor[].enqueueBlock( self.blockProcessor[].enqueueBlock(
MsgSource.gossip, columnless, MsgSource.gossip, columnless,
Opt.none(BlobSidecars), Opt.none(BlobSidecars),