bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315)

* Removed legacy syncing peer provider. (#4260)

* Removed legacy syncing peer provider.

* Fix localnet.

* Fix migrate version.

* Rebased on main.

* Fix formatting.

* Remove blockchain dependency from engine. (#4310)

* Consensus doesn't require anymore `Node` as a circular dependency.

* Rebased upon main.

* Removed engine beacon chain dependency.

* Fixed nil error.

* Fixed error.

* bump libp2p to version 0.24.0 and update its dependencies and relevant tests

* fix format, remove wrongly added configs

* add back wrongly deleted comment

* fix travis go checker

Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
pull/4316/head
Gheis 2 years ago committed by GitHub
parent fd008c95d9
commit 8d3be78cc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cmd/bootnode/main.go
  2. 224
      go.mod
  3. 1141
      go.sum
  4. 2
      hmy/hmy.go
  5. 2
      hmy/net.go
  6. 4
      internal/configs/node/config.go
  7. 2
      internal/utils/utils.go
  8. 6
      internal/utils/utils_test.go
  9. 2
      node/api.go
  10. 2
      node/node.go
  11. 2
      node/node_handler.go
  12. 8
      p2p/discovery/discovery.go
  13. 3
      p2p/discovery/discovery_test.go
  14. 8
      p2p/gater.go
  15. 14
      p2p/host.go
  16. 4
      p2p/metrics.go
  17. 2
      p2p/security/security.go
  18. 49
      p2p/security/security_test.go
  19. 2
      p2p/stream/common/streammanager/cooldown.go
  20. 6
      p2p/stream/common/streammanager/interface.go
  21. 6
      p2p/stream/common/streammanager/interface_test.go
  22. 6
      p2p/stream/common/streammanager/streammanager.go
  23. 2
      p2p/stream/common/streammanager/streammanager_test.go
  24. 4
      p2p/stream/protocols/sync/protocol.go
  25. 4
      p2p/stream/protocols/sync/protocol_test.go
  26. 2
      p2p/stream/protocols/sync/stream.go
  27. 49
      p2p/stream/protocols/sync/stream_test.go
  28. 2
      p2p/stream/types/interface.go
  29. 2
      p2p/stream/types/stream.go
  30. 2
      p2p/stream/types/utils.go
  31. 2
      p2p/types/peerAddr.go
  32. 2
      p2p/types/types.go
  33. 2
      p2p/utils_test.go
  34. 2
      rosetta/services/network.go
  35. 2
      rosetta/services/network_test.go
  36. 2
      rpc/common/types.go
  37. 2
      test/helpers/p2p.go

@ -9,7 +9,7 @@ import (
"path" "path"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
net "github.com/libp2p/go-libp2p-core/network" net "github.com/libp2p/go-libp2p/core/network"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
"github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/internal/utils"

224
go.mod

@ -1,6 +1,6 @@
module github.com/harmony-one/harmony module github.com/harmony-one/harmony
go 1.18 go 1.19
require ( require (
github.com/RoaringBitmap/roaring v1.1.0 github.com/RoaringBitmap/roaring v1.1.0
@ -21,47 +21,46 @@ require (
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/golangci/golangci-lint v1.22.2 github.com/golangci/golangci-lint v1.22.2
github.com/gorilla/mux v1.8.0 github.com/gorilla/mux v1.8.0
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.5.0
github.com/harmony-one/abool v1.0.1 github.com/harmony-one/abool v1.0.1
github.com/harmony-one/bls v0.0.6 github.com/harmony-one/bls v0.0.6
github.com/harmony-one/taggedrlp v0.1.4 github.com/harmony-one/taggedrlp v0.1.4
github.com/harmony-one/vdf v0.0.0-20190924175951-620379da8849 github.com/harmony-one/vdf v0.0.0-20190924175951-620379da8849
github.com/hashicorp/go-version v1.2.0 github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/golang-lru v0.5.4 github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/ipfs/go-ds-badger v0.2.7 github.com/ipfs/go-ds-badger v0.3.0
github.com/json-iterator/go v1.1.12 github.com/json-iterator/go v1.1.12
github.com/libp2p/go-libp2p v0.14.4 github.com/libp2p/go-libp2p v0.24.0
github.com/libp2p/go-libp2p-core v0.8.6 github.com/libp2p/go-libp2p-kad-dht v0.19.0
github.com/libp2p/go-libp2p-crypto v0.1.0 github.com/libp2p/go-libp2p-pubsub v0.8.2
github.com/libp2p/go-libp2p-discovery v0.5.1 github.com/multiformats/go-multiaddr v0.8.0
github.com/libp2p/go-libp2p-kad-dht v0.11.1
github.com/libp2p/go-libp2p-pubsub v0.5.6
github.com/multiformats/go-multiaddr v0.3.3
github.com/multiformats/go-multiaddr-dns v0.3.1 github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/natefinch/lumberjack v2.0.0+incompatible github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/pborman/uuid v1.2.0 github.com/pborman/uuid v1.2.0
github.com/pelletier/go-toml v1.9.3 github.com/pelletier/go-toml v1.9.5
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_golang v1.14.0
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
github.com/rjeczalik/notify v0.9.2 github.com/rjeczalik/notify v0.9.2
github.com/rs/cors v1.7.0 github.com/rs/cors v1.7.0
github.com/rs/zerolog v1.18.0 github.com/rs/zerolog v1.18.0
github.com/spf13/cobra v0.0.5 github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.1 github.com/spf13/viper v1.14.0
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.8.1
github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca
github.com/tikv/client-go/v2 v2.0.1 github.com/tikv/client-go/v2 v2.0.1
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee
go.uber.org/ratelimit v0.1.0 go.uber.org/ratelimit v0.1.0
go.uber.org/zap v1.20.0 go.uber.org/zap v1.24.0
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf golang.org/x/crypto v0.4.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/net v0.3.0 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba golang.org/x/sync v0.1.0
golang.org/x/tools v0.1.7 // indirect golang.org/x/sys v0.3.0 // indirect
google.golang.org/grpc v1.43.0 golang.org/x/time v0.0.0-20220609170525-579cf78fd858
google.golang.org/protobuf v1.26.0 golang.org/x/tools v0.3.0 // indirect
google.golang.org/grpc v1.50.1
google.golang.org/protobuf v1.28.1
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6
@ -72,30 +71,34 @@ require (
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect github.com/BurntSushi/toml v0.3.1 // indirect
github.com/OpenPeeDeeP/depguard v1.0.1 // indirect github.com/OpenPeeDeeP/depguard v1.0.1 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/aristanetworks/goarista v0.0.0-20190607111240-52c2a7864a08 // indirect github.com/aristanetworks/goarista v0.0.0-20190607111240-52c2a7864a08 // indirect
github.com/benbjohnson/clock v1.1.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/bombsimon/wsl/v2 v2.0.0 // indirect github.com/bombsimon/wsl/v2 v2.0.0 // indirect
github.com/btcsuite/btcd v0.21.0-beta // indirect github.com/btcsuite/btcd v0.21.0-beta // indirect
github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/dgraph-io/badger v1.6.2 // indirect github.com/dgraph-io/badger v1.6.2 // indirect
github.com/dgraph-io/ristretto v0.0.3 // indirect github.com/dgraph-io/ristretto v0.0.3 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa // indirect github.com/elastic/gosigar v0.14.2 // indirect
github.com/fatih/color v1.10.0 // indirect github.com/fatih/color v1.13.0 // indirect
github.com/flynn/noise v1.0.0 // indirect github.com/flynn/noise v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/go-critic/go-critic v0.4.0 // indirect github.com/go-critic/go-critic v0.4.0 // indirect
github.com/go-lintpack/lintpack v0.5.2 // indirect github.com/go-lintpack/lintpack v0.5.2 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect github.com/go-stack/stack v1.8.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/go-toolsmith/astcast v1.0.0 // indirect github.com/go-toolsmith/astcast v1.0.0 // indirect
github.com/go-toolsmith/astcopy v1.0.0 // indirect github.com/go-toolsmith/astcopy v1.0.0 // indirect
github.com/go-toolsmith/astequal v1.0.0 // indirect github.com/go-toolsmith/astequal v1.0.0 // indirect
@ -104,7 +107,8 @@ require (
github.com/go-toolsmith/strparse v1.0.0 // indirect github.com/go-toolsmith/strparse v1.0.0 // indirect
github.com/go-toolsmith/typep v1.0.0 // indirect github.com/go-toolsmith/typep v1.0.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect github.com/gobwas/glob v0.2.3 // indirect
github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf // indirect github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf // indirect
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
@ -121,116 +125,108 @@ require (
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect
github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 // indirect github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 // indirect
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
github.com/google/btree v1.0.0 // indirect github.com/google/btree v1.0.1 // indirect
github.com/google/gopacket v1.1.19 // indirect github.com/google/gopacket v1.1.19 // indirect
github.com/google/uuid v1.1.2 // indirect github.com/google/pprof v0.0.0-20221203041831-ce31453925ec // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 // indirect github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huin/goupnp v1.0.0 // indirect github.com/huin/goupnp v1.0.3 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/ipfs/go-cid v0.0.7 // indirect github.com/ipfs/go-cid v0.3.2 // indirect
github.com/ipfs/go-datastore v0.4.5 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/ipfs/go-ipfs-util v0.0.2 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect
github.com/ipfs/go-ipns v0.0.2 // indirect github.com/ipfs/go-ipns v0.2.0 // indirect
github.com/ipfs/go-log v1.0.5 // indirect github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.1.3 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/ipld/go-ipld-prime v0.9.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect github.com/jmespath/go-jmespath v0.3.0 // indirect
github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 // indirect github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 // indirect
github.com/kisielk/gotool v1.0.0 // indirect github.com/kisielk/gotool v1.0.0 // indirect
github.com/klauspost/cpuid/v2 v2.0.4 // indirect github.com/klauspost/compress v1.15.12 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect github.com/klauspost/cpuid/v2 v2.2.1 // indirect
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d // indirect github.com/koron/go-ssdp v0.0.3 // indirect
github.com/kr/pretty v0.2.1 // indirect github.com/kr/pretty v0.3.0 // indirect
github.com/kr/text v0.1.0 // indirect github.com/kr/text v0.2.0 // indirect
github.com/libp2p/go-addr-util v0.1.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-buffer-pool v0.0.2 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-conn-security-multistream v0.2.1 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect
github.com/libp2p/go-eventbus v0.2.1 // indirect github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
github.com/libp2p/go-flow-metrics v0.0.3 // indirect github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052 // indirect github.com/libp2p/go-libp2p-record v0.2.0 // indirect
github.com/libp2p/go-libp2p-autonat v0.4.2 // indirect github.com/libp2p/go-msgio v0.2.0 // indirect
github.com/libp2p/go-libp2p-blankhost v0.2.0 // indirect github.com/libp2p/go-nat v0.1.0 // indirect
github.com/libp2p/go-libp2p-circuit v0.4.0 // indirect github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/libp2p/go-libp2p-kbucket v0.4.7 // indirect github.com/libp2p/go-openssl v0.1.0 // indirect
github.com/libp2p/go-libp2p-mplex v0.4.1 // indirect github.com/libp2p/go-reuseport v0.2.0 // indirect
github.com/libp2p/go-libp2p-nat v0.0.6 // indirect github.com/libp2p/go-yamux/v4 v4.0.0 // indirect
github.com/libp2p/go-libp2p-noise v0.2.0 // indirect github.com/lucas-clemente/quic-go v0.31.0 // indirect
github.com/libp2p/go-libp2p-peerstore v0.2.8 // indirect github.com/magiconair/properties v1.8.6 // indirect
github.com/libp2p/go-libp2p-pnet v0.2.0 // indirect github.com/marten-seemann/qtls-go1-18 v0.1.3 // indirect
github.com/libp2p/go-libp2p-record v0.1.3 // indirect github.com/marten-seemann/qtls-go1-19 v0.1.1 // indirect
github.com/libp2p/go-libp2p-swarm v0.5.3 // indirect
github.com/libp2p/go-libp2p-tls v0.1.3 // indirect
github.com/libp2p/go-libp2p-transport-upgrader v0.4.6 // indirect
github.com/libp2p/go-libp2p-yamux v0.5.4 // indirect
github.com/libp2p/go-maddr-filter v0.1.0 // indirect
github.com/libp2p/go-mplex v0.3.0 // indirect
github.com/libp2p/go-msgio v0.0.6 // indirect
github.com/libp2p/go-nat v0.0.5 // indirect
github.com/libp2p/go-netroute v0.1.6 // indirect
github.com/libp2p/go-openssl v0.0.7 // indirect
github.com/libp2p/go-reuseport v0.0.2 // indirect
github.com/libp2p/go-reuseport-transport v0.0.5 // indirect
github.com/libp2p/go-sockaddr v0.1.1 // indirect
github.com/libp2p/go-stream-muxer-multistream v0.3.0 // indirect
github.com/libp2p/go-tcp-transport v0.2.7 // indirect
github.com/libp2p/go-ws-transport v0.4.0 // indirect
github.com/libp2p/go-yamux/v2 v2.2.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // indirect github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // indirect
github.com/mattn/go-colorable v0.1.8 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-pointer v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/dns v1.1.41 // indirect github.com/miekg/dns v1.1.50 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.3.3 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect
github.com/mschoch/smat v0.2.0 // indirect github.com/mschoch/smat v0.2.0 // indirect
github.com/multiformats/go-base32 v0.0.3 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multibase v0.0.3 // indirect github.com/multiformats/go-multibase v0.1.1 // indirect
github.com/multiformats/go-multihash v0.0.15 // indirect github.com/multiformats/go-multicodec v0.7.0 // indirect
github.com/multiformats/go-multistream v0.2.2 // indirect github.com/multiformats/go-multihash v0.2.1 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect github.com/multiformats/go-multistream v0.3.3 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect
github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c // indirect github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c // indirect
github.com/onsi/ginkgo/v2 v2.5.1 // indirect
github.com/opencontainers/runtime-spec v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect
github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00 // indirect github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00 // indirect
github.com/pingcap/kvproto v0.0.0-20220106070556-3fa8fa04f898 // indirect github.com/pingcap/kvproto v0.0.0-20220106070556-3fa8fa04f898 // indirect
github.com/pingcap/log v0.0.0-20211215031037-e024ba4eb0ee // indirect github.com/pingcap/log v0.0.0-20211215031037-e024ba4eb0ee // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 // indirect
github.com/prometheus/common v0.26.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect github.com/prometheus/tsdb v0.7.1 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rogpeppe/go-internal v1.6.1 // indirect
github.com/securego/gosec v0.0.0-20191002120514-e680875ea14d // indirect github.com/securego/gosec v0.0.0-20191002120514-e680875ea14d // indirect
github.com/sirupsen/logrus v1.6.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sourcegraph/go-diff v0.5.1 // indirect github.com/sourcegraph/go-diff v0.5.1 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spf13/afero v1.1.2 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/cast v1.3.0 // indirect github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/jwalterweatherman v1.0.0 // indirect github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 // indirect github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 // indirect
github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 // indirect github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 // indirect
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 // indirect github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 // indirect
github.com/stretchr/objx v0.2.0 // indirect github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect github.com/subosito/gotenv v1.4.1 // indirect
github.com/tikv/pd/client v0.0.0-20220216070739-26c668271201 // indirect github.com/tikv/pd/client v0.0.0-20220216070739-26c668271201 // indirect
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e // indirect github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e // indirect
github.com/tommy-muehle/go-mnd v1.1.1 // indirect github.com/tommy-muehle/go-mnd v1.1.1 // indirect
@ -239,22 +235,22 @@ require (
github.com/ultraware/whitespace v0.0.4 // indirect github.com/ultraware/whitespace v0.0.4 // indirect
github.com/uudashr/gocognit v1.0.1 // indirect github.com/uudashr/gocognit v1.0.1 // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 // indirect github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 // indirect
go.opencensus.io v0.23.0 // indirect go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.9.0 // indirect go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.7.0 // indirect go.uber.org/dig v1.15.0 // indirect
golang.org/x/mod v0.4.2 // indirect go.uber.org/fx v1.18.2 // indirect
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect go.uber.org/multierr v1.8.0 // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect golang.org/x/mod v0.7.0 // indirect
golang.org/x/text v0.3.6 // indirect golang.org/x/term v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect golang.org/x/text v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect
gopkg.in/ini.v1 v1.51.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.0.1-2020.1.5 // indirect honnef.co/go/tools v0.0.1-2020.1.5 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f // indirect mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f // indirect

1141
go.sum

File diff suppressed because it is too large Load Diff

@ -22,7 +22,7 @@ import (
"github.com/harmony-one/harmony/shard" "github.com/harmony-one/harmony/shard"
staking "github.com/harmony-one/harmony/staking/types" staking "github.com/harmony-one/harmony/staking/types"
lru "github.com/hashicorp/golang-lru" lru "github.com/hashicorp/golang-lru"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/sync/singleflight" "golang.org/x/sync/singleflight"
) )

@ -4,7 +4,7 @@ import (
nodeconfig "github.com/harmony-one/harmony/internal/configs/node" nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
commonRPC "github.com/harmony-one/harmony/rpc/common" commonRPC "github.com/harmony-one/harmony/rpc/common"
"github.com/harmony-one/harmony/staking/network" "github.com/harmony-one/harmony/staking/network"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
) )
// GetCurrentUtilityMetrics .. // GetCurrentUtilityMetrics ..

@ -16,8 +16,8 @@ import (
"github.com/harmony-one/harmony/multibls" "github.com/harmony-one/harmony/multibls"
"github.com/harmony-one/harmony/shard" "github.com/harmony-one/harmony/shard"
"github.com/harmony-one/harmony/webhooks" "github.com/harmony-one/harmony/webhooks"
p2p_crypto "github.com/libp2p/go-libp2p-core/crypto" p2p_crypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

@ -17,7 +17,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
bls_core "github.com/harmony-one/bls/ffi/go/bls" bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/crypto/bls"
p2p_crypto "github.com/libp2p/go-libp2p-core/crypto" p2p_crypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

@ -5,7 +5,7 @@ import (
"os" "os"
"testing" "testing"
crypto "github.com/libp2p/go-libp2p-core/crypto" crypto "github.com/libp2p/go-libp2p/core/crypto"
) )
// Test for GenKeyP2P, noted the length of private key can be random // Test for GenKeyP2P, noted the length of private key can be random
@ -52,8 +52,8 @@ func TestSaveLoadPrivateKey(t *testing.T) {
if !crypto.KeyEqual(pk, pk1) { if !crypto.KeyEqual(pk, pk1) {
t.Errorf("loaded key is not right") t.Errorf("loaded key is not right")
b1, _ := pk.Bytes() b1, _ := pk.Raw()
b2, _ := pk1.Bytes() b2, _ := pk1.Raw()
t.Errorf("expecting pk: %v\n", b1) t.Errorf("expecting pk: %v\n", b1)
t.Errorf("got pk1: %v\n", b2) t.Errorf("got pk1: %v\n", b2)
} }

@ -10,7 +10,7 @@ import (
hmy_rpc "github.com/harmony-one/harmony/rpc" hmy_rpc "github.com/harmony-one/harmony/rpc"
rpc_common "github.com/harmony-one/harmony/rpc/common" rpc_common "github.com/harmony-one/harmony/rpc/common"
"github.com/harmony-one/harmony/rpc/filters" "github.com/harmony-one/harmony/rpc/filters"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
) )
// IsCurrentlyLeader exposes if node is currently the leader node // IsCurrentlyLeader exposes if node is currently the leader node

@ -26,8 +26,8 @@ import (
"github.com/harmony-one/abool" "github.com/harmony-one/abool"
bls_core "github.com/harmony-one/bls/ffi/go/bls" bls_core "github.com/harmony-one/bls/ffi/go/bls"
lru "github.com/hashicorp/golang-lru" lru "github.com/hashicorp/golang-lru"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer"
libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub" libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub"
libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/rcrowley/go-metrics" "github.com/rcrowley/go-metrics"

@ -125,7 +125,7 @@ func (node *Node) stakingMessageHandler(msgPayload []byte) {
switch txMessageType { switch txMessageType {
case proto_node.Send: case proto_node.Send:
txs := staking.StakingTransactions{} txs := staking.StakingTransactions{}
err := rlp.Decode(bytes.NewReader(msgPayload[1:]), &txs) // skip the Send messge type err := rlp.Decode(bytes.NewReader(msgPayload[1:]), &txs) // skip the Send message type
if err != nil { if err != nil {
utils.Logger().Error(). utils.Logger().Error().
Err(err). Err(err).

@ -5,11 +5,11 @@ import (
"time" "time"
"github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/internal/utils"
"github.com/libp2p/go-libp2p-core/discovery"
libp2p_host "github.com/libp2p/go-libp2p-core/host"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer"
libp2p_dis "github.com/libp2p/go-libp2p-discovery"
libp2p_dht "github.com/libp2p/go-libp2p-kad-dht" libp2p_dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p/core/discovery"
libp2p_host "github.com/libp2p/go-libp2p/core/host"
libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
libp2p_dis "github.com/libp2p/go-libp2p/p2p/discovery/routing"
"github.com/rs/zerolog" "github.com/rs/zerolog"
) )

@ -3,14 +3,13 @@ package discovery
// TODO: test this module // TODO: test this module
import ( import (
"context"
"testing" "testing"
"github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p"
) )
func TestNewDHTDiscovery(t *testing.T) { func TestNewDHTDiscovery(t *testing.T) {
host, err := libp2p.New(context.Background()) host, err := libp2p.New()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

@ -1,11 +1,11 @@
package p2p package p2p
import ( import (
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/control"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
libp2p_dht "github.com/libp2p/go-libp2p-kad-dht" libp2p_dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p/core/connmgr"
"github.com/libp2p/go-libp2p/core/control"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
) )

@ -12,13 +12,13 @@ import (
"time" "time"
"github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p"
libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto"
libp2p_host "github.com/libp2p/go-libp2p-core/host"
libp2p_network "github.com/libp2p/go-libp2p-core/network"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer"
libp2p_peerstore "github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/protocol"
libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub" libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub"
libp2p_crypto "github.com/libp2p/go-libp2p/core/crypto"
libp2p_host "github.com/libp2p/go-libp2p/core/host"
libp2p_network "github.com/libp2p/go-libp2p/core/network"
libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
libp2p_peerstore "github.com/libp2p/go-libp2p/core/peerstore"
"github.com/libp2p/go-libp2p/core/protocol"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/rs/zerolog" "github.com/rs/zerolog"
@ -117,7 +117,7 @@ func NewHost(cfg HostConfig) (Host, error) {
} }
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
p2pHost, err := libp2p.New(ctx, p2pHost, err := libp2p.New(
libp2p.ListenAddrs(listenAddr), libp2p.ListenAddrs(listenAddr),
libp2p.Identity(key), libp2p.Identity(key),
libp2p.EnableNATService(), libp2p.EnableNATService(),

@ -1,9 +1,9 @@
//package p2p // package p2p
package p2p package p2p
import ( import (
eth_metrics "github.com/ethereum/go-ethereum/metrics" eth_metrics "github.com/ethereum/go-ethereum/metrics"
"github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p/core/metrics"
) )
const ( const (

@ -6,7 +6,7 @@ import (
"sync/atomic" "sync/atomic"
"github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/internal/utils"
libp2p_network "github.com/libp2p/go-libp2p-core/network" libp2p_network "github.com/libp2p/go-libp2p/core/network"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

@ -7,25 +7,25 @@ import (
"time" "time"
"github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p"
ic "github.com/libp2p/go-libp2p-core/crypto" ic "github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p-core/network" libp2p_network "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
type ConnectCallback func(net network.Network, conn network.Conn) error type ConnectCallback func(net libp2p_network.Network, conn libp2p_network.Conn) error
type DisconnectCallback func(conn network.Conn) error type DisconnectCallback func(conn libp2p_network.Conn) error
type fakeHost struct { type fakeHost struct {
onConnections []ConnectCallback onConnections []ConnectCallback
onDisconnects []DisconnectCallback onDisconnects []DisconnectCallback
} }
func (fh *fakeHost) Listen(network.Network, ma.Multiaddr) {} func (fh *fakeHost) Listen(libp2p_network.Network, ma.Multiaddr) {}
func (fh *fakeHost) ListenClose(network.Network, ma.Multiaddr) {} func (fh *fakeHost) ListenClose(libp2p_network.Network, ma.Multiaddr) {}
func (fh *fakeHost) Connected(net network.Network, conn network.Conn) { func (fh *fakeHost) Connected(net libp2p_network.Network, conn libp2p_network.Conn) {
for _, function := range fh.onConnections { for _, function := range fh.onConnections {
if err := function(net, conn); err != nil { if err := function(net, conn); err != nil {
fmt.Println("failed on peer connected callback") fmt.Println("failed on peer connected callback")
@ -33,7 +33,7 @@ func (fh *fakeHost) Connected(net network.Network, conn network.Conn) {
} }
} }
func (fh *fakeHost) Disconnected(net network.Network, conn network.Conn) { func (fh *fakeHost) Disconnected(net libp2p_network.Network, conn libp2p_network.Conn) {
for _, function := range fh.onDisconnects { for _, function := range fh.onDisconnects {
if err := function(conn); err != nil { if err := function(conn); err != nil {
fmt.Println("failed on peer disconnected callback") fmt.Println("failed on peer disconnected callback")
@ -41,8 +41,8 @@ func (fh *fakeHost) Disconnected(net network.Network, conn network.Conn) {
} }
} }
func (mh *fakeHost) OpenedStream(network.Network, network.Stream) {} func (mh *fakeHost) OpenedStream(libp2p_network.Network, libp2p_network.Stream) {}
func (mh *fakeHost) ClosedStream(network.Network, network.Stream) {} func (mh *fakeHost) ClosedStream(libp2p_network.Network, libp2p_network.Stream) {}
func (mh *fakeHost) SetConnectCallback(callback ConnectCallback) { func (mh *fakeHost) SetConnectCallback(callback ConnectCallback) {
mh.onConnections = append(mh.onConnections, callback) mh.onConnections = append(mh.onConnections, callback)
} }
@ -135,7 +135,7 @@ func newPeer(port int) (host.Host, error) {
} }
listenAddr := fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", port) listenAddr := fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", port)
host, err := libp2p.New(context.Background(), libp2p.ListenAddrStrings(listenAddr), libp2p.DisableRelay(), libp2p.Identity(priv), libp2p.NoSecurity) host, err := libp2p.New(libp2p.ListenAddrStrings(listenAddr), libp2p.DisableRelay(), libp2p.Identity(priv), libp2p.NoSecurity)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -145,20 +145,25 @@ func newPeer(port int) (host.Host, error) {
type fakeConn struct{} type fakeConn struct{}
func (conn *fakeConn) Close() error { return nil } func (conn *fakeConn) ID() string { return "" }
func (conn *fakeConn) LocalPeer() peer.ID { return "" } func (conn *fakeConn) NewStream(context.Context) (libp2p_network.Stream, error) { return nil, nil }
func (conn *fakeConn) LocalPrivateKey() ic.PrivKey { return nil } func (conn *fakeConn) GetStreams() []libp2p_network.Stream { return nil }
func (conn *fakeConn) RemotePeer() peer.ID { return "" } func (conn *fakeConn) Close() error { return nil }
func (conn *fakeConn) RemotePublicKey() ic.PubKey { return nil } func (conn *fakeConn) LocalPeer() peer.ID { return "" }
func (conn *fakeConn) LocalPrivateKey() ic.PrivKey { return nil }
func (conn *fakeConn) RemotePeer() peer.ID { return "" }
func (conn *fakeConn) RemotePublicKey() ic.PubKey { return nil }
func (conn *fakeConn) ConnState() libp2p_network.ConnectionState {
return libp2p_network.ConnectionState{}
}
func (conn *fakeConn) LocalMultiaddr() ma.Multiaddr { return nil } func (conn *fakeConn) LocalMultiaddr() ma.Multiaddr { return nil }
func (conn *fakeConn) RemoteMultiaddr() ma.Multiaddr { func (conn *fakeConn) RemoteMultiaddr() ma.Multiaddr {
addr, _ := ma.NewMultiaddr("/ip6/fe80::7802:31ff:fee9:c093/tcp/50550") addr, _ := ma.NewMultiaddr("/ip6/fe80::7802:31ff:fee9:c093/tcp/50550")
return addr return addr
} }
func (conn *fakeConn) ID() string { return "" } func (conn *fakeConn) Stat() libp2p_network.ConnStats { return libp2p_network.ConnStats{} }
func (conn *fakeConn) NewStream(context.Context) (network.Stream, error) { return nil, nil } func (conn *fakeConn) Scope() libp2p_network.ConnScope { return nil }
func (conn *fakeConn) GetStreams() []network.Stream { return nil }
func (conn *fakeConn) Stat() network.Stat { return network.Stat{} }
func TestGetRemoteIP(t *testing.T) { func TestGetRemoteIP(t *testing.T) {
ip, err := getRemoteIP(&fakeConn{}) ip, err := getRemoteIP(&fakeConn{})
assert.Nil(t, err) assert.Nil(t, err)

@ -4,7 +4,7 @@ import (
"container/list" "container/list"
"time" "time"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
"github.com/whyrusleeping/timecache" "github.com/whyrusleeping/timecache"
) )

@ -6,9 +6,9 @@ import (
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
sttypes "github.com/harmony-one/harmony/p2p/stream/types" sttypes "github.com/harmony-one/harmony/p2p/stream/types"
p2ptypes "github.com/harmony-one/harmony/p2p/types" p2ptypes "github.com/harmony-one/harmony/p2p/types"
"github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p/core/network"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer" libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p-core/protocol" "github.com/libp2p/go-libp2p/core/protocol"
) )
// StreamManager is the interface for streamManager // StreamManager is the interface for streamManager

@ -8,9 +8,9 @@ import (
"sync/atomic" "sync/atomic"
sttypes "github.com/harmony-one/harmony/p2p/stream/types" sttypes "github.com/harmony-one/harmony/p2p/stream/types"
"github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p/core/network"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer" libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p-core/protocol" "github.com/libp2p/go-libp2p/core/protocol"
) )
var _ StreamManager = &streamManager{} var _ StreamManager = &streamManager{}

@ -10,9 +10,9 @@ import (
"github.com/harmony-one/abool" "github.com/harmony-one/abool"
"github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/internal/utils"
sttypes "github.com/harmony-one/harmony/p2p/stream/types" sttypes "github.com/harmony-one/harmony/p2p/stream/types"
"github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p/core/network"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer" libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p-core/protocol" "github.com/libp2p/go-libp2p/core/protocol"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/rs/zerolog" "github.com/rs/zerolog"

@ -9,7 +9,7 @@ import (
"time" "time"
sttypes "github.com/harmony-one/harmony/p2p/stream/types" sttypes "github.com/harmony-one/harmony/p2p/stream/types"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer" libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
) )
const ( const (

@ -16,8 +16,8 @@ import (
"github.com/harmony-one/harmony/p2p/stream/common/streammanager" "github.com/harmony-one/harmony/p2p/stream/common/streammanager"
sttypes "github.com/harmony-one/harmony/p2p/stream/types" sttypes "github.com/harmony-one/harmony/p2p/stream/types"
"github.com/hashicorp/go-version" "github.com/hashicorp/go-version"
libp2p_host "github.com/libp2p/go-libp2p-core/host" libp2p_host "github.com/libp2p/go-libp2p/core/host"
libp2p_network "github.com/libp2p/go-libp2p-core/network" libp2p_network "github.com/libp2p/go-libp2p/core/network"
"github.com/rs/zerolog" "github.com/rs/zerolog"
) )

@ -6,8 +6,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/libp2p/go-libp2p-core/discovery" "github.com/libp2p/go-libp2p/core/discovery"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer" libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
) )
func TestProtocol_Match(t *testing.T) { func TestProtocol_Match(t *testing.T) {

@ -12,7 +12,7 @@ import (
protobuf "github.com/golang/protobuf/proto" protobuf "github.com/golang/protobuf/proto"
syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message" syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message"
sttypes "github.com/harmony-one/harmony/p2p/stream/types" sttypes "github.com/harmony-one/harmony/p2p/stream/types"
libp2p_network "github.com/libp2p/go-libp2p-core/network" libp2p_network "github.com/libp2p/go-libp2p/core/network"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/rs/zerolog" "github.com/rs/zerolog"
) )

@ -10,10 +10,10 @@ import (
protobuf "github.com/golang/protobuf/proto" protobuf "github.com/golang/protobuf/proto"
syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message" syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message"
sttypes "github.com/harmony-one/harmony/p2p/stream/types" sttypes "github.com/harmony-one/harmony/p2p/stream/types"
ic "github.com/libp2p/go-libp2p-core/crypto" ic "github.com/libp2p/go-libp2p/core/crypto"
libp2p_network "github.com/libp2p/go-libp2p-core/network" libp2p_network "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p-core/protocol" "github.com/libp2p/go-libp2p/core/protocol"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
) )
@ -195,18 +195,19 @@ func (st *testP2PStream) receiveBytes(b []byte) (n int, err error) {
return return
} }
func (st *testP2PStream) Close() error { return nil } func (st *testP2PStream) Close() error { return nil }
func (st *testP2PStream) CloseRead() error { return nil } func (st *testP2PStream) CloseRead() error { return nil }
func (st *testP2PStream) CloseWrite() error { return nil } func (st *testP2PStream) CloseWrite() error { return nil }
func (st *testP2PStream) Reset() error { return nil } func (st *testP2PStream) Reset() error { return nil }
func (st *testP2PStream) SetDeadline(time.Time) error { return nil } func (st *testP2PStream) SetDeadline(time.Time) error { return nil }
func (st *testP2PStream) SetReadDeadline(time.Time) error { return nil } func (st *testP2PStream) SetReadDeadline(time.Time) error { return nil }
func (st *testP2PStream) SetWriteDeadline(time.Time) error { return nil } func (st *testP2PStream) SetWriteDeadline(time.Time) error { return nil }
func (st *testP2PStream) ID() string { return "" } func (st *testP2PStream) ID() string { return "" }
func (st *testP2PStream) Protocol() protocol.ID { return "" } func (st *testP2PStream) Protocol() protocol.ID { return "" }
func (st *testP2PStream) SetProtocol(protocol.ID) {} func (st *testP2PStream) SetProtocol(protocol.ID) error { return nil }
func (st *testP2PStream) Stat() libp2p_network.Stat { return libp2p_network.Stat{} } func (st *testP2PStream) Stat() libp2p_network.Stats { return libp2p_network.Stats{} }
func (st *testP2PStream) Conn() libp2p_network.Conn { return &fakeConn{} } func (st *testP2PStream) Conn() libp2p_network.Conn { return &fakeConn{} }
func (st *testP2PStream) Scope() libp2p_network.StreamScope { return nil }
type testRemoteBaseStream struct { type testRemoteBaseStream struct {
base *sttypes.BaseStream base *sttypes.BaseStream
@ -229,14 +230,18 @@ func (st *testRemoteBaseStream) WriteBytes(b []byte) error {
type fakeConn struct{} type fakeConn struct{}
func (conn *fakeConn) ID() string { return "" }
func (conn *fakeConn) NewStream(context.Context) (libp2p_network.Stream, error) { return nil, nil }
func (conn *fakeConn) GetStreams() []libp2p_network.Stream { return nil }
func (conn *fakeConn) Close() error { return nil } func (conn *fakeConn) Close() error { return nil }
func (conn *fakeConn) LocalPeer() peer.ID { return "" } func (conn *fakeConn) LocalPeer() peer.ID { return "" }
func (conn *fakeConn) LocalPrivateKey() ic.PrivKey { return nil } func (conn *fakeConn) LocalPrivateKey() ic.PrivKey { return nil }
func (conn *fakeConn) RemotePeer() peer.ID { return "" } func (conn *fakeConn) RemotePeer() peer.ID { return "" }
func (conn *fakeConn) RemotePublicKey() ic.PubKey { return nil } func (conn *fakeConn) RemotePublicKey() ic.PubKey { return nil }
func (conn *fakeConn) LocalMultiaddr() ma.Multiaddr { return nil } func (conn *fakeConn) ConnState() libp2p_network.ConnectionState {
func (conn *fakeConn) RemoteMultiaddr() ma.Multiaddr { return nil } return libp2p_network.ConnectionState{}
func (conn *fakeConn) ID() string { return "" } }
func (conn *fakeConn) NewStream(context.Context) (libp2p_network.Stream, error) { return nil, nil } func (conn *fakeConn) LocalMultiaddr() ma.Multiaddr { return nil }
func (conn *fakeConn) GetStreams() []libp2p_network.Stream { return nil } func (conn *fakeConn) RemoteMultiaddr() ma.Multiaddr { return nil }
func (conn *fakeConn) Stat() libp2p_network.Stat { return libp2p_network.Stat{} } func (conn *fakeConn) Stat() libp2p_network.ConnStats { return libp2p_network.ConnStats{} }
func (conn *fakeConn) Scope() libp2p_network.ConnScope { return nil }

@ -3,7 +3,7 @@ package sttypes
import ( import (
p2ptypes "github.com/harmony-one/harmony/p2p/types" p2ptypes "github.com/harmony-one/harmony/p2p/types"
"github.com/hashicorp/go-version" "github.com/hashicorp/go-version"
libp2p_network "github.com/libp2p/go-libp2p-core/network" libp2p_network "github.com/libp2p/go-libp2p/core/network"
) )
// Protocol is the interface of protocol to be registered to libp2p. // Protocol is the interface of protocol to be registered to libp2p.

@ -6,7 +6,7 @@ import (
"io" "io"
"sync" "sync"
libp2p_network "github.com/libp2p/go-libp2p-core/network" libp2p_network "github.com/libp2p/go-libp2p/core/network"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

@ -11,7 +11,7 @@ import (
nodeconfig "github.com/harmony-one/harmony/internal/configs/node" nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
"github.com/hashicorp/go-version" "github.com/hashicorp/go-version"
libp2p_proto "github.com/libp2p/go-libp2p-core/protocol" libp2p_proto "github.com/libp2p/go-libp2p/core/protocol"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

@ -6,7 +6,7 @@ import (
"strings" "strings"
"time" "time"
libp2p_peer "github.com/libp2p/go-libp2p-core/peer" libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
madns "github.com/multiformats/go-multiaddr-dns" madns "github.com/multiformats/go-multiaddr-dns"
) )

@ -1,7 +1,7 @@
package p2ptypes package p2ptypes
import ( import (
libp2p_peer "github.com/libp2p/go-libp2p-core/peer" libp2p_peer "github.com/libp2p/go-libp2p/core/peer"
) )
// PeerID is the alias for libp2p peer ID // PeerID is the alias for libp2p peer ID

@ -4,7 +4,7 @@ import (
"reflect" "reflect"
"testing" "testing"
libp2p_network "github.com/libp2p/go-libp2p-core/network" libp2p_network "github.com/libp2p/go-libp2p/core/network"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

@ -9,7 +9,7 @@ import (
"github.com/coinbase/rosetta-sdk-go/server" "github.com/coinbase/rosetta-sdk-go/server"
"github.com/coinbase/rosetta-sdk-go/types" "github.com/coinbase/rosetta-sdk-go/types"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
"github.com/harmony-one/harmony/block" "github.com/harmony-one/harmony/block"
"github.com/harmony-one/harmony/eth/rpc" "github.com/harmony-one/harmony/eth/rpc"

@ -9,7 +9,7 @@ import (
"github.com/coinbase/rosetta-sdk-go/types" "github.com/coinbase/rosetta-sdk-go/types"
"github.com/harmony-one/harmony/rosetta/common" "github.com/harmony-one/harmony/rosetta/common"
commonRPC "github.com/harmony-one/harmony/rpc/common" commonRPC "github.com/harmony-one/harmony/rpc/common"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
) )
func TestErrors(t *testing.T) { func TestErrors(t *testing.T) {

@ -7,7 +7,7 @@ import (
nodeconfig "github.com/harmony-one/harmony/internal/configs/node" nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
"github.com/harmony-one/harmony/internal/params" "github.com/harmony-one/harmony/internal/params"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p/core/peer"
) )
// BlockArgs is struct to include optional block formatting params. // BlockArgs is struct to include optional block formatting params.

@ -5,7 +5,7 @@ import (
harmony_bls "github.com/harmony-one/harmony/crypto/bls" harmony_bls "github.com/harmony-one/harmony/crypto/bls"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node" nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
"github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p"
libp2p_crypto "github.com/libp2p/go-libp2p-crypto" libp2p_crypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

Loading…
Cancel
Save