allow inspector tool to log interop attestations

This commit is contained in:
Dustin Brody 2020-05-14 13:35:29 +02:00 committed by zah
parent 57519bebac
commit 2db99545cd
1 changed files with 14 additions and 3 deletions

View File

@ -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.} =