From cbb62fd89afc0f71f2c2d441cba027eb4fc38f8b Mon Sep 17 00:00:00 2001 From: Konstantin <355847+Frozen@users.noreply.github.com> Date: Thu, 7 Mar 2024 10:16:11 -0500 Subject: [PATCH] Updated protobuf from outdated github.com/golang/protobuf to google.golang.org/protobuf. (#4636) --- consensus/checks.go | 2 +- consensus/consensus_service.go | 13 ++++----- consensus/construct.go | 6 ++-- node/node.go | 35 +++++++++++------------- p2p/stream/protocols/sync/chain_test.go | 2 +- p2p/stream/protocols/sync/client.go | 2 +- p2p/stream/protocols/sync/stream.go | 7 ++--- p2p/stream/protocols/sync/stream_test.go | 2 +- p2p/stream/protocols/sync/utils.go | 2 +- test/chain/reward/main.go | 18 +++++------- 10 files changed, 39 insertions(+), 50 deletions(-) diff --git a/consensus/checks.go b/consensus/checks.go index 32f59fb93..b4e1d1207 100644 --- a/consensus/checks.go +++ b/consensus/checks.go @@ -4,13 +4,13 @@ import ( "bytes" "encoding/binary" - protobuf "github.com/golang/protobuf/proto" libbls "github.com/harmony-one/bls/ffi/go/bls" msg_pb "github.com/harmony-one/harmony/api/proto/message" "github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/crypto/hash" "github.com/pkg/errors" + protobuf "google.golang.org/protobuf/proto" ) // MaxBlockNumDiff limits the received block number to only 100 further from the current block number diff --git a/consensus/consensus_service.go b/consensus/consensus_service.go index 48324c478..1ba1f6e2f 100644 --- a/consensus/consensus_service.go +++ b/consensus/consensus_service.go @@ -5,27 +5,26 @@ import ( "sync/atomic" "time" - "github.com/harmony-one/harmony/core" - "github.com/harmony-one/harmony/core/types" - "github.com/harmony-one/harmony/crypto/bls" - "github.com/harmony-one/harmony/multibls" - "github.com/harmony-one/harmony/webhooks" - "github.com/ethereum/go-ethereum/common" - protobuf "github.com/golang/protobuf/proto" bls_core "github.com/harmony-one/bls/ffi/go/bls" msg_pb "github.com/harmony-one/harmony/api/proto/message" consensus_engine "github.com/harmony-one/harmony/consensus/engine" "github.com/harmony-one/harmony/consensus/quorum" "github.com/harmony-one/harmony/consensus/signature" + "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/core/types" + "github.com/harmony-one/harmony/crypto/bls" bls_cosi "github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/crypto/hash" "github.com/harmony-one/harmony/internal/chain" "github.com/harmony-one/harmony/internal/utils" + "github.com/harmony-one/harmony/multibls" "github.com/harmony-one/harmony/shard" "github.com/harmony-one/harmony/shard/committee" + "github.com/harmony-one/harmony/webhooks" "github.com/pkg/errors" "github.com/rs/zerolog" + protobuf "google.golang.org/protobuf/proto" ) // WaitForNewRandomness listens to the RndChannel to receive new VDF randomness. diff --git a/consensus/construct.go b/consensus/construct.go index 48291a364..01d02a4d4 100644 --- a/consensus/construct.go +++ b/consensus/construct.go @@ -4,15 +4,13 @@ import ( "bytes" "errors" - protobuf "github.com/golang/protobuf/proto" - - "github.com/harmony-one/harmony/crypto/bls" - bls_core "github.com/harmony-one/bls/ffi/go/bls" "github.com/harmony-one/harmony/api/proto" msg_pb "github.com/harmony-one/harmony/api/proto/message" "github.com/harmony-one/harmony/consensus/quorum" + "github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/internal/utils" + protobuf "google.golang.org/protobuf/proto" ) // NetworkMessage is a message intended to be diff --git a/node/node.go b/node/node.go index f80c502a0..d8a8e8e6f 100644 --- a/node/node.go +++ b/node/node.go @@ -11,28 +11,10 @@ import ( "sync" "time" - "github.com/harmony-one/harmony/internal/registry" - "github.com/harmony-one/harmony/internal/shardchain/tikv_manage" - "github.com/harmony-one/harmony/internal/tikv" - "github.com/harmony-one/harmony/internal/tikv/redis_helper" - "github.com/harmony-one/harmony/internal/utils/lrucache" - - "github.com/ethereum/go-ethereum/rlp" - harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony" - "github.com/harmony-one/harmony/internal/utils/crosslinks" - "github.com/ethereum/go-ethereum/common" - protobuf "github.com/golang/protobuf/proto" + "github.com/ethereum/go-ethereum/rlp" "github.com/harmony-one/abool" bls_core "github.com/harmony-one/bls/ffi/go/bls" - lru "github.com/hashicorp/golang-lru" - libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub" - libp2p_peer "github.com/libp2p/go-libp2p/core/peer" - "github.com/pkg/errors" - "github.com/prometheus/client_golang/prometheus" - "github.com/rcrowley/go-metrics" - "golang.org/x/sync/semaphore" - "github.com/harmony-one/harmony/api/proto" msg_pb "github.com/harmony-one/harmony/api/proto/message" proto_node "github.com/harmony-one/harmony/api/proto/node" @@ -46,9 +28,16 @@ import ( "github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/crypto/bls" common2 "github.com/harmony-one/harmony/internal/common" + harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" "github.com/harmony-one/harmony/internal/params" + "github.com/harmony-one/harmony/internal/registry" + "github.com/harmony-one/harmony/internal/shardchain/tikv_manage" + "github.com/harmony-one/harmony/internal/tikv" + "github.com/harmony-one/harmony/internal/tikv/redis_helper" "github.com/harmony-one/harmony/internal/utils" + "github.com/harmony-one/harmony/internal/utils/crosslinks" + "github.com/harmony-one/harmony/internal/utils/lrucache" "github.com/harmony-one/harmony/node/worker" "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/shard" @@ -56,6 +45,14 @@ import ( "github.com/harmony-one/harmony/staking/slash" staking "github.com/harmony-one/harmony/staking/types" "github.com/harmony-one/harmony/webhooks" + lru "github.com/hashicorp/golang-lru" + libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub" + libp2p_peer "github.com/libp2p/go-libp2p/core/peer" + "github.com/pkg/errors" + "github.com/prometheus/client_golang/prometheus" + "github.com/rcrowley/go-metrics" + "golang.org/x/sync/semaphore" + protobuf "google.golang.org/protobuf/proto" ) const ( diff --git a/p2p/stream/protocols/sync/chain_test.go b/p2p/stream/protocols/sync/chain_test.go index 414492054..eb153023c 100644 --- a/p2p/stream/protocols/sync/chain_test.go +++ b/p2p/stream/protocols/sync/chain_test.go @@ -11,11 +11,11 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/rlp" - protobuf "github.com/golang/protobuf/proto" "github.com/harmony-one/harmony/block" "github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message" syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message" + protobuf "google.golang.org/protobuf/proto" ) type testChainHelper struct{} diff --git a/p2p/stream/protocols/sync/client.go b/p2p/stream/protocols/sync/client.go index 45707e119..9ae9d5c8f 100644 --- a/p2p/stream/protocols/sync/client.go +++ b/p2p/stream/protocols/sync/client.go @@ -8,12 +8,12 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/rlp" - protobuf "github.com/golang/protobuf/proto" "github.com/harmony-one/harmony/core/types" "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" "github.com/pkg/errors" + protobuf "google.golang.org/protobuf/proto" ) // GetBlocksByNumber do getBlocksByNumberRequest through sync stream protocol. diff --git a/p2p/stream/protocols/sync/stream.go b/p2p/stream/protocols/sync/stream.go index 3077a8a13..2f2468404 100644 --- a/p2p/stream/protocols/sync/stream.go +++ b/p2p/stream/protocols/sync/stream.go @@ -5,17 +5,16 @@ import ( "sync/atomic" "time" - "github.com/prometheus/client_golang/prometheus" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/rlp" - protobuf "github.com/golang/protobuf/proto" "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" libp2p_network "github.com/libp2p/go-libp2p/core/network" "github.com/pkg/errors" + "github.com/prometheus/client_golang/prometheus" "github.com/rs/zerolog" + protobuf "google.golang.org/protobuf/proto" ) // syncStream is the structure for a stream running sync protocol. @@ -84,7 +83,7 @@ func (st *syncStream) readMsgLoop() { func (st *syncStream) deliverMsg(msg protobuf.Message) { syncMsg := msg.(*syncpb.Message) if syncMsg == nil { - st.logger.Info().Str("message", msg.String()).Msg("received unexpected sync message") + st.logger.Info().Interface("message", msg).Msg("received unexpected sync message") return } if req := syncMsg.GetReq(); req != nil { diff --git a/p2p/stream/protocols/sync/stream_test.go b/p2p/stream/protocols/sync/stream_test.go index 3b538c14b..f2e546289 100644 --- a/p2p/stream/protocols/sync/stream_test.go +++ b/p2p/stream/protocols/sync/stream_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/ethereum/go-ethereum/common" - protobuf "github.com/golang/protobuf/proto" syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message" sttypes "github.com/harmony-one/harmony/p2p/stream/types" ic "github.com/libp2p/go-libp2p/core/crypto" @@ -15,6 +14,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/protocol" ma "github.com/multiformats/go-multiaddr" + protobuf "google.golang.org/protobuf/proto" ) var _ sttypes.Protocol = &Protocol{} diff --git a/p2p/stream/protocols/sync/utils.go b/p2p/stream/protocols/sync/utils.go index da781c23f..d4ca22429 100644 --- a/p2p/stream/protocols/sync/utils.go +++ b/p2p/stream/protocols/sync/utils.go @@ -3,10 +3,10 @@ package sync import ( "fmt" - protobuf "github.com/golang/protobuf/proto" "github.com/harmony-one/harmony/p2p/stream/common/requestmanager" syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message" "github.com/pkg/errors" + protobuf "google.golang.org/protobuf/proto" ) var ( diff --git a/test/chain/reward/main.go b/test/chain/reward/main.go index 17be3b271..aee4c4ed0 100644 --- a/test/chain/reward/main.go +++ b/test/chain/reward/main.go @@ -6,28 +6,24 @@ import ( "math/rand" "time" - "github.com/harmony-one/harmony/core/rawdb" - - msg_pb "github.com/harmony-one/harmony/api/proto/message" - "github.com/harmony-one/harmony/crypto/bls" - - blockfactory "github.com/harmony-one/harmony/block/factory" - "github.com/harmony-one/harmony/internal/params" - "github.com/harmony-one/harmony/internal/utils" - common2 "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" bls_core "github.com/harmony-one/bls/ffi/go/bls" + msg_pb "github.com/harmony-one/harmony/api/proto/message" + blockfactory "github.com/harmony-one/harmony/block/factory" "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/core/rawdb" "github.com/harmony-one/harmony/core/state" "github.com/harmony-one/harmony/core/vm" + "github.com/harmony-one/harmony/crypto/bls" "github.com/harmony-one/harmony/crypto/hash" "github.com/harmony-one/harmony/internal/chain" "github.com/harmony-one/harmony/internal/common" - - protobuf "github.com/golang/protobuf/proto" + "github.com/harmony-one/harmony/internal/params" + "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/numeric" staking "github.com/harmony-one/harmony/staking/types" + protobuf "google.golang.org/protobuf/proto" ) var (