Skip to content

Commit

Permalink
Tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Jul 25, 2024
1 parent 8e138ed commit 0b7f7b2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
1 change: 0 additions & 1 deletion eth/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ func desiredPubSubBaseTopics() []string {
// we unfortunatelly can't validate the messages (yet)
// thus, better not to forward invalid messages
// p2p.GossipExitMessage,
p2p.GossipExitMessage,
p2p.GossipAttesterSlashingMessage,
p2p.GossipProposerSlashingMessage,
p2p.GossipContributionAndProofMessage,
Expand Down
33 changes: 0 additions & 33 deletions eth/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ func (p *PubSub) Serve(ctx context.Context) error {
func (p *PubSub) mapPubSubTopicWithHandlers(topic string) host.TopicHandler {
switch {
// Ensure hotter topics are at the top of the switch statement.
case strings.Contains(topic, p2p.GossipAttestationMessage):
return p.handleBeaconAttestation
case strings.Contains(topic, p2p.GossipDataColumnSidecarMessage):
return p.handleBeaconDataColumnSidecar
case strings.Contains(topic, p2p.GossipBlockMessage):
Expand Down Expand Up @@ -157,37 +155,6 @@ func (n *Node) FilterIncomingSubscriptions(id peer.ID, subs []*pubsubpb.RPC_SubO
return pubsub.FilterSubscriptions(subs, n.CanSubscribe), nil
}

func (p *PubSub) handleBeaconAttestation(ctx context.Context, msg *pubsub.Message) error {
now := time.Now()

attestation := &ethtypes.Attestation{}
if err := p.cfg.Encoder.DecodeGossip(msg.Data, attestation); err != nil {
return fmt.Errorf("error decoding phase0 attestation gossip message: %w", err)
}

evt := &host.TraceEvent{
Type: "HANDLE_MESSAGE",
PeerID: p.host.ID(),
Timestamp: now,
Payload: map[string]any{
"PeerID": msg.ReceivedFrom.String(),
"MsgID": hex.EncodeToString([]byte(msg.ID)),
"MsgSize": len(msg.Data),
"Topic": msg.GetTopic(),
"Seq": msg.GetSeqno(),
"Attestation": attestation,
"Timestamp": now,
},
}

if err := p.cfg.DataStream.PutRecord(ctx, evt); err != nil {
slog.Warn("failed putting topic handler event", tele.LogAttrError(err))
}

return nil

}

func (p *PubSub) handleBeaconDataColumnSidecar(ctx context.Context, msg *pubsub.Message) error {
now := time.Now()

Expand Down

0 comments on commit 0b7f7b2

Please sign in to comment.