mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 05:38:55 +00:00
322998f7f1
* Deduplicate subnet topic definitions * Move topics to global file * Gaz * Merge branch 'master' into move-topics * Fix * Merge refs/heads/master into move-topics * Bazel * Merge branch 'move-topics' of github.com:prysmaticlabs/prysm into move-topics * Fix tests * Fix * Undo e2e changes * Revert "Undo e2e changes" This reverts commit 3037bb35904ee3a2f54050e920ee8c75a4cb8036. * Fix * Fix * Merge refs/heads/master into move-topics * Merge refs/heads/master into move-topics * Merge refs/heads/master into move-topics * Comments * Merge refs/heads/master into move-topics * Merge refs/heads/master into move-topics
30 lines
987 B
Go
30 lines
987 B
Go
package p2p
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/gogo/protobuf/proto"
|
|
pb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
)
|
|
|
|
// GossipTopicMappings represent the protocol ID to protobuf message type map for easy
|
|
// lookup.
|
|
var GossipTopicMappings = map[string]proto.Message{
|
|
BlockSubnetTopicFormat: &pb.SignedBeaconBlock{},
|
|
AttestationSubnetTopicFormat: &pb.Attestation{},
|
|
ExitSubnetTopicFormat: &pb.SignedVoluntaryExit{},
|
|
ProposerSlashingSubnetTopicFormat: &pb.ProposerSlashing{},
|
|
AttesterSlashingSubnetTopicFormat: &pb.AttesterSlashing{},
|
|
AggregateAndProofSubnetTopicFormat: &pb.SignedAggregateAttestationAndProof{},
|
|
}
|
|
|
|
// GossipTypeMapping is the inverse of GossipTopicMappings so that an arbitrary protobuf message
|
|
// can be mapped to a protocol ID string.
|
|
var GossipTypeMapping = make(map[reflect.Type]string, len(GossipTopicMappings))
|
|
|
|
func init() {
|
|
for k, v := range GossipTopicMappings {
|
|
GossipTypeMapping[reflect.TypeOf(v)] = k
|
|
}
|
|
}
|