certificate

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicCheckError

type BasicCheckError struct {
	Reason string
}

BasicCheckError is returned when the basic check on the certificate fails.

func (BasicCheckError) Error

func (e BasicCheckError) Error() string

type BlockCertificate added in v1.2.0

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

BlockCertificate represents a certificate used for block validation, verifying if a block is signed by a majority of validators.

func NewBlockCertificate added in v1.2.0

func NewBlockCertificate(height uint32, round int16) *BlockCertificate

NewBlockCertificate creates a new BlockCertificate.

func (*BlockCertificate) Absentees added in v1.2.0

func (cert *BlockCertificate) Absentees() []int32

func (*BlockCertificate) AddSignature added in v1.2.0

func (cert *BlockCertificate) AddSignature(valNum int32, sig *bls.Signature)

AddSignature adds a new signature to the certificate. It does not check the validity of the signature. The caller should ensure that the signature is valid.

func (*BlockCertificate) BasicCheck added in v1.2.0

func (cert *BlockCertificate) BasicCheck() error

func (*BlockCertificate) Clone added in v1.2.0

func (cert *BlockCertificate) Clone() *BlockCertificate

func (*BlockCertificate) Committers added in v1.2.0

func (cert *BlockCertificate) Committers() []int32

func (*BlockCertificate) Decode added in v1.2.0

func (cert *BlockCertificate) Decode(r io.Reader) error

func (*BlockCertificate) Encode added in v1.2.0

func (cert *BlockCertificate) Encode(w io.Writer) error

func (*BlockCertificate) Hash added in v1.2.0

func (cert *BlockCertificate) Hash() hash.Hash

func (*BlockCertificate) Height added in v1.2.0

func (cert *BlockCertificate) Height() uint32

func (*BlockCertificate) MarshalCBOR added in v1.2.0

func (cert *BlockCertificate) MarshalCBOR() ([]byte, error)

func (*BlockCertificate) Round added in v1.2.0

func (cert *BlockCertificate) Round() int16

func (*BlockCertificate) SerializeSize added in v1.2.0

func (cert *BlockCertificate) SerializeSize() int

SerializeSize returns the number of bytes it would take to serialize the block.

func (*BlockCertificate) SetSignature added in v1.2.0

func (cert *BlockCertificate) SetSignature(committers, absentees []int32, signature *bls.Signature)

func (*BlockCertificate) SignBytes added in v1.2.0

func (cert *BlockCertificate) SignBytes(blockHash hash.Hash) []byte

func (*BlockCertificate) Signature added in v1.2.0

func (cert *BlockCertificate) Signature() *bls.Signature

func (*BlockCertificate) UnmarshalCBOR added in v1.2.0

func (cert *BlockCertificate) UnmarshalCBOR(bs []byte) error

func (*BlockCertificate) Validate added in v1.2.0

func (cert *BlockCertificate) Validate(validators []*validator.Validator, blockHash hash.Hash) error

type InsufficientPowerError

type InsufficientPowerError struct {
	SignedPower   int64
	RequiredPower int64
}

InsufficientPowerError is returned when the accumulated power does not meet the required threshold.

func (InsufficientPowerError) Error

func (e InsufficientPowerError) Error() string

type UnexpectedCommittersError

type UnexpectedCommittersError struct {
	Committers []int32
}

UnexpectedCommittersError is returned when the list of committers does not match the expectations.

func (UnexpectedCommittersError) Error

func (UnexpectedCommittersError) Is

func (e UnexpectedCommittersError) Is(target error) bool

type VoteCertificate added in v1.2.0

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

VoteCertificate represents a certificate used for consensus voting, checking if a majority of validators have voted in a consensus step.

func NewVoteCertificate added in v1.2.0

func NewVoteCertificate(height uint32, round int16) *VoteCertificate

NewVoteCertificate creates a new VoteCertificate instance.

func (*VoteCertificate) Absentees added in v1.2.0

func (cert *VoteCertificate) Absentees() []int32

func (*VoteCertificate) AddSignature added in v1.2.0

func (cert *VoteCertificate) AddSignature(valNum int32, sig *bls.Signature)

AddSignature adds a new signature to the certificate. It does not check the validity of the signature. The caller should ensure that the signature is valid.

func (*VoteCertificate) BasicCheck added in v1.2.0

func (cert *VoteCertificate) BasicCheck() error

func (*VoteCertificate) Committers added in v1.2.0

func (cert *VoteCertificate) Committers() []int32

func (*VoteCertificate) Decode added in v1.2.0

func (cert *VoteCertificate) Decode(r io.Reader) error

func (*VoteCertificate) Encode added in v1.2.0

func (cert *VoteCertificate) Encode(w io.Writer) error

func (*VoteCertificate) Hash added in v1.2.0

func (cert *VoteCertificate) Hash() hash.Hash

func (*VoteCertificate) Height added in v1.2.0

func (cert *VoteCertificate) Height() uint32

func (*VoteCertificate) MarshalCBOR added in v1.2.0

func (cert *VoteCertificate) MarshalCBOR() ([]byte, error)

func (*VoteCertificate) Round added in v1.2.0

func (cert *VoteCertificate) Round() int16

func (*VoteCertificate) SerializeSize added in v1.2.0

func (cert *VoteCertificate) SerializeSize() int

SerializeSize returns the number of bytes it would take to serialize the block.

func (*VoteCertificate) SetSignature added in v1.2.0

func (cert *VoteCertificate) SetSignature(committers, absentees []int32, signature *bls.Signature)

func (*VoteCertificate) SignBytes added in v1.2.0

func (cert *VoteCertificate) SignBytes(blockHash hash.Hash, extraData ...[]byte) []byte

SignBytes returns the sign bytes for the vote certificate. This method provides the same data as the `SignBytes` function in vote struct.

func (*VoteCertificate) Signature added in v1.2.0

func (cert *VoteCertificate) Signature() *bls.Signature

func (*VoteCertificate) UnmarshalCBOR added in v1.2.0

func (cert *VoteCertificate) UnmarshalCBOR(bs []byte) error

func (*VoteCertificate) ValidateCPMainVote added in v1.2.0

func (cert *VoteCertificate) ValidateCPMainVote(validators []*validator.Validator,
	blockHash hash.Hash, cpRound int16, cpValue byte,
) error

func (*VoteCertificate) ValidateCPPreVote added in v1.2.0

func (cert *VoteCertificate) ValidateCPPreVote(validators []*validator.Validator,
	blockHash hash.Hash, cpRound int16, cpValue byte,
) error

func (*VoteCertificate) ValidatePrepare added in v1.2.0

func (cert *VoteCertificate) ValidatePrepare(validators []*validator.Validator,
	blockHash hash.Hash,
) error

Jump to

Keyboard shortcuts

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