have getLowSubnets accept only BitArrays
This commit is contained in:
parent
c42d54144a
commit
547abaacf7
|
@ -1484,7 +1484,7 @@ proc trimConnections(node: Eth2Node, count: int) =
|
||||||
if toKick <= 0: return
|
if toKick <= 0: return
|
||||||
|
|
||||||
proc getLowSubnets(node: Eth2Node, epoch: Epoch):
|
proc getLowSubnets(node: Eth2Node, epoch: Epoch):
|
||||||
(AttnetBits, SyncnetBits, CscCount) =
|
(AttnetBits, SyncnetBits, CscBits) =
|
||||||
# Returns the subnets required to have a healthy mesh
|
# Returns the subnets required to have a healthy mesh
|
||||||
# The subnets are computed, to, in order:
|
# The subnets are computed, to, in order:
|
||||||
# - Have 0 subnet with < `dLow` peers from topic subscription
|
# - Have 0 subnet with < `dLow` peers from topic subscription
|
||||||
|
@ -1550,7 +1550,7 @@ proc getLowSubnets(node: Eth2Node, epoch: Epoch):
|
||||||
findLowSubnets(getSyncCommitteeTopic, SyncSubcommitteeIndex, SYNC_COMMITTEE_SUBNET_COUNT)
|
findLowSubnets(getSyncCommitteeTopic, SyncSubcommitteeIndex, SYNC_COMMITTEE_SUBNET_COUNT)
|
||||||
else:
|
else:
|
||||||
default(SyncnetBits),
|
default(SyncnetBits),
|
||||||
findLowSubnets(getDataColumnSidecarTopic, uint64, DATA_COLUMN_SIDECAR_SUBNET_COUNT.int).countOnes.uint8
|
findLowSubnets(getDataColumnSidecarTopic, uint64, DATA_COLUMN_SIDECAR_SUBNET_COUNT.int)
|
||||||
)
|
)
|
||||||
|
|
||||||
proc runDiscoveryLoop(node: Eth2Node) {.async.} =
|
proc runDiscoveryLoop(node: Eth2Node) {.async.} =
|
||||||
|
@ -1562,7 +1562,8 @@ 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
|
wantedCscnetsCount = wantedCscnets.countOnes()
|
||||||
|
wantedCscnetsUint = wantedCscnetsCount.uint8
|
||||||
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)
|
||||||
|
|
||||||
|
@ -1580,7 +1581,7 @@ proc runDiscoveryLoop(node: Eth2Node) {.async.} =
|
||||||
node.discoveryForkId,
|
node.discoveryForkId,
|
||||||
wantedAttnets,
|
wantedAttnets,
|
||||||
wantedSyncnets,
|
wantedSyncnets,
|
||||||
wantedCscnets,
|
wantedCscnetsUint,
|
||||||
minScore)
|
minScore)
|
||||||
|
|
||||||
let newPeers = block:
|
let newPeers = block:
|
||||||
|
|
|
@ -77,6 +77,7 @@ type
|
||||||
column_index*: ColumnIndex
|
column_index*: ColumnIndex
|
||||||
row_index*: RowIndex
|
row_index*: RowIndex
|
||||||
|
|
||||||
|
CscBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT]
|
||||||
CscCount* = uint8
|
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
|
||||||
|
|
Loading…
Reference in New Issue