fix enr advertising
This commit is contained in:
parent
d08044f584
commit
2ff165d304
|
@ -1562,8 +1562,7 @@ proc runDiscoveryLoop(node: Eth2Node) {.async.} =
|
||||||
(wantedAttnets, wantedSyncnets, wantedCscnets) = node.getLowSubnets(currentEpoch)
|
(wantedAttnets, wantedSyncnets, wantedCscnets) = node.getLowSubnets(currentEpoch)
|
||||||
wantedAttnetsCount = wantedAttnets.countOnes()
|
wantedAttnetsCount = wantedAttnets.countOnes()
|
||||||
wantedSyncnetsCount = wantedSyncnets.countOnes()
|
wantedSyncnetsCount = wantedSyncnets.countOnes()
|
||||||
wantedCscnetsCount = wantedCscnets.countOnes().uint64()
|
wantedCscnetsCount = wantedCscnets.countOnes().uint8()
|
||||||
wantedCscnetsBEBytes = wantedCscnetsCount.toBytesBE()
|
|
||||||
outgoingPeers = node.peerPool.lenCurrent({PeerType.Outgoing})
|
outgoingPeers = node.peerPool.lenCurrent({PeerType.Outgoing})
|
||||||
targetOutgoingPeers = max(node.wantedPeers div 10, 3)
|
targetOutgoingPeers = max(node.wantedPeers div 10, 3)
|
||||||
|
|
||||||
|
@ -2635,10 +2634,10 @@ proc updateStabilitySubnetMetadata*(node: Eth2Node, attnets: AttnetBits) =
|
||||||
debug "Stability subnets changed; updated ENR attnets", attnets
|
debug "Stability subnets changed; updated ENR attnets", attnets
|
||||||
|
|
||||||
proc loadCscnetsMetadata*(node: Eth2Node, cscnets: CscCount) =
|
proc loadCscnetsMetadata*(node: Eth2Node, cscnets: CscCount) =
|
||||||
if node.metadata.custody_subnet_count == cscnets:
|
if node.metadata.custody_subnet_count == cscnets.uint64:
|
||||||
return
|
return
|
||||||
|
|
||||||
node.metadata.custody_subnet_count = cscnets
|
node.metadata.custody_subnet_count = cscnets.uint64
|
||||||
|
|
||||||
let res = node.discovery.updateRecord({
|
let res = node.discovery.updateRecord({
|
||||||
enrCustodySubnetCountField: SSZ.encode(node.metadata.custody_subnet_count)})
|
enrCustodySubnetCountField: SSZ.encode(node.metadata.custody_subnet_count)})
|
||||||
|
|
|
@ -1152,8 +1152,8 @@ proc addDenebMessageHandlers(
|
||||||
let
|
let
|
||||||
targetSubnets = node.fetchCustodySubnetCount()
|
targetSubnets = node.fetchCustodySubnetCount()
|
||||||
custody_subnets =
|
custody_subnets =
|
||||||
node.network.nodeId.get_custody_column_subnets(max(SAMPLES_PER_SLOT.uint64,
|
node.network.nodeId.get_custody_column_subnets(max(SAMPLES_PER_SLOT.uint8,
|
||||||
targetSubnets))
|
targetSubnets.uint8))
|
||||||
|
|
||||||
debugEcho "Target Subnets"
|
debugEcho "Target Subnets"
|
||||||
debugEcho targetSubnets
|
debugEcho targetSubnets
|
||||||
|
@ -1169,13 +1169,13 @@ proc addDenebMessageHandlers(
|
||||||
node.network.subscribe(topic, basicParams)
|
node.network.subscribe(topic, basicParams)
|
||||||
|
|
||||||
if node.config.subscribeAllSubnets:
|
if node.config.subscribeAllSubnets:
|
||||||
node.network.loadCscnetsMetadata(DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint64)
|
node.network.loadCscnetsMetadata(DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint8)
|
||||||
elif not node.config.subscribeAllSubnets:
|
elif not node.config.subscribeAllSubnets:
|
||||||
let csc = node.config.custodySubnetCount
|
let csc = node.config.custodySubnetCount
|
||||||
if csc.isSome and csc.get < DATA_COLUMN_SIDECAR_SUBNET_COUNT:
|
if csc.isSome and csc.get < DATA_COLUMN_SIDECAR_SUBNET_COUNT:
|
||||||
node.network.loadCscnetsMetadata(csc.get.uint64)
|
node.network.loadCscnetsMetadata(csc.get.uint8)
|
||||||
else:
|
else:
|
||||||
node.network.loadCscnetsMetadata(CUSTODY_REQUIREMENT.uint64)
|
node.network.loadCscnetsMetadata(CUSTODY_REQUIREMENT.uint8)
|
||||||
|
|
||||||
proc addElectraMessageHandlers(
|
proc addElectraMessageHandlers(
|
||||||
node: BeaconNode, forkDigest: ForkDigest, slot: Slot) =
|
node: BeaconNode, forkDigest: ForkDigest, slot: Slot) =
|
||||||
|
|
|
@ -77,14 +77,14 @@ type
|
||||||
row_index*: RowIndex
|
row_index*: RowIndex
|
||||||
|
|
||||||
CscBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT]
|
CscBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT]
|
||||||
CscCount* = uint64
|
CscCount* = uint8
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.4/specs/_features/eip7594/p2p-interface.md#metadata
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.4/specs/_features/eip7594/p2p-interface.md#metadata
|
||||||
MetaData* = object
|
MetaData* = object
|
||||||
seq_number*: uint64
|
seq_number*: uint64
|
||||||
attnets*: AttnetBits
|
attnets*: AttnetBits
|
||||||
syncnets*: SyncnetBits
|
syncnets*: SyncnetBits
|
||||||
custody_subnet_count*: CscCount
|
custody_subnet_count*: uint64
|
||||||
|
|
||||||
# func serializeDataColumn(data_column: DataColumn): auto =
|
# func serializeDataColumn(data_column: DataColumn): auto =
|
||||||
# var counter = 0
|
# var counter = 0
|
||||||
|
|
|
@ -315,7 +315,6 @@ proc fetchDataColumnsFromNetwork(rman: RequestManager,
|
||||||
colIdList: seq[DataColumnIdentifier])
|
colIdList: seq[DataColumnIdentifier])
|
||||||
{.async: (raises: [CancelledError]).} =
|
{.async: (raises: [CancelledError]).} =
|
||||||
var peer: Peer
|
var peer: Peer
|
||||||
var peers: seq[Peer]
|
|
||||||
try:
|
try:
|
||||||
peer = await rman.network.peerPool.acquire()
|
peer = await rman.network.peerPool.acquire()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue