Skip to content

Commit

Permalink
upgrading libp2p to version v0.14.1 (#782) (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalchangrani committed Jun 7, 2021
1 parent 3accb5f commit 4c29e88
Show file tree
Hide file tree
Showing 8 changed files with 491 additions and 150 deletions.
7 changes: 2 additions & 5 deletions access/handler.go
Expand Up @@ -3,11 +3,11 @@ package access
import (
"context"

"github.com/golang/protobuf/ptypes"
"github.com/onflow/flow/protobuf/go/flow/access"
"github.com/onflow/flow/protobuf/go/flow/entities"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/onflow/flow-go/engine/common/rpc/convert"
"github.com/onflow/flow-go/model/flow"
Expand Down Expand Up @@ -458,10 +458,7 @@ func blockEventsToMessage(block flow.BlockEvents) (*access.EventsResponse_Result
for i, event := range block.Events {
eventMessages[i] = convert.EventToMessage(event)
}
timestamp, err := ptypes.TimestampProto(block.BlockTimestamp)
if err != nil {
return nil, err
}
timestamp := timestamppb.New(block.BlockTimestamp)
return &access.EventsResponse_Result{
BlockId: block.BlockID[:],
BlockHeight: block.BlockHeight,
Expand Down
12 changes: 3 additions & 9 deletions access/legacy/convert/convert.go
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"fmt"

"github.com/golang/protobuf/ptypes"
accessproto "github.com/onflow/flow/protobuf/go/flow/legacy/access"
entitiesproto "github.com/onflow/flow/protobuf/go/flow/legacy/entities"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/onflow/flow-go/access"
"github.com/onflow/flow-go/crypto"
Expand Down Expand Up @@ -131,10 +131,7 @@ func TransactionResultToMessage(result access.TransactionResult) *accessproto.Tr
func BlockHeaderToMessage(h *flow.Header) (*entitiesproto.BlockHeader, error) {
id := h.ID()

t, err := ptypes.TimestampProto(h.Timestamp)
if err != nil {
return nil, err
}
t := timestamppb.New(h.Timestamp)

return &entitiesproto.BlockHeader{
Id: id[:],
Expand All @@ -148,10 +145,7 @@ func BlockToMessage(h *flow.Block) (*entitiesproto.Block, error) {
id := h.ID()

parentID := h.Header.ParentID
t, err := ptypes.TimestampProto(h.Header.Timestamp)
if err != nil {
return nil, err
}
t := timestamppb.New(h.Header.Timestamp)

cg := make([]*entitiesproto.CollectionGuarantee, len(h.Payload.Guarantees))
for i, g := range h.Payload.Guarantees {
Expand Down
13 changes: 3 additions & 10 deletions engine/common/rpc/convert/convert.go
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"fmt"

"github.com/golang/protobuf/ptypes"
"github.com/onflow/flow/protobuf/go/flow/entities"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/onflow/flow-go/crypto"
"github.com/onflow/flow-go/crypto/hash"
Expand Down Expand Up @@ -122,10 +122,7 @@ func TransactionToMessage(tb flow.TransactionBody) *entities.Transaction {
func BlockHeaderToMessage(h *flow.Header) (*entities.BlockHeader, error) {
id := h.ID()

t, err := ptypes.TimestampProto(h.Timestamp)
if err != nil {
return nil, err
}
t := timestamppb.New(h.Timestamp)

return &entities.BlockHeader{
Id: id[:],
Expand All @@ -140,11 +137,7 @@ func BlockToMessage(h *flow.Block) (*entities.Block, error) {
id := h.ID()

parentID := h.Header.ParentID
t, err := ptypes.TimestampProto(h.Header.Timestamp)
if err != nil {
return nil, err
}

t := timestamppb.New(h.Header.Timestamp)
cg := make([]*entities.CollectionGuarantee, len(h.Payload.Guarantees))
for i, g := range h.Payload.Guarantees {
cg[i] = collectionGuaranteeToMessage(g)
Expand Down
2 changes: 1 addition & 1 deletion engine/execution/provider/engine.go
Expand Up @@ -210,7 +210,7 @@ func (e *Engine) onChunkDataRequest(
}

if err != nil {
log.Error().Err(err).Str("origin", fmt.Sprintf("%s", origin)).Msg("could not send requested chunk data pack to")
log.Error().Err(err).Str("origin", origin.String()).Msg("could not send requested chunk data pack to")
return
}

Expand Down
32 changes: 16 additions & 16 deletions go.mod
Expand Up @@ -6,18 +6,18 @@ require (
cloud.google.com/go/storage v1.10.0
github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect
github.com/bsipos/thist v1.0.0
github.com/btcsuite/btcd v0.20.1-beta
github.com/btcsuite/btcd v0.21.0-beta
github.com/codahale/hdrhistogram v0.9.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.0.3
github.com/ef-ds/deque v1.0.4
github.com/ethereum/go-ethereum v1.9.13
github.com/fxamacker/cbor/v2 v2.2.1-0.20210510192846-c3f3c69e7bc8
github.com/gogo/protobuf v1.3.1
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.4.2
github.com/google/go-cmp v0.5.2
github.com/google/uuid v1.1.1
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.5.0
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.5
github.com/google/uuid v1.1.2
github.com/grpc-ecosystem/go-grpc-middleware/providers/zerolog/v2 v2.0.0-rc.2
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-20200501113911-9a95f0fdbfea
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
Expand All @@ -27,14 +27,15 @@ require (
github.com/ipfs/go-log v1.0.4
github.com/jrick/bitset v1.0.0
github.com/libp2p/go-addr-util v0.0.2
github.com/libp2p/go-libp2p v0.13.0
github.com/libp2p/go-libp2p-core v0.8.0
github.com/libp2p/go-libp2p v0.14.1
github.com/libp2p/go-libp2p-core v0.8.5
github.com/libp2p/go-libp2p-discovery v0.5.0
github.com/libp2p/go-libp2p-pubsub v0.4.1
github.com/libp2p/go-libp2p-swarm v0.4.0
github.com/libp2p/go-libp2p-transport-upgrader v0.4.0
github.com/libp2p/go-libp2p-swarm v0.5.0
github.com/libp2p/go-libp2p-transport-upgrader v0.4.2
github.com/libp2p/go-tcp-transport v0.2.1
github.com/m4ksio/wal v1.0.0
github.com/marten-seemann/qtls-go1-15 v0.1.4 // indirect
github.com/multiformats/go-multiaddr v0.3.1
github.com/onflow/cadence v0.16.1
github.com/onflow/flow-core-contracts/lib/go/contracts v0.7.2
Expand All @@ -54,20 +55,19 @@ require (
github.com/uber/jaeger-lib v2.3.0+incompatible // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible
github.com/vmihailenco/msgpack/v4 v4.3.11
go.uber.org/atomic v1.6.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
go.uber.org/atomic v1.7.0
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
google.golang.org/api v0.31.0
google.golang.org/grpc v1.31.1
google.golang.org/grpc v1.33.2
google.golang.org/protobuf v1.26.0
gotest.tools v2.2.0+incompatible
)

replace mellium.im/sasl => github.com/mellium/sasl v0.2.1

// temp fix for MacOS build. See comment https://github.com/ory/dockertest/issues/208#issuecomment-686820414
replace golang.org/x/sys => golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6

replace github.com/onflow/flow-go/crypto => ./crypto

replace github.com/onflow/cadence => github.com/dapperlabs/cadence-internal v0.16.1-patch.1

0 comments on commit 4c29e88

Please sign in to comment.