mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-03-03 23:51:22 +00:00
added support for customisable custody subnet count on boot, from bn startup flags
This commit is contained in:
parent
f142dcd36f
commit
70029545ea
@ -2598,6 +2598,22 @@ proc updateStabilitySubnetMetadata*(node: Eth2Node, attnets: AttnetBits) =
|
||||
else:
|
||||
debug "Stability subnets changed; updated ENR attnets", attnets
|
||||
|
||||
proc loadCscnetsMetadata*(node: Eth2Node, cscnets: uint64) =
|
||||
if node.metadata.custody_subnet_count == cscnets:
|
||||
return
|
||||
|
||||
node.metadata.custody_subnet_count = cscnets
|
||||
|
||||
let res = node.discovery.updateRecord({
|
||||
enrCustodySubnetCountField: SSZ.encode(node.metadata.custody_subnet_count)})
|
||||
|
||||
if res.isErr:
|
||||
# This should not occur in this scenario as the private key would always
|
||||
# be the correct one and the ENR will not increase in size.
|
||||
warn "Failed to update the ENR syncnets field", error = res.error
|
||||
else:
|
||||
debug "Sync committees changed; updated ENR syncnets", cscnets
|
||||
|
||||
proc updateSyncnetsMetadata*(node: Eth2Node, syncnets: SyncnetBits) =
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#sync-committee-subnet-stability
|
||||
if node.metadata.syncnets == syncnets:
|
||||
|
@ -1153,6 +1153,15 @@ proc addDenebMessageHandlers(
|
||||
for topic in dataColumnSidecarTopics(forkDigest, targetSubnets):
|
||||
node.network.subscribe(topic, basicParams)
|
||||
|
||||
if node.config.subscribeAllSubnets:
|
||||
node.network.loadCscnetsMetadata(DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint64)
|
||||
elif not node.config.subscribeAllSubnets:
|
||||
let csc = node.config.custodySubnetCount
|
||||
if csc.isSome and csc.get < DATA_COLUMN_SIDECAR_SUBNET_COUNT:
|
||||
node.network.loadCscnetsMetadata(csc.get.uint64)
|
||||
else:
|
||||
node.network.loadCscnetsMetadata(CUSTODY_REQUIREMENT.uint64)
|
||||
|
||||
proc addElectraMessageHandlers(
|
||||
node: BeaconNode, forkDigest: ForkDigest, slot: Slot) =
|
||||
node.addDenebMessageHandlers(forkDigest, slot)
|
||||
@ -1544,7 +1553,9 @@ proc reconstructAndSendDataColumns*(node: BeaconNode) {.async.} =
|
||||
return
|
||||
notice "Data Column Reconstructed and Saved Successfully"
|
||||
let dc = data_column_sidecars.get
|
||||
var das_workers = newSeq[Future[SendResult]](len(dc))
|
||||
var
|
||||
worker_count = len(dc)
|
||||
das_workers = newSeq[Future[SendResult]](worker_count)
|
||||
for i in 0..<dc.lenu64:
|
||||
let subnet_id = compute_subnet_for_data_column_sidecar(i)
|
||||
das_workers[i] =
|
||||
|
Loading…
x
Reference in New Issue
Block a user