From 2db99545cd9b257bb93f9d0d7220d3f7880d4b67 Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Thu, 14 May 2020 13:35:29 +0200 Subject: [PATCH] allow inspector tool to log interop attestations --- beacon_chain/inspector.nim | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/beacon_chain/inspector.nim b/beacon_chain/inspector.nim index 19dec979b..b8c5a3984 100644 --- a/beacon_chain/inspector.nim +++ b/beacon_chain/inspector.nim @@ -51,7 +51,8 @@ type next_fork_epoch*: Epoch TopicFilter* {.pure.} = enum - Blocks, Attestations, Exits, ProposerSlashing, AttesterSlashings + Blocks, Attestations, Exits, ProposerSlashing, AttesterSlashings, + InteropAttestations BootstrapKind* {.pure.} = enum Enr, MultiAddr @@ -200,6 +201,9 @@ func getTopics(forkDigest: ForkDigest, of TopicFilter.AttesterSlashings: let topic = getAttesterSlashingsTopic(forkDigest) @[topic, topic & "_snappy"] + of TopicFilter.InteropAttestations: + let topic = getInteropAttestationTopic(forkDigest) + @[topic, topic & "_snappy"] of TopicFilter.Attestations: var topics = newSeq[string](ATTESTATION_SUBNET_COUNT * 2) var offset = 0 @@ -530,6 +534,9 @@ proc pubsubLogger(conf: InspectorConf, switch: Switch, elif topic.endsWith(topicAggregateAndProofsSuffix) or topic.endsWith(topicAggregateAndProofsSuffix & "_snappy"): info "AggregateAndProof", msg = SSZ.decode(buffer, AggregateAndProof) + elif topic.endsWith(topicInteropAttestationSuffix) or + topic.endsWith(topicInteropAttestationSuffix & "_snappy"): + info "Attestation", msg = SSZ.decode(buffer, Attestation) except CatchableError as exc: info "Unable to decode message", errMsg = exc.msg @@ -696,7 +703,8 @@ proc run(conf: InspectorConf) {.async.} = if lcitem == "*": topics.incl({TopicFilter.Blocks, TopicFilter.Attestations, TopicFilter.Exits, TopicFilter.ProposerSlashing, - TopicFilter.AttesterSlashings}) + TopicFilter.AttesterSlashings, + TopicFilter.InteropAttestations}) break elif lcitem == "a": topics.incl(TopicFilter.Attestations) @@ -708,12 +716,15 @@ proc run(conf: InspectorConf) {.async.} = topics.incl(TopicFilter.ProposerSlashing) elif lcitem == "as": topics.incl(TopicFilter.AttesterSlashings) + elif lcitem == "ia": + topics.incl(TopicFilter.InteropAttestations) else: discard else: topics.incl({TopicFilter.Blocks, TopicFilter.Attestations, TopicFilter.Exits, TopicFilter.ProposerSlashing, - TopicFilter.AttesterSlashings}) + TopicFilter.AttesterSlashings, + TopicFilter.InteropAttestations}) proc pubsubTrampoline(topic: string, data: seq[byte]): Future[void] {.gcsafe.} =