have 2 distinct functions for having enough and missing data columns
This commit is contained in:
parent
6f2b6c3056
commit
826a4f60f8
|
@ -116,9 +116,27 @@ func checkForInitialDcSidecars*(quarantine: DataColumnQuarantine,
|
||||||
return false
|
return false
|
||||||
true
|
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 =
|
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool =
|
||||||
var counter = 0
|
|
||||||
let
|
let
|
||||||
localSubnetCount =
|
localSubnetCount =
|
||||||
if quarantine.supernode:
|
if quarantine.supernode:
|
||||||
|
|
|
@ -31,7 +31,7 @@ from ../consensus_object_pools/block_quarantine import
|
||||||
from ../consensus_object_pools/blob_quarantine import
|
from ../consensus_object_pools/blob_quarantine import
|
||||||
BlobQuarantine, hasBlobs, popBlobs, put
|
BlobQuarantine, hasBlobs, popBlobs, put
|
||||||
from ../consensus_object_pools/data_column_quarantine import
|
from ../consensus_object_pools/data_column_quarantine import
|
||||||
DataColumnQuarantine, hasDataColumns, popDataColumns, put
|
DataColumnQuarantine, hasEnoughDataColumns, popDataColumns, put
|
||||||
from ../validators/validator_monitor import
|
from ../validators/validator_monitor import
|
||||||
MsgSource, ValidatorMonitor, registerAttestationInBlock, registerBeaconBlock,
|
MsgSource, ValidatorMonitor, registerAttestationInBlock, registerBeaconBlock,
|
||||||
registerSyncAggregateInBlock
|
registerSyncAggregateInBlock
|
||||||
|
@ -868,7 +868,7 @@ proc storeBlock(
|
||||||
# discard self.consensusManager.quarantine[].addBlobless(
|
# discard self.consensusManager.quarantine[].addBlobless(
|
||||||
# dag.finalizedHead.slot, forkyBlck)
|
# dag.finalizedHead.slot, forkyBlck)
|
||||||
|
|
||||||
if self.dataColumnQuarantine[].hasDataColumns(forkyBlck):
|
if self.dataColumnQuarantine[].hasEnoughDataColumns(forkyBlck):
|
||||||
let data_columns = self.dataColumnQuarantine[].popDataColumns(
|
let data_columns = self.dataColumnQuarantine[].popDataColumns(
|
||||||
forkyBlck.root, forkyBlck)
|
forkyBlck.root, forkyBlck)
|
||||||
self[].enqueueBlock(MsgSource.gossip, quarantined, Opt.none(BlobSidecars), Opt.some(data_columns))
|
self[].enqueueBlock(MsgSource.gossip, quarantined, Opt.none(BlobSidecars), Opt.some(data_columns))
|
||||||
|
|
|
@ -274,7 +274,7 @@ proc processSignedBeaconBlock*(
|
||||||
|
|
||||||
let data_columns =
|
let data_columns =
|
||||||
when typeof(signedBlock).kind >= ConsensusFork.Deneb:
|
when typeof(signedBlock).kind >= ConsensusFork.Deneb:
|
||||||
if self.dataColumnQuarantine[].hasDataColumns(signedBlock):
|
if self.dataColumnQuarantine[].hasEnoughDataColumns(signedBlock):
|
||||||
Opt.some(self.dataColumnQuarantine[].popDataColumns(signedBlock.root, signedBlock))
|
Opt.some(self.dataColumnQuarantine[].popDataColumns(signedBlock.root, signedBlock))
|
||||||
else:
|
else:
|
||||||
discard self.quarantine[].addColumnless(self.dag.finalizedHead.slot,
|
discard self.quarantine[].addColumnless(self.dag.finalizedHead.slot,
|
||||||
|
@ -406,7 +406,7 @@ proc processDataColumnSidecar*(
|
||||||
self.processReconstructionFromGossip(forkyBlck, columns)
|
self.processReconstructionFromGossip(forkyBlck, columns)
|
||||||
for rc in reconstructed_columns.get:
|
for rc in reconstructed_columns.get:
|
||||||
self.dataColumnQuarantine[].put(newClone(rc))
|
self.dataColumnQuarantine[].put(newClone(rc))
|
||||||
if self.dataColumnQuarantine[].hasDataColumns(forkyBlck):
|
if self.dataColumnQuarantine[].hasEnoughDataColumns(forkyBlck):
|
||||||
self.blockProcessor[].enqueueBlock(
|
self.blockProcessor[].enqueueBlock(
|
||||||
MsgSource.gossip, columnless,
|
MsgSource.gossip, columnless,
|
||||||
Opt.none(BlobSidecars),
|
Opt.none(BlobSidecars),
|
||||||
|
|
|
@ -1551,7 +1551,7 @@ proc tryReconstructingDataColumns* (self: BeaconNode,
|
||||||
# storedColumn number is less than the NUMBER_OF_COLUMNS
|
# storedColumn number is less than the NUMBER_OF_COLUMNS
|
||||||
# then reconstruction is not possible, and if all the data columns
|
# then reconstruction is not possible, and if all the data columns
|
||||||
# are already stored then we do not need to reconstruct at all
|
# 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
|
# Recover blobs from saved data column sidecars
|
||||||
let recovered_cps = recover_cells_and_proofs(data_column_sidecars, signed_block)
|
let recovered_cps = recover_cells_and_proofs(data_column_sidecars, signed_block)
|
||||||
if not recovered_cps.isOk:
|
if not recovered_cps.isOk:
|
||||||
|
|
|
@ -541,7 +541,7 @@ proc getMissingDataColumns(rman: RequestManager): seq[DataColumnIdentifier] =
|
||||||
debug "Not handling missing data columns early in slot"
|
debug "Not handling missing data columns early in slot"
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not rman.dataColumnQuarantine[].hasDataColumns(forkyBlck):
|
if not rman.dataColumnQuarantine[].hasMissingDataColumns(forkyBlck):
|
||||||
let missing = rman.dataColumnQuarantine[].dataColumnFetchRecord(forkyBlck)
|
let missing = rman.dataColumnQuarantine[].dataColumnFetchRecord(forkyBlck)
|
||||||
if len(missing.indices) == 0:
|
if len(missing.indices) == 0:
|
||||||
warn "quarantine is missing data columns, but missing indices are empty",
|
warn "quarantine is missing data columns, but missing indices are empty",
|
||||||
|
|
Loading…
Reference in New Issue