bump spec version to 0.10.1 (more accurate than 0.10.0); fix inspector building

This commit is contained in:
Dustin Brody 2020-02-21 14:15:13 +01:00 committed by tersec
parent 6c87af9aab
commit 32872c7ee6
3 changed files with 14 additions and 13 deletions

View File

@ -4,7 +4,7 @@
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * 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). # * 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. # 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, import confutils, chronicles, chronos, libp2p/daemon/daemonapi,
libp2p/multiaddress libp2p/multiaddress
import stew/byteutils as bu import stew/byteutils as bu
@ -93,18 +93,18 @@ type
abbr: "d" abbr: "d"
defaultValue: false }: bool defaultValue: false }: bool
proc getTopic(filter: TopicFilter): string {.inline.} = func getTopic(filter: TopicFilter): seq[string] {.inline.} =
case filter case filter
of TopicFilter.Blocks: of TopicFilter.Blocks:
topicBeaconBlocks @[topicBeaconBlocks]
of TopicFilter.Attestations: of TopicFilter.Attestations:
topicAttestations mapIt(0'u64 ..< ATTESTATION_SUBNET_COUNT.uint64, it.getAttestationTopic)
of TopicFilter.Exits: of TopicFilter.Exits:
topicVoluntaryExits @[topicVoluntaryExits]
of TopicFilter.ProposerSlashing: of TopicFilter.ProposerSlashing:
topicProposerSlashings @[topicProposerSlashings]
of TopicFilter.AttesterSlashings: of TopicFilter.AttesterSlashings:
topicAttesterSlashings @[topicAttesterSlashings]
proc getPeerId(peer: PeerID, conf: InspectorConf): string {.inline.} = proc getPeerId(peer: PeerID, conf: InspectorConf): string {.inline.} =
if conf.fullPeerId: if conf.fullPeerId:
@ -278,10 +278,11 @@ proc run(conf: InspectorConf) {.async.} =
try: try:
for filter in topics: for filter in topics:
let topic = getTopic(filter) let topics = getTopic(filter)
let t = await api.pubsubSubscribe(topic, pubsubLogger) for topic in topics:
info "Subscribed to topic", topic = topic let t = await api.pubsubSubscribe(topic, pubsubLogger)
subs.add((ticket: t, future: t.transp.join())) info "Subscribed to topic", topic = topic
subs.add((ticket: t, future: t.transp.join()))
for filter in conf.customTopics: for filter in conf.customTopics:
let t = await api.pubsubSubscribe(filter, pubsubLogger) let t = await api.pubsubSubscribe(filter, pubsubLogger)
info "Subscribed to custom topic", topic = filter info "Subscribed to custom topic", topic = filter

View File

@ -57,7 +57,7 @@ else:
loadCustomPreset const_preset loadCustomPreset const_preset
const const
SPEC_VERSION* = "0.10.0" ## \ SPEC_VERSION* = "0.10.1" ## \
## Spec version we're aiming to be compatible with, right now ## Spec version we're aiming to be compatible with, right now
## TODO: improve this scheme once we can negotiate versions in protocol ## TODO: improve this scheme once we can negotiate versions in protocol

View File

@ -14,7 +14,7 @@ const
topicProposerSlashings* = "/eth2/proposer_slashing/ssz" topicProposerSlashings* = "/eth2/proposer_slashing/ssz"
topicAttesterSlashings* = "/eth2/attester_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 ATTESTATION_SUBNET_COUNT* = 64
func getAttestationTopic*(committeeIndex: uint64): string = func getAttestationTopic*(committeeIndex: uint64): string =