Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions consensus/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,13 @@ type EquivalentProofsPool interface {
HasProof(shardID uint32, headerHash []byte) bool
IsInterfaceNil() bool
}

// ProofHandler defines the interface for a proof handler
type ProofHandler interface {
GetPubKeysBitmap() []byte
GetAggregatedSignature() []byte
GetHeaderHash() []byte
GetHeaderEpoch() uint32
GetHeaderNonce() uint64
GetHeaderShardId() uint32
}
3 changes: 1 addition & 2 deletions consensus/spos/bls/v2/blsSubroundsFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,9 @@ func (fct *factory) generateEndRoundSubround() error {
return err
}

fct.worker.AddReceivedMessageCall(bls.MtBlockHeaderFinalInfo, subroundEndRoundObject.receivedBlockHeaderFinalInfo)
fct.worker.AddReceivedProofHandler(subroundEndRoundObject.receivedProof)
fct.worker.AddReceivedMessageCall(bls.MtInvalidSigners, subroundEndRoundObject.receivedInvalidSignersInfo)
fct.worker.AddReceivedMessageCall(bls.MtSignature, subroundEndRoundObject.receivedSignature)
fct.worker.AddReceivedHeaderHandler(subroundEndRoundObject.receivedHeader)
fct.consensusCore.Chronology().AddSubround(subroundEndRoundObject)

return nil
Expand Down
6 changes: 6 additions & 0 deletions consensus/spos/bls/v2/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ import "errors"

// ErrNilSentSignatureTracker defines the error for setting a nil SentSignatureTracker
var ErrNilSentSignatureTracker = errors.New("nil sent signature tracker")

// ErrWrongSizeBitmap defines the error for wrong size bitmap
var ErrWrongSizeBitmap = errors.New("wrong size bitmap")

// ErrNotEnoughSignatures defines the error for not enough signatures
var ErrNotEnoughSignatures = errors.New("not enough signatures")
43 changes: 14 additions & 29 deletions consensus/spos/bls/v2/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,39 +256,19 @@ func (sr *subroundEndRound) CheckSignaturesValidity(bitmap []byte) error {
return sr.checkSignaturesValidity(bitmap)
}

// DoEndRoundJobByParticipant calls the unexported doEndRoundJobByParticipant function
func (sr *subroundEndRound) DoEndRoundJobByParticipant(cnsDta *consensus.Message) bool {
return sr.doEndRoundJobByParticipant(cnsDta)
// DoEndRoundJobByLeader calls the unexported doEndRoundJobByNode function
func (sr *subroundEndRound) DoEndRoundJobByNode() bool {
return sr.doEndRoundJobByNode()
}

// DoEndRoundJobByLeader calls the unexported doEndRoundJobByLeader function
func (sr *subroundEndRound) DoEndRoundJobByLeader() bool {
return sr.doEndRoundJobByLeader()
// CreateAndBroadcastProof calls the unexported createAndBroadcastHeaderFinalInfo function
func (sr *subroundEndRound) CreateAndBroadcastProof(signature []byte, bitmap []byte) {
sr.createAndBroadcastProof(signature, bitmap)
}

// HaveConsensusHeaderWithFullInfo calls the unexported haveConsensusHeaderWithFullInfo function
func (sr *subroundEndRound) HaveConsensusHeaderWithFullInfo(cnsDta *consensus.Message) (bool, data.HeaderHandler) {
return sr.haveConsensusHeaderWithFullInfo(cnsDta)
}

// CreateAndBroadcastHeaderFinalInfo calls the unexported createAndBroadcastHeaderFinalInfo function
func (sr *subroundEndRound) CreateAndBroadcastHeaderFinalInfo(signature []byte, bitmap []byte, leaderSignature []byte, pk []byte) {
sr.createAndBroadcastHeaderFinalInfoForKey(signature, bitmap, leaderSignature, pk)
}

// ReceivedBlockHeaderFinalInfo calls the unexported receivedBlockHeaderFinalInfo function
func (sr *subroundEndRound) ReceivedBlockHeaderFinalInfo(cnsDta *consensus.Message) bool {
return sr.receivedBlockHeaderFinalInfo(context.Background(), cnsDta)
}

// IsBlockHeaderFinalInfoValid calls the unexported isBlockHeaderFinalInfoValid function
func (sr *subroundEndRound) IsBlockHeaderFinalInfoValid(cnsDta *consensus.Message) bool {
return sr.isBlockHeaderFinalInfoValid(cnsDta)
}

// IsConsensusHeaderReceived calls the unexported isConsensusHeaderReceived function
func (sr *subroundEndRound) IsConsensusHeaderReceived() (bool, data.HeaderHandler) {
return sr.isConsensusHeaderReceived()
// ReceivedProof calls the unexported receivedProof function
func (sr *subroundEndRound) ReceivedProof(proof consensus.ProofHandler) {
sr.receivedProof(proof)
}

// IsOutOfTime calls the unexported isOutOfTime function
Expand Down Expand Up @@ -355,3 +335,8 @@ func (sr *subroundSignature) SendSignatureForManagedKey(idx int, pk string) bool
func (sr *subroundSignature) DoSignatureJobForManagedKeys(ctx context.Context) bool {
return sr.doSignatureJobForManagedKeys(ctx)
}

// ReceivedSignature method is called when a signature is received through the signature channel
func (sr *subroundEndRound) ReceivedSignature(cnsDta *consensus.Message) bool {
return sr.receivedSignature(context.Background(), cnsDta)
}
Loading
Loading