Skip to content

Commit

Permalink
Revert "Add multi-sig merged messaging logic (#3300)"
Browse files Browse the repository at this point in the history
This reverts commit ecf1515.
  • Loading branch information
rlan35 authored Aug 29, 2020
1 parent ecf1515 commit cbd1133
Show file tree
Hide file tree
Showing 30 changed files with 415 additions and 765 deletions.
149 changes: 69 additions & 80 deletions api/proto/message/message.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/proto/message/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ message ConsensusRequest {
bytes block = 5;
bytes sender_pubkey = 6;
bytes payload = 7;
bytes sender_pubkey_bitmap = 8;
}

message DrandRequest {
Expand Down
14 changes: 4 additions & 10 deletions consensus/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (consensus *Consensus) isRightBlockNumAndViewID(recvMsg *FBFTMessage,
Uint64("MsgViewID", recvMsg.ViewID).
Uint64("MsgBlockNum", recvMsg.BlockNum).
Uint64("blockNum", consensus.blockNum).
Interface("ValidatorPubKey", recvMsg.SenderPubkeys).
Str("ValidatorPubKey", recvMsg.SenderPubkey.Bytes.Hex()).
Msg("BlockNum/viewID not match")
return false
}
Expand All @@ -74,18 +74,12 @@ func (consensus *Consensus) onAnnounceSanityChecks(recvMsg *FBFTMessage) bool {
msg_pb.MessageType_ANNOUNCE, recvMsg.BlockNum, recvMsg.ViewID,
)
if len(logMsgs) > 0 {
if len(logMsgs[0].SenderPubkeys) != 1 || len(recvMsg.SenderPubkeys) != 1 {
consensus.getLogger().Debug().
Interface("signers", recvMsg.SenderPubkeys).
Msg("[OnAnnounce] Announce message have 0 or more than 1 signers")
return false
}
if logMsgs[0].BlockHash != recvMsg.BlockHash &&
bytes.Equal(logMsgs[0].SenderPubkeys[0].Bytes[:], recvMsg.SenderPubkeys[0].Bytes[:]) {
bytes.Equal(logMsgs[0].SenderPubkey.Bytes[:], recvMsg.SenderPubkey.Bytes[:]) {
consensus.getLogger().Debug().
Str("logMsgSenderKey", logMsgs[0].SenderPubkeys[0].Bytes.Hex()).
Str("logMsgSenderKey", logMsgs[0].SenderPubkey.Bytes.Hex()).
Str("logMsgBlockHash", logMsgs[0].BlockHash.Hex()).
Str("recvMsg.SenderPubkeys", recvMsg.SenderPubkeys[0].Bytes.Hex()).
Str("recvMsg.SenderPubkey", recvMsg.SenderPubkey.Bytes.Hex()).
Uint64("recvMsg.BlockNum", recvMsg.BlockNum).
Uint64("recvMsg.ViewID", recvMsg.ViewID).
Str("recvMsgBlockHash", recvMsg.BlockHash.Hex()).
Expand Down
5 changes: 1 addition & 4 deletions consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ type Consensus struct {
aggregatedCommitSig *bls_core.Sign
prepareBitmap *bls_cosi.Mask
commitBitmap *bls_cosi.Mask
multiSigBitmap *bls_cosi.Mask // Bitmap for parsing multisig bitmap from validators
multiSigMutex sync.RWMutex
// Commits collected from view change
// for each viewID, we need keep track of corresponding sigs and bitmap
// until one of the viewID has enough votes (>=2f+1)
Expand Down Expand Up @@ -124,8 +122,6 @@ type Consensus struct {
BlockPeriod time.Duration
// The time due for next block proposal
NextBlockDue time.Time
// Temporary flag to control whether multi-sig signing is enabled
MultiSig bool
}

// SetCommitDelay sets the commit message delay. If set to non-zero,
Expand Down Expand Up @@ -183,6 +179,7 @@ func New(
// FBFT related
consensus.FBFTLog = NewFBFTLog()
consensus.phase = FBFTAnnounce
// TODO Refactor consensus.block* into State?
consensus.current = State{mode: Normal}
// FBFT timeout
consensus.consensusTimeout = createTimeout()
Expand Down
Loading

0 comments on commit cbd1133

Please sign in to comment.