Skip to content

Commit

Permalink
Merge branch 'master' into pubsub-rework-validator-pipeline-update
Browse files Browse the repository at this point in the history
  • Loading branch information
pdyraga committed May 3, 2019
2 parents 27225d5 + 89fcffe commit 994201b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ required = ["github.com/gogo/protobuf/protoc-gen-gogoslick", "github.com/ethereu
# libp2p
[[override]]
name = "github.com/libp2p/go-libp2p-peer"
revision = "9b0c59cc3369e1302b45f9861970356c223a858e"
revision = "9ccddf5f5d8318b00658dfbc06a4e32b16bae6a9"

[[override]]
name = "github.com/libp2p/go-libp2p-swarm"
Expand Down
4 changes: 2 additions & 2 deletions pkg/net/libp2p/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func verifyEnvelope(sender peer.ID, messageBytes []byte, signature []byte) error
return fmt.Errorf(
"failed to verify signature [0x%v] for sender [%v] with err [%v]",
hex.EncodeToString(signature),
sender.Pretty(),
sender.String(),
err,
)
}
Expand All @@ -178,7 +178,7 @@ func verifyEnvelope(sender peer.ID, messageBytes []byte, signature []byte) error
return fmt.Errorf(
"invalid signature [0x%v] on message from sender [%v] ",
hex.EncodeToString(signature),
sender.Pretty(),
sender.String(),
)
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/net/libp2p/channel_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ func newChannelManager(
identity *identity,
p2phost host.Host,
) (*channelManager, error) {
floodsub, err := pubsub.NewFloodSub(ctx, p2phost)
floodsub, err := pubsub.NewFloodSub(
ctx,
p2phost,
pubsub.WithMessageSigning(true),
pubsub.WithStrictSignatureVerification(true),
)
if err != nil {
return nil, err
}
Expand Down
9 changes: 2 additions & 7 deletions pkg/net/libp2p/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func createIdentity(privateKey libp2pcrypto.PrivKey) (*identity, error) {
}

func (ni networkIdentity) String() string {
return peer.ID(ni).Pretty()
return peer.ID(ni).String()
}

func (i *identity) Marshal() ([]byte, error) {
Expand All @@ -50,12 +50,7 @@ func (i *identity) Marshal() ([]byte, error) {
return nil, err
}
}
if pubKey == nil {
return nil, fmt.Errorf(
"failed to generate public key with peerid %v",
i.id.Pretty(),
)
}

pubKeyBytes, err := pubKey.Bytes()
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/net/libp2p/libp2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (p *provider) ID() net.TransportIdentifier {
func (p *provider) AddrStrings() []string {
multiaddrStrings := make([]string, 0, len(p.addrs))
for _, multiaddr := range p.addrs {
addrWithIdentity := fmt.Sprintf("%s/ipfs/%s", multiaddr.String(), p.identity.id.Pretty())
addrWithIdentity := fmt.Sprintf("%s/ipfs/%s", multiaddr.String(), p.identity.id.String())
multiaddrStrings = append(multiaddrStrings, addrWithIdentity)
}

Expand All @@ -87,7 +87,7 @@ func (p *provider) Peers() []string {
if peer == p.identity.id {
continue
}
peers = append(peers, peer.Pretty())
peers = append(peers, peer.String())
}
return peers
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/net/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ type TaggedUnmarshaler interface {

// BroadcastChannel represents a named pubsub channel. It allows Group Members
// to send messages on the channel (via Send), and to access a low-level receive chan
// that furnishes messages sent onto the BroadcastChannel.
// that furnishes messages sent onto the BroadcastChannel. Messages are not
// guaranteed to be ordered at the pubsub level, though they will be at the
// underlying network protocol (ie. tcp, quic).
type BroadcastChannel interface {
// Name returns the name of this broadcast channel.
Name() string
Expand Down

0 comments on commit 994201b

Please sign in to comment.