From 32872c7ee6fbf4d0f4024d591644a3cb69744a17 Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Fri, 21 Feb 2020 14:15:13 +0100 Subject: [PATCH] bump spec version to 0.10.1 (more accurate than 0.10.0); fix inspector building --- beacon_chain/inspector.nim | 23 ++++++++++++----------- beacon_chain/spec/datatypes.nim | 2 +- beacon_chain/spec/network.nim | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/beacon_chain/inspector.nim b/beacon_chain/inspector.nim index 3f2979ae4..548801812 100644 --- a/beacon_chain/inspector.nim +++ b/beacon_chain/inspector.nim @@ -4,7 +4,7 @@ # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. -import strutils, os, tables +import sequtils, strutils, os, tables import confutils, chronicles, chronos, libp2p/daemon/daemonapi, libp2p/multiaddress import stew/byteutils as bu @@ -93,18 +93,18 @@ type abbr: "d" defaultValue: false }: bool -proc getTopic(filter: TopicFilter): string {.inline.} = +func getTopic(filter: TopicFilter): seq[string] {.inline.} = case filter of TopicFilter.Blocks: - topicBeaconBlocks + @[topicBeaconBlocks] of TopicFilter.Attestations: - topicAttestations + mapIt(0'u64 ..< ATTESTATION_SUBNET_COUNT.uint64, it.getAttestationTopic) of TopicFilter.Exits: - topicVoluntaryExits + @[topicVoluntaryExits] of TopicFilter.ProposerSlashing: - topicProposerSlashings + @[topicProposerSlashings] of TopicFilter.AttesterSlashings: - topicAttesterSlashings + @[topicAttesterSlashings] proc getPeerId(peer: PeerID, conf: InspectorConf): string {.inline.} = if conf.fullPeerId: @@ -278,10 +278,11 @@ proc run(conf: InspectorConf) {.async.} = try: for filter in topics: - let topic = getTopic(filter) - let t = await api.pubsubSubscribe(topic, pubsubLogger) - info "Subscribed to topic", topic = topic - subs.add((ticket: t, future: t.transp.join())) + let topics = getTopic(filter) + for topic in topics: + let t = await api.pubsubSubscribe(topic, pubsubLogger) + info "Subscribed to topic", topic = topic + subs.add((ticket: t, future: t.transp.join())) for filter in conf.customTopics: let t = await api.pubsubSubscribe(filter, pubsubLogger) info "Subscribed to custom topic", topic = filter diff --git a/beacon_chain/spec/datatypes.nim b/beacon_chain/spec/datatypes.nim index 9ba3538d0..4748eab6d 100644 --- a/beacon_chain/spec/datatypes.nim +++ b/beacon_chain/spec/datatypes.nim @@ -57,7 +57,7 @@ else: loadCustomPreset const_preset const - SPEC_VERSION* = "0.10.0" ## \ + SPEC_VERSION* = "0.10.1" ## \ ## Spec version we're aiming to be compatible with, right now ## TODO: improve this scheme once we can negotiate versions in protocol diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index dbf86d050..d297b964b 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -14,7 +14,7 @@ const topicProposerSlashings* = "/eth2/proposer_slashing/ssz" topicAttesterSlashings* = "/eth2/attester_slashing/ssz" - # https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/p2p-interface.md#configuration + # https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/p2p-interface.md#configuration ATTESTATION_SUBNET_COUNT* = 64 func getAttestationTopic*(committeeIndex: uint64): string =