diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index 793d5b792..445b3fe33 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -1484,7 +1484,7 @@ proc trimConnections(node: Eth2Node, count: int) = if toKick <= 0: return proc getLowSubnets(node: Eth2Node, epoch: Epoch): - (AttnetBits, SyncnetBits, CscCount) = + (AttnetBits, SyncnetBits, CscBits) = # Returns the subnets required to have a healthy mesh # The subnets are computed, to, in order: # - 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) else: 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.} = @@ -1562,7 +1562,8 @@ proc runDiscoveryLoop(node: Eth2Node) {.async.} = (wantedAttnets, wantedSyncnets, wantedCscnets) = node.getLowSubnets(currentEpoch) wantedAttnetsCount = wantedAttnets.countOnes() wantedSyncnetsCount = wantedSyncnets.countOnes() - wantedCscnetsCount = wantedCscnets + wantedCscnetsCount = wantedCscnets.countOnes() + wantedCscnetsUint = wantedCscnetsCount.uint8 outgoingPeers = node.peerPool.lenCurrent({PeerType.Outgoing}) targetOutgoingPeers = max(node.wantedPeers div 10, 3) @@ -1580,7 +1581,7 @@ proc runDiscoveryLoop(node: Eth2Node) {.async.} = node.discoveryForkId, wantedAttnets, wantedSyncnets, - wantedCscnets, + wantedCscnetsUint, minScore) let newPeers = block: diff --git a/beacon_chain/spec/datatypes/eip7594.nim b/beacon_chain/spec/datatypes/eip7594.nim index 69769a082..fff0db6c4 100644 --- a/beacon_chain/spec/datatypes/eip7594.nim +++ b/beacon_chain/spec/datatypes/eip7594.nim @@ -76,7 +76,8 @@ type kzg_proof*: KzgProof column_index*: ColumnIndex row_index*: RowIndex - + + CscBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT] CscCount* = uint8 # https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.4/specs/_features/eip7594/p2p-interface.md#metadata