Merge pull request #182 from harmony-one/rj_branch

move consensus/proto to api/consensus;
pull/186/head
Rongjian Lan 6 years ago committed by GitHub
commit 67e0599da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      api/consensus/consensus.pb.go
  2. 0
      api/consensus/consensus.proto
  3. 6
      consensus/consensus_leader.go
  4. 8
      consensus/consensus_leader_msg.go
  5. 8
      consensus/consensus_validator.go
  6. 6
      consensus/consensus_validator_msg.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

@ -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

@ -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

@ -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

Loading…
Cancel
Save