verification

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: AGPL-3.0 Imports: 9 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateBLSPublicKeys added in v0.20.4

func AggregateBLSPublicKeys(_ []crypto.PublicKey) (crypto.PublicKey, error)

func MakeVoteMessage added in v0.20.0

func MakeVoteMessage(view uint64, blockID flow.Identifier) []byte

MakeVoteMessage generates the message we have to sign in order to be able to verify signatures without having the full block. To that effect, each data structure that is signed contains the sometimes redundant view number and block ID; this allows us to create the signed message and verify the signed message without having the full block contents.

func NeutralBLSPublicKey added in v0.20.4

func NeutralBLSPublicKey() crypto.PublicKey

func RemoveBLSPublicKeys added in v0.20.4

func RemoveBLSPublicKeys(_ crypto.PublicKey, _ []crypto.PublicKey) (crypto.PublicKey, error)

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,
	thresholdVerifier module.ThresholdVerifier,
	merger module.Merger,
	thresholdSignerStore module.ThresholdSignerStore,
	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 staking signer is used to create and verify aggregatable signatures for the first signature part; - the thresholdVerifier is used to verify threshold signatures - the merger is used to join and split the two signature parts on our models; - the thresholdSignerStore is used to get threshold-signers by epoch/view; - the signer ID is used as the identity when creating signatures;

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(signers flow.IdentityList, 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(signer *flow.Identity, sigData []byte, block *model.Block) (bool, error)

VerifyVote verifies the validity of a combined signature from 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(signers flow.IdentityList, sigData []byte, block *model.Block) (bool, error)

func (SignerMetricsWrapper) VerifyVote

func (w SignerMetricsWrapper) VerifyVote(voter *flow.Identity, 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(signers flow.IdentityList, 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(voter *flow.Identity, 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