diff --git a/beacon_chain/networking/eth2_discovery.nim b/beacon_chain/networking/eth2_discovery.nim index 20e1866fc..74e71268b 100644 --- a/beacon_chain/networking/eth2_discovery.nim +++ b/beacon_chain/networking/eth2_discovery.nim @@ -161,6 +161,12 @@ proc queryRandom*( debug "Could not decode the csc count ENR bitfield of peer", peer = n.record.toURI(), exception = e.name, msg = e.msg continue + if wantedCscnets == cscnetsNode: + score += 1 + + else: + debug "Wanted csc count and decode csc from enr does not match!", + wantedCsc = wantedCscnets, cscNets = cscnetsNode let attnetsBytes = n.record.get(enrAttestationSubnetsField, seq[byte]) if attnetsBytes.isOk(): diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index 67f900ce9..a9ea394c0 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -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) + findLowSubnets(getDataColumnSidecarTopic, uint64, (DATA_COLUMN_SIDECAR_SUBNET_COUNT div 2).int) ) proc runDiscoveryLoop(node: Eth2Node) {.async.} = @@ -1581,7 +1581,7 @@ proc runDiscoveryLoop(node: Eth2Node) {.async.} = node.discoveryForkId, wantedAttnets, wantedSyncnets, - uint64.fromBytesBE(wantedCscnetsBEBytes), + wantedCscnetsCount, minScore) let newPeers = block: @@ -2466,10 +2466,10 @@ proc lookupCscFromPeer*(peer: Peer): uint64 = return csc except SszError as e: debug "Could not decide the csc field in the ENR" - return 0 + return CUSTODY_REQUIREMENT except SerializationError: debug "Error in serializing the value" - return 0 + return CUSTODY_REQUIREMENT func shortForm*(id: NetKeyPair): string = $PeerId.init(id.pubkey) diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 8918c4fb1..457c14fc8 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -1167,13 +1167,13 @@ proc addDenebMessageHandlers( node.network.subscribe(topic, basicParams) if node.config.subscribeAllSubnets: - node.network.loadCscnetsMetadata(DATA_COLUMN_SIDECAR_SUBNET_COUNT) + 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) + node.network.loadCscnetsMetadata(csc.get.uint64) else: - node.network.loadCscnetsMetadata(CUSTODY_REQUIREMENT) + node.network.loadCscnetsMetadata(CUSTODY_REQUIREMENT.uint64) proc addElectraMessageHandlers( node: BeaconNode, forkDigest: ForkDigest, slot: Slot) = diff --git a/beacon_chain/spec/datatypes/eip7594.nim b/beacon_chain/spec/datatypes/eip7594.nim index 180fbabeb..08e25a162 100644 --- a/beacon_chain/spec/datatypes/eip7594.nim +++ b/beacon_chain/spec/datatypes/eip7594.nim @@ -76,7 +76,7 @@ type column_index*: ColumnIndex row_index*: RowIndex - CscBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT] + CscBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT div 2] CscCount* = uint64 # https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.4/specs/_features/eip7594/p2p-interface.md#metadata