other fixes

This commit is contained in:
Agnish Ghosh 2024-10-14 01:20:51 +05:30
parent 3f14f6b4ba
commit 1c1ff21bf9
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8
2 changed files with 8 additions and 9 deletions

View File

@ -86,8 +86,7 @@ func accumulateDataColumns*(quarantine: DataColumnQuarantine,
indices indices
func gatherDataColumns*(quarantine: DataColumnQuarantine, func gatherDataColumns*(quarantine: DataColumnQuarantine,
blck: deneb.SignedBeaconBlock | digest: Eth2Digest):
electra.SignedBeaconBlock):
seq[ref DataColumnSidecar] = seq[ref DataColumnSidecar] =
var columns: seq[ref DataColumnSidecar] var columns: seq[ref DataColumnSidecar]
let let
@ -103,8 +102,8 @@ func gatherDataColumns*(quarantine: DataColumnQuarantine,
for i in localCustodyColumns: 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)): (digest, idx)):
let value = quarantine.data_columns.getOrDefault((blck.root, idx), default(ref DataColumnSidecar)) let value = quarantine.data_columns.getOrDefault((digest, idx), default(ref DataColumnSidecar))
columns.add(value) columns.add(value)
columns columns
@ -176,7 +175,7 @@ func hasEnoughDataColumns*(quarantine: DataColumnQuarantine,
localSubnetCount)) localSubnetCount))
if quarantine.supernode: if quarantine.supernode:
let let
collectedColumns = quarantine.gatherDataColumns(blck) collectedColumns = quarantine.gatherDataColumns(blck.root)
if collectedColumns.len >= (localCustodyColumns.len div 2): if collectedColumns.len >= (localCustodyColumns.len div 2):
return true return true
else: else:

View File

@ -398,12 +398,12 @@ 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[].gatherDataColumns(forkyBlck).len == if self.dataColumnQuarantine[].gatherDataColumns(block_root).len ==
max(SAMPLES_PER_SLOT, CUSTODY_REQUIREMENT) and max(SAMPLES_PER_SLOT, CUSTODY_REQUIREMENT) and
self.dataColumnQuarantine[].hasMissingDataColumns(forkyBlck): self.dataColumnQuarantine[].hasMissingDataColumns(forkyBlck):
if self.dataColumnQuarantine[].supernode == false: if self.dataColumnQuarantine[].supernode == false:
let columns = let columns =
self.dataColumnQuarantine[].gatherDataColumns(forkyBlck).mapIt(it[]) self.dataColumnQuarantine[].gatherDataColumns(block_root).mapIt(it[])
for gdc in columns: for gdc in columns:
self.dataColumnQuarantine[].put(newClone(gdc)) self.dataColumnQuarantine[].put(newClone(gdc))
self.blockProcessor[].enqueueBlock( self.blockProcessor[].enqueueBlock(
@ -412,14 +412,14 @@ proc processDataColumnSidecar*(
Opt.some(self.dataColumnQuarantine[].popDataColumns(block_root, forkyBlck))) Opt.some(self.dataColumnQuarantine[].popDataColumns(block_root, forkyBlck)))
elif self.dataColumnQuarantine[].hasEnoughDataColumns(forkyBlck): elif self.dataColumnQuarantine[].hasEnoughDataColumns(forkyBlck):
let let
columns = self.dataColumnQuarantine[].gatherDataColumns(forkyBlck) columns = self.dataColumnQuarantine[].gatherDataColumns(block_root)
if columns.len >= (NUMBER_OF_COLUMNS div 2) and if columns.len >= (NUMBER_OF_COLUMNS div 2) and
self.dataColumnQuarantine[].supernode: self.dataColumnQuarantine[].supernode:
let let
reconstructed_columns = reconstructed_columns =
self.processReconstructionFromGossip(forkyBlck, columns.mapIt(it[])) self.processReconstructionFromGossip(forkyBlck, columns.mapIt(it[]))
for rc in reconstructed_columns.get: for rc in reconstructed_columns.get:
if rc notin self.dataColumnQuarantine[].gatherDataColumns(forkyBlck).mapIt(it[]): if rc notin self.dataColumnQuarantine[].gatherDataColumns(block_root).mapIt(it[]):
self.dataColumnQuarantine[].put(newClone(rc)) self.dataColumnQuarantine[].put(newClone(rc))
self.blockProcessor[].enqueueBlock( self.blockProcessor[].enqueueBlock(
MsgSource.gossip, columnless, MsgSource.gossip, columnless,