validator

package
v1.9.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWeightTooSmall = errors.New("weight of this validator is too low")
)

Functions

This section is empty.

Types

type BLS

type BLS struct {
	PublicKey [bls.PublicKeyLen]byte `serialize:"true" json:"publicKey"`
	// BLS signature proving ownership of [PublicKey]. The signed message is the
	// [PublicKey].
	ProofOfPossession [bls.SignatureLen]byte `serialize:"true" json:"proofOfPossession"`
	// contains filtered or unexported fields
}

func NewBLS

func NewBLS(sk *bls.SecretKey) *BLS

func (*BLS) Key

func (b *BLS) Key() *bls.PublicKey

func (*BLS) MarshalJSON

func (b *BLS) MarshalJSON() ([]byte, error)

func (*BLS) UnmarshalJSON

func (b *BLS) UnmarshalJSON(bytes []byte) error

func (*BLS) Verify

func (b *BLS) Verify() error

type Empty

type Empty struct{}

func (*Empty) Key

func (*Empty) Key() *bls.PublicKey

func (*Empty) Verify

func (*Empty) Verify() error

type Signer

type Signer interface {
	verify.Verifiable

	// Key returns the public BLS key if it exists.
	// Note: [nil] will be returned if the key does not exist.
	// Invariant: Only called after [Verify] returns [nil].
	Key() *bls.PublicKey
}

type SubnetValidator

type SubnetValidator struct {
	Validator `serialize:"true"`

	// ID of the subnet this validator is validating
	Subnet ids.ID `serialize:"true" json:"subnetID"`
}

SubnetValidator validates a subnet on the Avalanche network.

func (*SubnetValidator) SubnetID

func (v *SubnetValidator) SubnetID() ids.ID

SubnetID is the ID of the subnet this validator is validating

func (*SubnetValidator) Verify

func (v *SubnetValidator) Verify() error

Verify this validator is valid

type Validator

type Validator struct {
	// Node ID of the validator
	NodeID ids.NodeID `serialize:"true" json:"nodeID"`

	// Unix time this validator starts validating
	Start uint64 `serialize:"true" json:"start"`

	// Unix time this validator stops validating
	End uint64 `serialize:"true" json:"end"`

	// Weight of this validator used when sampling
	Wght uint64 `serialize:"true" json:"weight"`
}

Validator is a validator.

func (*Validator) BoundedBy

func (v *Validator) BoundedBy(startTime, endTime time.Time) bool

BoundedBy returns true iff the period that validator validates is a (non-strict) subset of the time that [other] validates. Namely, startTime <= v.StartTime() <= v.EndTime() <= endTime

func (*Validator) Duration

func (v *Validator) Duration() time.Duration

Duration is the amount of time that this validator will be in the validator set

func (*Validator) EndTime

func (v *Validator) EndTime() time.Time

EndTime is the time that this validator will leave the validator set

func (*Validator) ID

func (v *Validator) ID() ids.NodeID

ID returns the node ID of the validator

func (*Validator) StartTime

func (v *Validator) StartTime() time.Time

StartTime is the time that this validator will enter the validator set

func (*Validator) Verify

func (v *Validator) Verify() error

Verify validates the ID for this validator

func (*Validator) Weight

func (v *Validator) Weight() uint64

Weight is this validator's weight when sampling

Jump to

Keyboard shortcuts

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