verification

package
v0.13.1-patch.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2021 License: AGPL-3.0 Imports: 11 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFormat      = errors.New("invalid signature format")
	ErrInsufficientShares = errors.New("insufficient threshold signature shares")
)

Functions

This section is empty.

Types

type CombinedSigner

type CombinedSigner struct {
	*CombinedVerifier
	// contains filtered or unexported fields
}

CombinedSigner is a signer capable of creating two signatures for each signing operation, combining them and adding them as the signature data on the generated data structures. The first type is an aggregating signer, which creates single signatures that can be aggregated into a single aggregated signature. The second type is a threshold signer, which creates threshold signature shares, which can be used to reconstruct a threshold signature.

func NewCombinedSigner

func NewCombinedSigner(committee hotstuff.Committee, staking module.AggregatingSigner, beacon module.ThresholdSigner, merger module.Merger, signerID flow.Identifier) *CombinedSigner

NewCombinedSigner creates a new combined signer with the given dependencies: - the hotstuff committee's state is used to retrieve public keys for signers; - the signer ID is used as the identity when creating signatures; - the staking signer is used to create aggregatable signatures for the first signature part; - the threshold signer is used to create threshold signture shres for the second signature part; - the merger is used to join and split the two signature parts on our models;

func (*CombinedSigner) CreateProposal

func (c *CombinedSigner) CreateProposal(block *model.Block) (*model.Proposal, error)

CreateProposal will create a proposal with a combined signature for the given block.

func (*CombinedSigner) CreateQC

func (c *CombinedSigner) CreateQC(votes []*model.Vote) (*flow.QuorumCertificate, error)

CreateQC will create a quorum certificate with a combined aggregated signature and threshold signature for the given votes.

func (*CombinedSigner) CreateVote

func (c *CombinedSigner) CreateVote(block *model.Block) (*model.Vote, error)

CreateVote will create a vote with a combined signature for the given block.

type CombinedVerifier

type CombinedVerifier struct {
	// contains filtered or unexported fields
}

CombinedVerifier is a verifier capable of verifying two signatures for each verifying operation. The first type is a signature from an aggregating signer, which verifies either the single or the aggregated signature. The second type is a signature from a threshold signer, which verifies either the signature share or the reconstructed threshold signature.

func NewCombinedVerifier

func NewCombinedVerifier(committee hotstuff.Committee, staking module.AggregatingVerifier, beacon module.ThresholdVerifier, merger module.Merger) *CombinedVerifier

NewCombinedVerifier creates a new combined verifier with the given dependencies. - the hotstuff committee's state is used to retrieve the public keys for the staking signature; - the DKG state is used to retrieve DKG data necessary to verify beacon signatures; - the staking verifier is used to verify single & aggregated staking signatures; - the beacon verifier is used to verify signature shares & threshold signatures; - the merger is used to combined & split staking & random beacon signatures; and

func (*CombinedVerifier) VerifyQC

func (c *CombinedVerifier) VerifyQC(voterIDs []flow.Identifier, sigData []byte, block *model.Block) (bool, error)

VerifyQC verifies the validity of a combined signature on a quorum certificate.

func (*CombinedVerifier) VerifyVote

func (c *CombinedVerifier) VerifyVote(voterID flow.Identifier, sigData []byte, block *model.Block) (bool, error)

VerifyVote verifies the validity of a combined signature on a vote.

type SignerMetricsWrapper

type SignerMetricsWrapper struct {
	// contains filtered or unexported fields
}

SignerMetricsWrapper implements the hotstuff.SignerVerifier interface. It wraps a hotstuff.SignerVerifier instance and measures the time which the HotStuff's core logic spends in the hotstuff.SignerVerifier component, i.e. the with crypto-related operations. The measured time durations are reported as values for the SignerProcessingDuration metric.

func (SignerMetricsWrapper) CreateProposal

func (w SignerMetricsWrapper) CreateProposal(block *model.Block) (*model.Proposal, error)

func (SignerMetricsWrapper) CreateQC

func (w SignerMetricsWrapper) CreateQC(votes []*model.Vote) (*flow.QuorumCertificate, error)

func (SignerMetricsWrapper) CreateVote

func (w SignerMetricsWrapper) CreateVote(block *model.Block) (*model.Vote, error)

func (SignerMetricsWrapper) VerifyQC

func (w SignerMetricsWrapper) VerifyQC(voterIDs []flow.Identifier, sigData []byte, block *model.Block) (bool, error)

func (SignerMetricsWrapper) VerifyVote

func (w SignerMetricsWrapper) VerifyVote(voterID flow.Identifier, sigData []byte, block *model.Block) (bool, error)

type SingleSigner

type SingleSigner struct {
	// contains filtered or unexported fields
}

SingleSigner is a signer capable of adding single signatures that can be aggregated to data structures.

func NewSingleSigner

func NewSingleSigner(signer module.AggregatingSigner, signerID flow.Identifier) *SingleSigner

func (*SingleSigner) CreateProposal

func (s *SingleSigner) CreateProposal(block *model.Block) (*model.Proposal, error)

CreateProposal creates a proposal with a single signature for the given block.

func (*SingleSigner) CreateQC

func (s *SingleSigner) CreateQC(votes []*model.Vote) (*flow.QuorumCertificate, error)

CreateQC generates a quorum certificate with a single aggregated signature for the given votes.

func (*SingleSigner) CreateVote

func (s *SingleSigner) CreateVote(block *model.Block) (*model.Vote, error)

CreateVote creates a vote with a single signature for the given block.

type SingleSignerVerifier

type SingleSignerVerifier struct {
	*SingleSigner
	*SingleVerifier
}

SingleSignerVerifier wraps single signer and verifier.

func NewSingleSignerVerifier

func NewSingleSignerVerifier(committee hotstuff.Committee, signer module.AggregatingSigner, signerID flow.Identifier) *SingleSignerVerifier

NewSingleSignerVerifier initializes a single signer with the given dependencies: - the given hotstuff committee's state is used to retrieve public keys for the verifier; - the given signer is used to generate signatures for the local node; - the given signer ID is used as identifier for our signatures.

type SingleVerifier

type SingleVerifier struct {
	// contains filtered or unexported fields
}

SingleVerifier is a verifier capable of verifying a single signature in the signature data for its validity. It is used with an aggregating signature scheme.

func NewSingleVerifier

func NewSingleVerifier(committee hotstuff.Committee, verifier module.AggregatingVerifier) *SingleVerifier

NewSingleVerifier creates a new single verifier with the given dependencies: - the hotstuff committee's state is used to get the public staking key for signers; - the verifier is used to verify the signatures against the message;

func (*SingleVerifier) VerifyQC

func (s *SingleVerifier) VerifyQC(voterIDs []flow.Identifier, sigData []byte, block *model.Block) (bool, error)

VerifyQC verifies a QC with a single aggregated signature as signature data.

func (*SingleVerifier) VerifyVote

func (s *SingleVerifier) VerifyVote(voterID flow.Identifier, sigData []byte, block *model.Block) (bool, error)

VerifyVote verifies a vote with a single signature as signature data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL