include supernode and nodeid in dc quarantine
This commit is contained in:
parent
3ec7b522c8
commit
6a300f75af
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
std/tables,
|
std/tables,
|
||||||
|
eth/p2p/discoveryv5/[node],
|
||||||
../spec/[helpers, eip7594_helpers]
|
../spec/[helpers, eip7594_helpers]
|
||||||
|
|
||||||
from std/sequtils import mapIt
|
from std/sequtils import mapIt
|
||||||
|
@ -23,6 +24,8 @@ type
|
||||||
DataColumnQuarantine* = object
|
DataColumnQuarantine* = object
|
||||||
data_columns*:
|
data_columns*:
|
||||||
OrderedTable[(Eth2Digest, ColumnIndex), ref DataColumnSidecar]
|
OrderedTable[(Eth2Digest, ColumnIndex), ref DataColumnSidecar]
|
||||||
|
supernode*: bool
|
||||||
|
nodeid*: NodeId
|
||||||
onDataColumnSidecarCallback*: OnDataColumnSidecarCallback
|
onDataColumnSidecarCallback*: OnDataColumnSidecarCallback
|
||||||
|
|
||||||
DataColumnFetchRecord* = object
|
DataColumnFetchRecord* = object
|
||||||
|
@ -115,24 +118,35 @@ func checkForInitialDcSidecars*(quarantine: DataColumnQuarantine,
|
||||||
|
|
||||||
func hasDataColumns*(quarantine: DataColumnQuarantine,
|
func hasDataColumns*(quarantine: DataColumnQuarantine,
|
||||||
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool =
|
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): bool =
|
||||||
var counter = 0
|
let
|
||||||
for i in 0..<NUMBER_OF_COLUMNS:
|
localSubnetCount =
|
||||||
if len(blck.message.body.blob_kzg_commitments) != 0:
|
if quarantine.supernode:
|
||||||
if (blck.root, ColumnIndex i) in quarantine.data_columns:
|
DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint64
|
||||||
inc counter
|
else:
|
||||||
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
|
return false
|
||||||
if counter == DATA_COLUMN_SIDECAR_SUBNET_COUNT or
|
true
|
||||||
(counter == max(SAMPLES_PER_SLOT, CUSTODY_REQUIREMENT) and
|
|
||||||
counter < max(SAMPLES_PER_SLOT, CUSTODY_REQUIREMENT) + 1):
|
|
||||||
return true
|
|
||||||
else:
|
|
||||||
false
|
|
||||||
|
|
||||||
func dataColumnFetchRecord*(quarantine: DataColumnQuarantine,
|
func dataColumnFetchRecord*(quarantine: DataColumnQuarantine,
|
||||||
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): DataColumnFetchRecord =
|
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock): DataColumnFetchRecord =
|
||||||
|
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))
|
||||||
var indices: seq[ColumnIndex]
|
var indices: seq[ColumnIndex]
|
||||||
for i in 0..<NUMBER_OF_COLUMNS:
|
for i in localCustodyColumns:
|
||||||
let idx = ColumnIndex(i)
|
let idx = ColumnIndex(i)
|
||||||
if not quarantine.data_columns.hasKey(
|
if not quarantine.data_columns.hasKey(
|
||||||
(blck.root, idx)):
|
(blck.root, idx)):
|
||||||
|
|
|
@ -385,6 +385,9 @@ proc initFullNode(
|
||||||
onProposerSlashingAdded, onAttesterSlashingAdded))
|
onProposerSlashingAdded, onAttesterSlashingAdded))
|
||||||
blobQuarantine = newClone(BlobQuarantine.init(onBlobSidecarAdded))
|
blobQuarantine = newClone(BlobQuarantine.init(onBlobSidecarAdded))
|
||||||
dataColumnQuarantine = newClone(DataColumnQuarantine.init())
|
dataColumnQuarantine = newClone(DataColumnQuarantine.init())
|
||||||
|
dataColumnQuarantine[].supernode = supernode
|
||||||
|
dataColumnQuarantine[].nodeid = node.network.nodeId
|
||||||
|
let
|
||||||
consensusManager = ConsensusManager.new(
|
consensusManager = ConsensusManager.new(
|
||||||
dag, attestationPool, quarantine, node.elManager,
|
dag, attestationPool, quarantine, node.elManager,
|
||||||
ActionTracker.init(node.network.nodeId, config.subscribeAllSubnets),
|
ActionTracker.init(node.network.nodeId, config.subscribeAllSubnets),
|
||||||
|
|
Loading…
Reference in New Issue