diff --git a/consensus/proto/consensus.pb.go b/api/consensus/consensus.pb.go similarity index 100% rename from consensus/proto/consensus.pb.go rename to api/consensus/consensus.pb.go diff --git a/consensus/proto/consensus.proto b/api/consensus/consensus.proto similarity index 100% rename from consensus/proto/consensus.proto rename to api/consensus/consensus.proto diff --git a/consensus/consensus_leader.go b/consensus/consensus_leader.go index da1ce802f..9db52c6fd 100644 --- a/consensus/consensus_leader.go +++ b/consensus/consensus_leader.go @@ -12,7 +12,7 @@ import ( "github.com/harmony-one/harmony/p2p/host" "github.com/harmony-one/harmony/services/explorer" - consensus2 "github.com/harmony-one/harmony/consensus/proto" + consensus_proto "github.com/harmony-one/harmony/api/consensus" "github.com/harmony-one/harmony/profiler" "github.com/dedis/kyber" @@ -126,7 +126,7 @@ func (consensus *Consensus) commitByLeader(firstRound bool) { // processCommitMessage processes the commit message sent from validators func (consensus *Consensus) processCommitMessage(payload []byte, targetState State) { - message := consensus2.Message{} + message := consensus_proto.Message{} message.XXX_Unmarshal(payload) consensusID := message.ConsensusId @@ -250,7 +250,7 @@ func (consensus *Consensus) responseByLeader(challenge kyber.Scalar, firstRound // Processes the response message sent from validators func (consensus *Consensus) processResponseMessage(payload []byte, targetState State) { - message := consensus2.Message{} + message := consensus_proto.Message{} message.XXX_Unmarshal(payload) consensusID := message.ConsensusId diff --git a/consensus/consensus_leader_msg.go b/consensus/consensus_leader_msg.go index e654af426..a561b36c1 100644 --- a/consensus/consensus_leader_msg.go +++ b/consensus/consensus_leader_msg.go @@ -3,7 +3,7 @@ package consensus import ( "bytes" "github.com/dedis/kyber" - consensus2 "github.com/harmony-one/harmony/consensus/proto" + consensus_proto "github.com/harmony-one/harmony/api/consensus" "github.com/harmony-one/harmony/crypto" "github.com/harmony-one/harmony/log" proto_consensus "github.com/harmony-one/harmony/proto/consensus" @@ -11,7 +11,7 @@ import ( // Constructs the announce message func (consensus *Consensus) constructAnnounceMessage() []byte { - message := consensus2.Message{} + message := consensus_proto.Message{} // 4 byte consensus id message.ConsensusId = consensus.consensusID @@ -43,7 +43,7 @@ func (consensus *Consensus) constructAnnounceMessage() []byte { // Construct the challenge message, returning challenge message in bytes, challenge scalar and aggregated commmitment point. func (consensus *Consensus) constructChallengeMessage(msgTypeToSend proto_consensus.MessageType) ([]byte, kyber.Scalar, kyber.Point) { - message := consensus2.Message{} + message := consensus_proto.Message{} // 4 byte consensus id message.ConsensusId = consensus.consensusID @@ -104,7 +104,7 @@ func (consensus *Consensus) constructChallengeMessage(msgTypeToSend proto_consen // Construct the collective signature message func (consensus *Consensus) constructCollectiveSigMessage(collectiveSig [64]byte, bitmap []byte) []byte { - message := consensus2.Message{} + message := consensus_proto.Message{} // 4 byte consensus id message.ConsensusId = consensus.consensusID diff --git a/consensus/consensus_validator.go b/consensus/consensus_validator.go index 0be0e3bee..fc874f79d 100644 --- a/consensus/consensus_validator.go +++ b/consensus/consensus_validator.go @@ -5,7 +5,7 @@ import ( "github.com/dedis/kyber/sign/schnorr" "github.com/ethereum/go-ethereum/rlp" - consensus2 "github.com/harmony-one/harmony/consensus/proto" + consensus_proto "github.com/harmony-one/harmony/api/consensus" "github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/crypto" "github.com/harmony-one/harmony/internal/attack" @@ -44,7 +44,7 @@ func (consensus *Consensus) ProcessMessageValidator(message []byte) { func (consensus *Consensus) processAnnounceMessage(payload []byte) { consensus.Log.Info("Received Announce Message", "Size", len(payload), "nodeID", consensus.nodeID) - message := consensus2.Message{} + message := consensus_proto.Message{} message.XXX_Unmarshal(payload) consensusID := message.ConsensusId @@ -119,7 +119,7 @@ func (consensus *Consensus) processAnnounceMessage(payload []byte) { // Processes the challenge message sent from the leader func (consensus *Consensus) processChallengeMessage(payload []byte, targetState State) { consensus.Log.Info("Received Challenge Message", "Size", len(payload), "nodeID", consensus.nodeID) - message := consensus2.Message{} + message := consensus_proto.Message{} message.XXX_Unmarshal(payload) consensusID := message.ConsensusId @@ -264,7 +264,7 @@ func (consensus *Consensus) processChallengeMessage(payload []byte, targetState // Processes the collective signature message sent from the leader func (consensus *Consensus) processCollectiveSigMessage(payload []byte) { - message := consensus2.Message{} + message := consensus_proto.Message{} message.XXX_Unmarshal(payload) consensusID := message.ConsensusId diff --git a/consensus/consensus_validator_msg.go b/consensus/consensus_validator_msg.go index 8ad0ffd57..2c26cd696 100644 --- a/consensus/consensus_validator_msg.go +++ b/consensus/consensus_validator_msg.go @@ -2,14 +2,14 @@ package consensus import ( "github.com/dedis/kyber" - consensus2 "github.com/harmony-one/harmony/consensus/proto" + consensus_proto "github.com/harmony-one/harmony/api/consensus" "github.com/harmony-one/harmony/crypto" proto_consensus "github.com/harmony-one/harmony/proto/consensus" ) // Construct the commit message to send to leader (assumption the consensus data is already verified) func (consensus *Consensus) constructCommitMessage(msgType proto_consensus.MessageType) (secret kyber.Scalar, commitMsg []byte) { - message := consensus2.Message{} + message := consensus_proto.Message{} // 4 byte consensus id message.ConsensusId = consensus.consensusID @@ -46,7 +46,7 @@ func (consensus *Consensus) constructCommitMessage(msgType proto_consensus.Messa // Construct the response message to send to leader (assumption the consensus data is already verified) func (consensus *Consensus) constructResponseMessage(msgType proto_consensus.MessageType, response kyber.Scalar) []byte { - message := consensus2.Message{} + message := consensus_proto.Message{} // 4 byte consensus id message.ConsensusId = consensus.consensusID