From 99bdb398751946d2be8fddaf65f34ec644456b9b Mon Sep 17 00:00:00 2001 From: ak Date: Tue, 1 Jan 2019 17:32:36 -0800 Subject: [PATCH] proto files --- {proto => api/proto}/bcconn/bcconn.go | 0 {proto => api/proto}/bcconn/bcconn_test.go | 0 {proto => api/proto}/common.go | 0 {proto => api/proto}/identity/identity.go | 2 +- {proto => api/proto}/node/node.go | 2 +- {proto => api/proto}/node/pingpong.go | 2 +- {proto => api/proto}/node/pingpong_test.go | 2 +- client/txgen/main.go | 2 +- client/wallet/main.go | 2 +- consensus/consensus.go | 2 +- consensus/consensus_leader_msg.go | 3 ++- consensus/consensus_validator_msg.go | 2 +- internal/beaconchain/libs/beaconchain.go | 4 ++-- internal/beaconchain/libs/beaconchain_handler.go | 4 ++-- internal/beaconchain/rpc/server.go | 2 +- internal/newnode/newnode.go | 4 ++-- internal/newnode/newnode_handler.go | 4 ++-- node/node.go | 2 +- node/node_handler.go | 9 +++++---- node/node_test.go | 2 +- 20 files changed, 26 insertions(+), 24 deletions(-) rename {proto => api/proto}/bcconn/bcconn.go (100%) rename {proto => api/proto}/bcconn/bcconn_test.go (100%) rename {proto => api/proto}/common.go (100%) rename {proto => api/proto}/identity/identity.go (97%) rename {proto => api/proto}/node/node.go (98%) rename {proto => api/proto}/node/pingpong.go (99%) rename {proto => api/proto}/node/pingpong_test.go (98%) diff --git a/proto/bcconn/bcconn.go b/api/proto/bcconn/bcconn.go similarity index 100% rename from proto/bcconn/bcconn.go rename to api/proto/bcconn/bcconn.go diff --git a/proto/bcconn/bcconn_test.go b/api/proto/bcconn/bcconn_test.go similarity index 100% rename from proto/bcconn/bcconn_test.go rename to api/proto/bcconn/bcconn_test.go diff --git a/proto/common.go b/api/proto/common.go similarity index 100% rename from proto/common.go rename to api/proto/common.go diff --git a/proto/identity/identity.go b/api/proto/identity/identity.go similarity index 97% rename from proto/identity/identity.go rename to api/proto/identity/identity.go index cafba9cc3..4895c5e63 100644 --- a/proto/identity/identity.go +++ b/api/proto/identity/identity.go @@ -4,7 +4,7 @@ import ( "bytes" "errors" - "github.com/harmony-one/harmony/proto" + "github.com/harmony-one/harmony/api/proto" ) // IdentityMessageTypeBytes is the number of bytes consensus message type occupies diff --git a/proto/node/node.go b/api/proto/node/node.go similarity index 98% rename from proto/node/node.go rename to api/proto/node/node.go index d05eb6183..d855edecd 100644 --- a/proto/node/node.go +++ b/api/proto/node/node.go @@ -8,8 +8,8 @@ import ( "github.com/ethereum/go-ethereum/rlp" "github.com/harmony-one/harmony/core/types" + "github.com/harmony-one/harmony/api/proto" "github.com/harmony-one/harmony/p2p" - "github.com/harmony-one/harmony/proto" ) // MessageType is to indicate the specific type of message under Node category diff --git a/proto/node/pingpong.go b/api/proto/node/pingpong.go similarity index 99% rename from proto/node/pingpong.go rename to api/proto/node/pingpong.go index 6285a8f43..9fa45c093 100644 --- a/proto/node/pingpong.go +++ b/api/proto/node/pingpong.go @@ -17,8 +17,8 @@ import ( "log" "github.com/dedis/kyber" + "github.com/harmony-one/harmony/api/proto" "github.com/harmony-one/harmony/p2p" - "github.com/harmony-one/harmony/proto" ) // RoleType defines the role of the node diff --git a/proto/node/pingpong_test.go b/api/proto/node/pingpong_test.go similarity index 98% rename from proto/node/pingpong_test.go rename to api/proto/node/pingpong_test.go index 7f42446d7..017756308 100644 --- a/proto/node/pingpong_test.go +++ b/api/proto/node/pingpong_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/dedis/kyber" + "github.com/harmony-one/harmony/api/proto" "github.com/harmony-one/harmony/crypto" "github.com/harmony-one/harmony/crypto/pki" "github.com/harmony-one/harmony/p2p" - "github.com/harmony-one/harmony/proto" ) var ( diff --git a/client/txgen/main.go b/client/txgen/main.go index ef649fb50..22b23657e 100644 --- a/client/txgen/main.go +++ b/client/txgen/main.go @@ -9,6 +9,7 @@ import ( "sync" "time" + proto_node "github.com/harmony-one/harmony/api/proto/node" "github.com/harmony-one/harmony/client" "github.com/harmony-one/harmony/client/txgen/txgen" "github.com/harmony-one/harmony/consensus" @@ -19,7 +20,6 @@ import ( "github.com/harmony-one/harmony/node" "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p/p2pimpl" - proto_node "github.com/harmony-one/harmony/proto/node" ) var ( diff --git a/client/wallet/main.go b/client/wallet/main.go index 9c0389f01..ddce69e76 100644 --- a/client/wallet/main.go +++ b/client/wallet/main.go @@ -17,6 +17,7 @@ import ( "github.com/ethereum/go-ethereum/common" crypto2 "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" + proto_node "github.com/harmony-one/harmony/api/proto/node" "github.com/harmony-one/harmony/client" client2 "github.com/harmony-one/harmony/client/service" "github.com/harmony-one/harmony/core/types" @@ -25,7 +26,6 @@ import ( "github.com/harmony-one/harmony/node" "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p/p2pimpl" - proto_node "github.com/harmony-one/harmony/proto/node" ) var ( diff --git a/consensus/consensus.go b/consensus/consensus.go index 638cb45d9..c2dcfe1e4 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -22,7 +22,7 @@ import ( "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p/host" - proto_node "github.com/harmony-one/harmony/proto/node" + proto_node "github.com/harmony-one/harmony/api/proto/node" ) // Consensus is the main struct with all states and data related to consensus process. diff --git a/consensus/consensus_leader_msg.go b/consensus/consensus_leader_msg.go index bf1ef97a8..3e088dce1 100644 --- a/consensus/consensus_leader_msg.go +++ b/consensus/consensus_leader_msg.go @@ -2,11 +2,12 @@ package consensus import ( "bytes" + "github.com/dedis/kyber" consensus_proto "github.com/harmony-one/harmony/api/consensus" + "github.com/harmony-one/harmony/api/proto" "github.com/harmony-one/harmony/crypto" "github.com/harmony-one/harmony/log" - "github.com/harmony-one/harmony/proto" ) // Constructs the announce message diff --git a/consensus/consensus_validator_msg.go b/consensus/consensus_validator_msg.go index d472c5596..9c91acbfb 100644 --- a/consensus/consensus_validator_msg.go +++ b/consensus/consensus_validator_msg.go @@ -3,8 +3,8 @@ package consensus import ( "github.com/dedis/kyber" consensus_proto "github.com/harmony-one/harmony/api/consensus" + "github.com/harmony-one/harmony/api/proto" "github.com/harmony-one/harmony/crypto" - "github.com/harmony-one/harmony/proto" ) // Construct the commit message to send to leader (assumption the consensus data is already verified) diff --git a/internal/beaconchain/libs/beaconchain.go b/internal/beaconchain/libs/beaconchain.go index 5256ff7cb..39cf4f78d 100644 --- a/internal/beaconchain/libs/beaconchain.go +++ b/internal/beaconchain/libs/beaconchain.go @@ -7,6 +7,8 @@ import ( "github.com/dedis/kyber" + "github.com/harmony-one/harmony/api/proto/bcconn" + proto_identity "github.com/harmony-one/harmony/api/proto/identity" "github.com/harmony-one/harmony/crypto/pki" "github.com/harmony-one/harmony/internal/beaconchain/rpc" "github.com/harmony-one/harmony/internal/utils" @@ -14,8 +16,6 @@ import ( "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p/host" "github.com/harmony-one/harmony/p2p/p2pimpl" - "github.com/harmony-one/harmony/proto/bcconn" - proto_identity "github.com/harmony-one/harmony/proto/identity" ) var mutex sync.Mutex diff --git a/internal/beaconchain/libs/beaconchain_handler.go b/internal/beaconchain/libs/beaconchain_handler.go index e181a88fd..c94708037 100644 --- a/internal/beaconchain/libs/beaconchain_handler.go +++ b/internal/beaconchain/libs/beaconchain_handler.go @@ -1,9 +1,9 @@ package beaconchain import ( + "github.com/harmony-one/harmony/api/proto" + proto_identity "github.com/harmony-one/harmony/api/proto/identity" "github.com/harmony-one/harmony/p2p" - "github.com/harmony-one/harmony/proto" - proto_identity "github.com/harmony-one/harmony/proto/identity" ) // BeaconChainHandler handles registration of new Identities diff --git a/internal/beaconchain/rpc/server.go b/internal/beaconchain/rpc/server.go index 32e5b602f..8aba0ccfe 100644 --- a/internal/beaconchain/rpc/server.go +++ b/internal/beaconchain/rpc/server.go @@ -5,7 +5,7 @@ import ( "log" "net" - "github.com/harmony-one/harmony/proto/bcconn" + "github.com/harmony-one/harmony/api/proto/bcconn" "google.golang.org/grpc" diff --git a/internal/newnode/newnode.go b/internal/newnode/newnode.go index ea3b9d8cd..29a209b73 100644 --- a/internal/newnode/newnode.go +++ b/internal/newnode/newnode.go @@ -8,14 +8,14 @@ import ( "github.com/dedis/kyber" + "github.com/harmony-one/harmony/api/proto/bcconn" + proto_identity "github.com/harmony-one/harmony/api/proto/identity" "github.com/harmony-one/harmony/crypto" "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/log" "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p/host" "github.com/harmony-one/harmony/p2p/p2pimpl" - "github.com/harmony-one/harmony/proto/bcconn" - proto_identity "github.com/harmony-one/harmony/proto/identity" ) //NewNode is ther struct for a candidate node diff --git a/internal/newnode/newnode_handler.go b/internal/newnode/newnode_handler.go index 9cbc48239..582a2eb93 100644 --- a/internal/newnode/newnode_handler.go +++ b/internal/newnode/newnode_handler.go @@ -3,9 +3,9 @@ package newnode import ( "time" + "github.com/harmony-one/harmony/api/proto" + proto_identity "github.com/harmony-one/harmony/api/proto/identity" "github.com/harmony-one/harmony/p2p" - "github.com/harmony-one/harmony/proto" - proto_identity "github.com/harmony-one/harmony/proto/identity" ) // NodeHandler handles a new incoming connection. diff --git a/node/node.go b/node/node.go index fb61d903a..ee3270b41 100644 --- a/node/node.go +++ b/node/node.go @@ -18,6 +18,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" + proto_node "github.com/harmony-one/harmony/api/proto/node" "github.com/harmony-one/harmony/client" clientService "github.com/harmony-one/harmony/client/service" bft "github.com/harmony-one/harmony/consensus" @@ -30,7 +31,6 @@ import ( "github.com/harmony-one/harmony/node/worker" "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p/host" - proto_node "github.com/harmony-one/harmony/proto/node" "github.com/harmony-one/harmony/services/explorer" "github.com/harmony-one/harmony/services/syncing" "github.com/harmony-one/harmony/services/syncing/downloader" diff --git a/node/node_handler.go b/node/node_handler.go index 39914e481..8c346fcea 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -3,20 +3,21 @@ package node import ( "bytes" "fmt" - "github.com/ethereum/go-ethereum/common" "os" "time" + "github.com/ethereum/go-ethereum/common" + "github.com/dedis/kyber" "github.com/ethereum/go-ethereum/rlp" + "github.com/harmony-one/harmony/api/proto" + proto_identity "github.com/harmony-one/harmony/api/proto/identity" + proto_node "github.com/harmony-one/harmony/api/proto/node" "github.com/harmony-one/harmony/core/types" hmy_crypto "github.com/harmony-one/harmony/crypto" "github.com/harmony-one/harmony/crypto/pki" "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p/host" - "github.com/harmony-one/harmony/proto" - proto_identity "github.com/harmony-one/harmony/proto/identity" - proto_node "github.com/harmony-one/harmony/proto/node" ) const ( diff --git a/node/node_test.go b/node/node_test.go index be81039e2..670079ad2 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -6,13 +6,13 @@ import ( "testing" "time" + proto_node "github.com/harmony-one/harmony/api/proto/node" "github.com/harmony-one/harmony/consensus" "github.com/harmony-one/harmony/crypto" "github.com/harmony-one/harmony/crypto/pki" "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p/p2pimpl" - proto_node "github.com/harmony-one/harmony/proto/node" ) func TestNewNewNode(t *testing.T) {