v1

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: Apache-2.0 Imports: 8 Imported by: 198

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttesterDuty

type AttesterDuty struct {
	// PubKey is the public key of the validator that should attest.
	PubKey []byte
	// Slot is the slot in which the validator should attest.
	Slot uint64
	// ValidatorIndex is the index of the validator that should attest.
	ValidatorIndex uint64
	// CommitteeIndex is the index of the committee in which the attesting validator has been placed.
	CommitteeIndex uint64
	// CommitteeLength is the length of the committee in which the attesting validator has been placed.
	CommitteeLength uint64
	// CommitteesAtSlot is the number of committees in the slot.
	CommitteesAtSlot uint64
	// ValidatorCommitteeIndex is the index of the validator in the list of validators in the committee.
	ValidatorCommitteeIndex uint64
}

AttesterDuty is the data regarding which validators have the duty to attest in a slot.

func (*AttesterDuty) MarshalJSON

func (a *AttesterDuty) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*AttesterDuty) String

func (a *AttesterDuty) String() string

String returns a string version of the structure.

func (*AttesterDuty) UnmarshalJSON

func (a *AttesterDuty) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

type BeaconCommittee

type BeaconCommittee struct {
	// Slot is the slot in which the committee attests.
	Slot uint64
	// Index is the index of the committee.
	Index uint64
	// Validators is the list of validator indices in the committee.
	Validators []uint64
}

BeaconCommittee is the data providing information validator membership of committees.

func (*BeaconCommittee) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*BeaconCommittee) String

func (b *BeaconCommittee) String() string

String returns a string version of the structure.

func (*BeaconCommittee) UnmarshalJSON

func (b *BeaconCommittee) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

type BeaconCommitteeSubscription

type BeaconCommitteeSubscription struct {
	// Slot is the slot for which the validator is attesting.
	Slot uint64
	// CommitteeIndex is the index of the committee of which the validator is a member at the given slot.
	CommitteeIndex uint64
	// CommitteesAtSlot is the number of committees at the given slot.
	CommitteesAtSlot uint64
	// IsAggregator is true if the validator that wishes to subscribe is required to aggregate attestations.
	IsAggregator bool
}

BeaconCommitteeSubscription is the data required for a beacon committee subscription.

func (*BeaconCommitteeSubscription) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*BeaconCommitteeSubscription) String

func (b *BeaconCommitteeSubscription) String() string

String returns a string version of the structure.

func (*BeaconCommitteeSubscription) UnmarshalJSON

func (b *BeaconCommitteeSubscription) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Genesis

type Genesis struct {
	Time           time.Time
	ValidatorsRoot []byte
	ForkVersion    []byte
}

Genesis provides information about the genesis of a chain.

type ProposerDuty

type ProposerDuty struct {
	PubKey         []byte
	Slot           uint64
	ValidatorIndex uint64
}

ProposerDuty represents a duty of a validator to propose a slot.

func (*ProposerDuty) MarshalJSON

func (p *ProposerDuty) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*ProposerDuty) String

func (p *ProposerDuty) String() string

String returns a string version of the structure.

func (*ProposerDuty) UnmarshalJSON

func (p *ProposerDuty) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SyncState

type SyncState struct {
	// HeadSlot is the head slot of the chain as understood by the node.
	HeadSlot uint64
	// SyncDistance is the distance between the node's highest synced slot and the head slot.
	SyncDistance uint64
}

SyncState is the data regarding the node's synchronization state to the chain.

func (*SyncState) MarshalJSON

func (s *SyncState) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*SyncState) String

func (s *SyncState) String() string

String returns a string version of the structure.

func (*SyncState) UnmarshalJSON

func (s *SyncState) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Validator

type Validator struct {
	Index     uint64
	Balance   uint64
	State     ValidatorState
	Validator *spec.Validator
}

Validator contains the spec validator plus additional fields.

func (*Validator) MarshalJSON

func (v *Validator) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Validator) String

func (v *Validator) String() string

String returns a string version of the structure.

func (*Validator) UnmarshalJSON

func (v *Validator) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ValidatorState

type ValidatorState int

ValidatorState defines the state of the validator.

const (
	// ValidatorStateUnknown means no information can be found about the validator.
	ValidatorStateUnknown ValidatorState = iota
	// ValidatorStatePendingInitialized means the validator is not yet in the queue to be activated.
	ValidatorStatePendingInitialized
	// ValidatorStatePendingQueued means the validator is in the queue to be activated.
	ValidatorStatePendingQueued
	// ValidatorStateActiveOngoing means the validator is active.
	ValidatorStateActiveOngoing
	// ValidatorStateActiveExiting means the validator is active but exiting.
	ValidatorStateActiveExiting
	// ValidatorStateActiveSlashed means the validator is active but exiting due to being slashed.
	ValidatorStateActiveSlashed
	// ValidatorStateExitedUnslashed means the validator has exited without being slashed.
	ValidatorStateExitedUnslashed
	// ValidatorStateExitedSlashed means the validator has exited due to being slashed.
	ValidatorStateExitedSlashed
	// ValidatorStateWithdrawalPossible means it is possible to withdraw funds from the validator.
	ValidatorStateWithdrawalPossible
	// ValidatorStateWithdrawalDone means funds have been withdrawn from the validator.
	ValidatorStateWithdrawalDone
)

func ValidatorToState

func ValidatorToState(validator *spec.Validator, currentEpoch uint64, farFutureEpoch uint64) ValidatorState

ValidatorToState is a helper that calculates the validator state given a validator struct.

func (ValidatorState) IsAttesting

func (v ValidatorState) IsAttesting() bool

IsAttesting returns true if the validator should be attesting.

func (*ValidatorState) MarshalJSON

func (v *ValidatorState) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (ValidatorState) String

func (v ValidatorState) String() string

func (*ValidatorState) UnmarshalJSON

func (v *ValidatorState) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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