github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/consensus/hotstuff/validator.go (about)

     1  package hotstuff
     2  
     3  import (
     4  	"github.com/onflow/flow-go/consensus/hotstuff/model"
     5  	"github.com/onflow/flow-go/model/flow"
     6  )
     7  
     8  // Validator provides functions to validate QC, proposals and votes.
     9  type Validator interface {
    10  
    11  	// ValidateQC checks the validity of a QC.
    12  	// During normal operations, the following error returns are expected:
    13  	//  * model.InvalidQCError if the QC is invalid
    14  	//  * model.ErrViewForUnknownEpoch if the QC refers unknown epoch
    15  	ValidateQC(qc *flow.QuorumCertificate) error
    16  
    17  	// ValidateTC checks the validity of a TC.
    18  	// During normal operations, the following error returns are expected:
    19  	//  * model.InvalidTCError if the TC is invalid
    20  	//  * model.ErrViewForUnknownEpoch if the TC refers unknown epoch
    21  	ValidateTC(tc *flow.TimeoutCertificate) error
    22  
    23  	// ValidateProposal checks the validity of a proposal.
    24  	// During normal operations, the following error returns are expected:
    25  	//  * model.InvalidProposalError if the block is invalid
    26  	//  * model.ErrViewForUnknownEpoch if the proposal refers unknown epoch
    27  	ValidateProposal(proposal *model.Proposal) error
    28  
    29  	// ValidateVote checks the validity of a vote.
    30  	// Returns the full entity for the voter. During normal operations,
    31  	// the following errors are expected:
    32  	//  * model.InvalidVoteError for invalid votes
    33  	//  * model.ErrViewForUnknownEpoch if the vote refers unknown epoch
    34  	ValidateVote(vote *model.Vote) (*flow.IdentitySkeleton, error)
    35  }