Skip to content

Commit

Permalink
trying to fix topics subsciribtion
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Jul 24, 2024
1 parent e86fa70 commit e446b25
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
30 changes: 15 additions & 15 deletions message/validation/genesis/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
alanspectypes "github.com/ssvlabs/ssv-spec/types"
"github.com/ssvlabs/ssv/logging/fields"
"github.com/ssvlabs/ssv/monitoring/metricsreporter"
"github.com/ssvlabs/ssv/network/commons"
"github.com/ssvlabs/ssv/networkconfig"
"github.com/ssvlabs/ssv/operator/duties/dutystore"
"github.com/ssvlabs/ssv/operator/keys"
Expand Down Expand Up @@ -353,21 +352,22 @@ func (mv *messageValidator) validateP2PMessage(pMsg *pubsub.Message, receivedAt
return nil, Descriptor{}, ErrEmptyPubSubMessage
}

// TODO Alan - revert it back once we have dual subnets
// Check if the message was sent on the right topic.
currentTopic := pMsg.GetTopic()
currentTopicBaseName := commons.GetTopicBaseName(currentTopic)
topics := commons.ValidatorTopicID(msg.GetID().GetPubKey())

topicFound := false
for _, tp := range topics {
if tp == currentTopicBaseName {
topicFound = true
break
}
}
if !topicFound {
return nil, Descriptor{}, ErrTopicNotFound
}
// currentTopic := pMsg.GetTopic()
// currentTopicBaseName := commons.GetTopicBaseName(currentTopic)
// topics := commons.ValidatorTopicID(msg.GetID().GetPubKey())

// topicFound := false
// for _, tp := range topics {
// if tp == currentTopicBaseName {
// topicFound = true
// break
// }
// }
// if !topicFound {
// return nil, Descriptor{}, ErrTopicNotFound
// }

mv.metrics.GenesisSSVMessageType(msg.MsgType)

Expand Down
4 changes: 3 additions & 1 deletion network/p2p/p2p_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ func (p *GenesisP2p) Broadcast(message *genesisspectypes.SSVMessage) error {
return fmt.Errorf("could not find validator: %x", message.MsgID.GetPubKey())
}

topics := commons.ValidatorTopicID(message.MsgID.GetPubKey())
// TODO Alan - revert it back once we have dual subnets
// topics := commons.ValidatorTopicID(message.MsgID.GetPubKey())
topics := commons.CommitteeTopicID(share.CommitteeID())

for _, topic := range topics {
p.Network.interfaceLogger.Debug("broadcasting msg",
Expand Down

0 comments on commit e446b25

Please sign in to comment.