chaindb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateValidatorBalance added in v0.2.0

type AggregateValidatorBalance struct {
	Epoch            phase0.Epoch
	Balance          phase0.Gwei
	EffectiveBalance phase0.Gwei
}

AggregateValidatorBalance holds aggreated information about validators' balances at a given epoch.

type AggregateValidatorBalancesProvider added in v0.2.0

type AggregateValidatorBalancesProvider interface {
	// AggregateValidatorBalancesByIndexAndEpoch fetches the aggregate validator balances for the given validators and epoch.
	AggregateValidatorBalancesByIndexAndEpoch(
		ctx context.Context,
		indices []phase0.ValidatorIndex,
		epoch phase0.Epoch,
	) (
		*AggregateValidatorBalance,
		error,
	)

	// AggregateValidatorBalancesByIndexAndEpochRange fetches the aggregate validator balances for the given validators and
	// epoch range.
	// Ranges are inclusive of start and exclusive of end i.e. a request with startEpoch 2 and endEpoch 4 will provide
	// balances for epochs 2 and 3.
	AggregateValidatorBalancesByIndexAndEpochRange(
		ctx context.Context,
		indices []phase0.ValidatorIndex,
		startEpoch phase0.Epoch,
		endEpoch phase0.Epoch,
	) (
		[]*AggregateValidatorBalance,
		error,
	)

	// AggregateValidatorBalancesByIndexAndEpochs fetches the validator balances for the given validators at the specified epochs.
	AggregateValidatorBalancesByIndexAndEpochs(
		ctx context.Context,
		indices []phase0.ValidatorIndex,
		epochs []phase0.Epoch,
	) (
		[]*AggregateValidatorBalance,
		error,
	)
}

AggregateValidatorBalancesProvider defines functions to access aggregate validator balances.

type Attestation

type Attestation struct {
	InclusionSlot      phase0.Slot
	InclusionBlockRoot phase0.Root
	InclusionIndex     uint64
	Slot               phase0.Slot
	CommitteeIndex     phase0.CommitteeIndex
	AggregationBits    []byte
	AggregationIndices []phase0.ValidatorIndex
	BeaconBlockRoot    phase0.Root
	SourceEpoch        phase0.Epoch
	SourceRoot         phase0.Root
	TargetEpoch        phase0.Epoch
	TargetRoot         phase0.Root
	Canonical          *bool
	TargetCorrect      *bool
	HeadCorrect        *bool
}

Attestation holds information about an attestation included by a block.

type AttestationsProvider added in v0.1.4

type AttestationsProvider interface {
	// AttestationsForBlock fetches all attestations made for the given block.
	AttestationsForBlock(ctx context.Context, blockRoot phase0.Root) ([]*Attestation, error)

	// AttestationsInBlock fetches all attestations contained in the given block.
	AttestationsInBlock(ctx context.Context, blockRoot phase0.Root) ([]*Attestation, error)

	// AttestationsForSlotRange fetches all attestations made for the given slot range.
	// Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide
	// attestations for slots 2 and 3.
	AttestationsForSlotRange(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot) ([]*Attestation, error)

	// AttestationsInSlotRange fetches all attestations made in the given slot range.
	// Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide
	// attestations in slots 2 and 3.
	AttestationsInSlotRange(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot) ([]*Attestation, error)

	// IndeterminateAttestationSlots fetches the slots in the given range with attestations that do not have a canonical status.
	IndeterminateAttestationSlots(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]phase0.Slot, error)
}

AttestationsProvider defines functions to access attestations.

type AttestationsSetter added in v0.1.4

type AttestationsSetter interface {
	// SetAttestation sets an attestation.
	SetAttestation(ctx context.Context, attestation *Attestation) error
}

AttestationsSetter defines functions to create and update attestations.

type AttesterDuty added in v0.1.3

type AttesterDuty struct {
	Slot           phase0.Slot
	Committee      phase0.CommitteeIndex
	ValidatorIndex phase0.ValidatorIndex
	// CommitteeIndex is the index of the validator in the committee.
	CommitteeIndex uint64
}

AttesterDuty holds information for attester duties.

type AttesterSlashing

type AttesterSlashing struct {
	InclusionSlot               phase0.Slot
	InclusionBlockRoot          phase0.Root
	InclusionIndex              uint64
	Attestation1Indices         []phase0.ValidatorIndex
	Attestation1Slot            phase0.Slot
	Attestation1CommitteeIndex  phase0.CommitteeIndex
	Attestation1BeaconBlockRoot phase0.Root
	Attestation1SourceEpoch     phase0.Epoch
	Attestation1SourceRoot      phase0.Root
	Attestation1TargetEpoch     phase0.Epoch
	Attestation1TargetRoot      phase0.Root
	Attestation1Signature       phase0.BLSSignature
	Attestation2Indices         []phase0.ValidatorIndex
	Attestation2Slot            phase0.Slot
	Attestation2CommitteeIndex  phase0.CommitteeIndex
	Attestation2BeaconBlockRoot phase0.Root
	Attestation2SourceEpoch     phase0.Epoch
	Attestation2SourceRoot      phase0.Root
	Attestation2TargetEpoch     phase0.Epoch
	Attestation2TargetRoot      phase0.Root
	Attestation2Signature       phase0.BLSSignature
}

AttesterSlashing holds information about an attester slashing included by a block.

type AttesterSlashingsProvider added in v0.3.0

type AttesterSlashingsProvider interface {
	// AttesterSlashingsForSlotRange fetches all attester slashings made for the given slot range.
	// It will return slashings from blocks that are canonical or undefined, but not from non-canonical blocks.
	AttesterSlashingsForSlotRange(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]*AttesterSlashing, error)

	// AttesterSlashingsForValidator fetches all attester slashings made for the given validator.
	// It will return slashings from blocks that are canonical or undefined, but not from non-canonical blocks.
	AttesterSlashingsForValidator(ctx context.Context, index phase0.ValidatorIndex) ([]*AttesterSlashing, error)
}

AttesterSlashingsProvider defines functions to obtain attester slashings.

type AttesterSlashingsSetter added in v0.1.4

type AttesterSlashingsSetter interface {
	// SetAttesterSlashing sets an attester slashing.
	SetAttesterSlashing(ctx context.Context, attesterSlashing *AttesterSlashing) error
}

AttesterSlashingsSetter defines functions to create and update attester slashings.

type BeaconCommittee

type BeaconCommittee struct {
	Slot      phase0.Slot
	Index     phase0.CommitteeIndex
	Committee []phase0.ValidatorIndex
}

BeaconCommittee holds information for beacon committees.

type BeaconCommitteesProvider added in v0.1.4

type BeaconCommitteesProvider interface {
	// BeaconCommitteeBySlotAndIndex fetches the beacon committee with the given slot and index.
	BeaconCommitteeBySlotAndIndex(ctx context.Context, slot phase0.Slot, index phase0.CommitteeIndex) (*BeaconCommittee, error)

	// AttesterDuties fetches the attester duties at the given slot range for the given validator indices.
	AttesterDuties(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot, validatorIndices []phase0.ValidatorIndex) ([]*AttesterDuty, error)
}

BeaconCommitteesProvider defines functions to access beacon committee information.

type BeaconCommitteesSetter added in v0.1.4

type BeaconCommitteesSetter interface {
	// SetBeaconCommittee sets a beacon committee.
	SetBeaconCommittee(ctx context.Context, beaconCommittee *BeaconCommittee) error
}

BeaconCommitteesSetter defines functions to create and update beacon committee information.

type Block

type Block struct {
	Slot             phase0.Slot
	ProposerIndex    phase0.ValidatorIndex
	Root             phase0.Root
	Graffiti         []byte
	RANDAOReveal     phase0.BLSSignature
	BodyRoot         phase0.Root
	ParentRoot       phase0.Root
	StateRoot        phase0.Root
	Canonical        *bool
	ETH1BlockHash    []byte
	ETH1DepositCount uint64
	ETH1DepositRoot  phase0.Root
}

Block holds information about a block.

type BlockSummariesSetter added in v0.3.0

type BlockSummariesSetter interface {
	// SetBlockSummary sets a block summary.
	SetBlockSummary(ctx context.Context, summary *BlockSummary) error
}

BlockSummariesSetter defines functions to create and update block summaries.

type BlockSummary added in v0.3.0

type BlockSummary struct {
	Slot                          phase0.Slot
	AttestationsForBlock          int
	DuplicateAttestationsForBlock int
	VotesForBlock                 int
}

BlockSummary provides a summary of an epoch.

type BlocksProvider added in v0.1.4

type BlocksProvider interface {
	// BlocksBySlot fetches all blocks with the given slot.
	BlocksBySlot(ctx context.Context, slot phase0.Slot) ([]*Block, error)

	// BlocksForSlotRange fetches all blocks with the given slot range.
	// Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide
	// blocks duties for slots 2 and 3.
	BlocksForSlotRange(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot) ([]*Block, error)

	// BlockByRoot fetches the block with the given root.
	BlockByRoot(ctx context.Context, root phase0.Root) (*Block, error)

	// BlocksByParentRoot fetches the blocks with the given parent root.
	BlocksByParentRoot(ctx context.Context, root phase0.Root) ([]*Block, error)

	// EmptySlots fetches the slots in the given range without a block in the database.
	EmptySlots(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]phase0.Slot, error)

	// LatestBlocks fetches the blocks with the highest slot number in the database.
	LatestBlocks(ctx context.Context) ([]*Block, error)

	// IndeterminateBlocks fetches the blocks in the given range that do not have a canonical status.
	IndeterminateBlocks(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]phase0.Root, error)

	// CanonicalBlockPresenceForSlotRange returns a boolean for each slot in the range for the presence
	// of a canonical block.
	// Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide
	// presence duties for slots 2 and 3.
	CanonicalBlockPresenceForSlotRange(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]bool, error)

	// LatestCanonicalBlock returns the slot of the latest canonical block known in the database.
	LatestCanonicalBlock(ctx context.Context) (phase0.Slot, error)
}

BlocksProvider defines functions to access blocks.

type BlocksSetter added in v0.1.4

type BlocksSetter interface {
	// SetBlock sets a block.
	SetBlock(ctx context.Context, block *Block) error
}

BlocksSetter defines functions to create and update blocks.

type ChainSpecProvider added in v0.2.0

type ChainSpecProvider interface {
	// ChainSpec fetches all chain specification values.
	ChainSpec(ctx context.Context) (map[string]interface{}, error)

	// ChainSpecValue fetches a chain specification value given its key.
	ChainSpecValue(ctx context.Context, key string) (interface{}, error)
}

ChainSpecProvider defines functions to access chain specification.

type ChainSpecSetter added in v0.2.0

type ChainSpecSetter interface {
	// SetChainSpecValue sets the value of the provided key.
	SetChainSpecValue(ctx context.Context, key string, value interface{}) error
}

ChainSpecSetter defines functions to create and update chain specification.

type Deposit added in v0.2.0

type Deposit struct {
	InclusionSlot         phase0.Slot
	InclusionBlockRoot    phase0.Root
	InclusionIndex        uint64
	ValidatorPubKey       phase0.BLSPubKey
	WithdrawalCredentials []byte
	Amount                phase0.Gwei
}

Deposit holds information about an Ethereum 2 deposit included by a block.

type DepositsProvider added in v0.2.0

type DepositsProvider interface {
	// DepositsByPublicKey fetches deposits for a given set of validator public keys.
	DepositsByPublicKey(ctx context.Context, pubKeys []phase0.BLSPubKey) (map[phase0.BLSPubKey][]*Deposit, error)

	// DepositsForSlotRange fetches all deposits made in the given slot range.
	// It will return deposits from blocks that are canonical or undefined, but not from non-canonical blocks.
	DepositsForSlotRange(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]*Deposit, error)
}

DepositsProvider defines functions to access deposits.

type DepositsSetter added in v0.2.0

type DepositsSetter interface {
	// SetDeposit sets a deposit.
	SetDeposit(ctx context.Context, deposit *Deposit) error
}

DepositsSetter defines functions to create and update deposits.

type ETH1Deposit added in v0.2.0

type ETH1Deposit struct {
	ETH1BlockNumber       uint64
	ETH1BlockHash         []byte
	ETH1BlockTimestamp    time.Time
	ETH1TxHash            []byte
	ETH1LogIndex          uint64
	ETH1Sender            []byte
	ETH1Recipient         []byte
	ETH1GasUsed           uint64
	ETH1GasPrice          uint64
	DepositIndex          uint64
	ValidatorPubKey       phase0.BLSPubKey
	WithdrawalCredentials []byte
	Signature             phase0.BLSSignature
	Amount                phase0.Gwei
}

ETH1Deposit holds information about an Ethereum 2 deposit made on the Ethereum 1 chain.

type ETH1DepositsProvider added in v0.2.0

type ETH1DepositsProvider interface {
	// ETH1DepositsByPublicKey fetches Ethereum 1 deposits for a given set of validator public keys.
	ETH1DepositsByPublicKey(ctx context.Context, pubKeys []phase0.BLSPubKey) ([]*ETH1Deposit, error)
}

ETH1DepositsProvider defines functions to access Ethereum 1 deposits.

type ETH1DepositsSetter added in v0.2.0

type ETH1DepositsSetter interface {
	// SetETH1Deposit sets an Ethereum 1 deposit.
	SetETH1Deposit(ctx context.Context, deposit *ETH1Deposit) error
}

ETH1DepositsSetter defines functions to create and update Ethereum 1 deposits.

type EpochSummariesSetter added in v0.3.0

type EpochSummariesSetter interface {
	// SetEpochSummary sets an epoch summary.
	SetEpochSummary(ctx context.Context, summary *EpochSummary) error
}

EpochSummariesSetter defines functions to create and update epoch summaries.

type EpochSummary added in v0.3.0

type EpochSummary struct {
	Epoch                         phase0.Epoch
	ActivationQueueLength         int
	ActivatingValidators          int
	ActiveValidators              int
	ActiveRealBalance             phase0.Gwei
	ActiveBalance                 phase0.Gwei
	AttestingValidators           int
	AttestingBalance              phase0.Gwei
	TargetCorrectValidators       int
	TargetCorrectBalance          phase0.Gwei
	HeadCorrectValidators         int
	HeadCorrectBalance            phase0.Gwei
	AttestationsForEpoch          int
	AttestationsInEpoch           int
	DuplicateAttestationsForEpoch int
	ProposerSlashings             int
	AttesterSlashings             int
	Deposits                      int
	ExitingValidators             int
	CanonicalBlocks               int
}

EpochSummary provides a summary of an epoch.

type ForkScheduleProvider added in v0.4.0

type ForkScheduleProvider interface {
	// ForkSchedule provides details of past and future changes in the chain's fork version.
	ForkSchedule(ctx context.Context) ([]*phase0.Fork, error)
}

ForkScheduleProvider defines functions to access fork schedule information.

type ForkScheduleSetter added in v0.4.0

type ForkScheduleSetter interface {
	// SetForkSchedule sets the fork schedule.
	SetForkSchedule(ctx context.Context, schedule []*phase0.Fork) error
}

ForkScheduleSetter defines functions to create and update fork schedule information.

type GenesisProvider added in v0.2.0

type GenesisProvider interface {
	// Genesis fetches genesis values.
	Genesis(ctx context.Context) (*api.Genesis, error)
}

GenesisProvider defines functions to access genesis information.

type GenesisSetter added in v0.2.0

type GenesisSetter interface {
	// SetGenesis sets the genesis information.
	SetGenesis(ctx context.Context, genesis *api.Genesis) error
}

GenesisSetter defines functions to create and update genesis information.

type ProposerDutiesProvider added in v0.3.0

type ProposerDutiesProvider interface {
	// ProposerDutiesForSlotRange fetches all proposer duties for the given slot range.
	// Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide
	// proposer duties for slots 2 and 3.
	ProposerDutiesForSlotRange(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot) ([]*ProposerDuty, error)
}

ProposerDutiesProvider defines functions to access proposer duties.

type ProposerDutiesSetter added in v0.1.4

type ProposerDutiesSetter interface {
	// SetProposerDuty sets a proposer duty.
	SetProposerDuty(ctx context.Context, proposerDuty *ProposerDuty) error
}

ProposerDutiesSetter defines the functions to create and update proposer duties.

type ProposerDuty

type ProposerDuty struct {
	Slot           phase0.Slot
	ValidatorIndex phase0.ValidatorIndex
}

ProposerDuty holds information for proposer duties.

type ProposerSlashing

type ProposerSlashing struct {
	InclusionSlot        phase0.Slot
	InclusionBlockRoot   phase0.Root
	InclusionIndex       uint64
	Block1Root           phase0.Root
	Header1Slot          phase0.Slot
	Header1ProposerIndex phase0.ValidatorIndex
	Header1ParentRoot    phase0.Root
	Header1StateRoot     phase0.Root
	Header1BodyRoot      phase0.Root
	Header1Signature     phase0.BLSSignature
	Block2Root           phase0.Root
	Header2Slot          phase0.Slot
	Header2ProposerIndex phase0.ValidatorIndex
	Header2ParentRoot    phase0.Root
	Header2StateRoot     phase0.Root
	Header2BodyRoot      phase0.Root
	Header2Signature     phase0.BLSSignature
}

ProposerSlashing holds information about a proposer slashing included by a block.

type ProposerSlashingsProvider added in v0.1.4

type ProposerSlashingsProvider interface {
	// ProposerSlashingsForSlotRange fetches all proposer slashings made for the given slot range.
	// It will return slashings from blocks that are canonical or undefined, but not from non-canonical blocks.
	ProposerSlashingsForSlotRange(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]*ProposerSlashing, error)

	// ProposerSlashingsForValidator fetches all proposer slashings made for the given validator.
	// It will return slashings from blocks that are canonical or undefined, but not from non-canonical blocks.
	ProposerSlashingsForValidator(ctx context.Context, index phase0.ValidatorIndex) ([]*ProposerSlashing, error)
}

ProposerSlashingsProvider defines functions to access proposer slashings.

type ProposerSlashingsSetter added in v0.1.4

type ProposerSlashingsSetter interface {
	// SetProposerSlashing sets an proposer slashing.
	SetProposerSlashing(ctx context.Context, proposerSlashing *ProposerSlashing) error
}

ProposerSlashingsSetter defines functions to create and update proposer slashings.

type Service

type Service interface {
	// BeginTx begins a transaction.
	BeginTx(ctx context.Context) (context.Context, context.CancelFunc, error)

	// CommitTx commits a transaction.
	CommitTx(ctx context.Context) error

	// SetMetadata sets a metadata key to a JSON value.
	SetMetadata(ctx context.Context, key string, value []byte) error

	// Metadata obtains the JSON value from a metadata key.
	Metadata(ctx context.Context, key string) ([]byte, error)
}

Service defines a minimal chain database service.

type SyncAggregate added in v0.4.0

type SyncAggregate struct {
	InclusionSlot      phase0.Slot
	InclusionBlockRoot phase0.Root
	Bits               []byte
	Indices            []phase0.ValidatorIndex
}

SyncAggregate holds information about a sync aggregate included in a block.

type SyncAggregateProvider added in v0.4.0

type SyncAggregateProvider interface {
	// SyncAggregateForBlock provides the sync aggregate for the supplied block root.
	SyncAggregateForBlock(ctx context.Context, blockRoot phase0.Root) (*SyncAggregate, error)
}

SyncAggregateProvider defines functions to access sync aggregate information.

type SyncAggregateSetter added in v0.4.0

type SyncAggregateSetter interface {
	// SetSyncAggregate sets the sync aggregate.
	SetSyncAggregate(ctx context.Context, syncAggregate *SyncAggregate) error
}

SyncAggregateSetter defines functions to create and update fork schedule information.

type SyncCommittee added in v0.4.0

type SyncCommittee struct {
	Period    uint64
	Committee []phase0.ValidatorIndex
}

SyncCommittee holds information for sync committees.

type SyncCommitteesProvider added in v0.4.0

type SyncCommitteesProvider interface {
	// SyncCommittee provides a sync committee for the given sync committee period.
	SyncCommittee(ctx context.Context, period uint64) (*SyncCommittee, error)
}

SyncCommitteesProvider defines functions to obtain sync committee information.

type SyncCommitteesSetter added in v0.4.0

type SyncCommitteesSetter interface {
	// SetSyncCommittee sets a sync committee.
	SetSyncCommittee(ctx context.Context, syncCommittee *SyncCommittee) error
}

SyncCommitteesSetter defines functions to create and update sync committee information.

type Validator

type Validator struct {
	PublicKey                  phase0.BLSPubKey
	Index                      phase0.ValidatorIndex
	EffectiveBalance           phase0.Gwei
	Slashed                    bool
	ActivationEligibilityEpoch phase0.Epoch
	ActivationEpoch            phase0.Epoch
	ExitEpoch                  phase0.Epoch
	WithdrawableEpoch          phase0.Epoch
}

Validator holds information about a validator.

type ValidatorBalance

type ValidatorBalance struct {
	Index            phase0.ValidatorIndex
	Epoch            phase0.Epoch
	Balance          phase0.Gwei
	EffectiveBalance phase0.Gwei
}

ValidatorBalance holds information about a validator's balance at a given epoch.

type ValidatorEpochSummariesSetter added in v0.3.0

type ValidatorEpochSummariesSetter interface {
	// SetValidatorEpochSummary sets a validator epoch summary.
	SetValidatorEpochSummary(ctx context.Context, summary *ValidatorEpochSummary) error
}

ValidatorEpochSummariesSetter defines functions to create and update validator epoch summaries.

type ValidatorEpochSummary added in v0.3.0

type ValidatorEpochSummary struct {
	Index                     phase0.ValidatorIndex
	Epoch                     phase0.Epoch
	ProposerDuties            int
	ProposalsIncluded         int
	AttestationIncluded       bool
	AttestationTargetCorrect  *bool
	AttestationHeadCorrect    *bool
	AttestationInclusionDelay *int
	AttestationSourceTimely   *bool
	AttestationTargetTimely   *bool
	AttestationHeadTimely     *bool
}

ValidatorEpochSummary provides a summary of a validator's operations for an epoch.

type ValidatorsProvider added in v0.1.4

type ValidatorsProvider interface {
	// Validators fetches all validators.
	Validators(ctx context.Context) ([]*Validator, error)

	// ValidatorsByPublicKey fetches all validators matching the given public keys.
	// This is a common starting point for external entities to query specific validators, as they should
	// always have the public key at a minimum, hence the return map keyed by public key.
	ValidatorsByPublicKey(ctx context.Context, pubKeys []phase0.BLSPubKey) (map[phase0.BLSPubKey]*Validator, error)

	// ValidatorsByIndex fetches all validators matching the given indices.
	ValidatorsByIndex(ctx context.Context, indices []phase0.ValidatorIndex) (map[phase0.ValidatorIndex]*Validator, error)

	// ValidatorBalancesByIndexAndEpoch fetches the validator balances for the given validators and epoch.
	ValidatorBalancesByIndexAndEpoch(
		ctx context.Context,
		indices []phase0.ValidatorIndex,
		epoch phase0.Epoch,
	) (
		map[phase0.ValidatorIndex]*ValidatorBalance,
		error,
	)

	// ValidatorBalancesByIndexAndEpochRange fetches the validator balances for the given validators and epoch range.
	// Ranges are inclusive of start and exclusive of end i.e. a request with startEpoch 2 and endEpoch 4 will provide
	// balances for epochs 2 and 3.
	ValidatorBalancesByIndexAndEpochRange(
		ctx context.Context,
		indices []phase0.ValidatorIndex,
		startEpoch phase0.Epoch,
		endEpoch phase0.Epoch,
	) (
		map[phase0.ValidatorIndex][]*ValidatorBalance,
		error,
	)

	// ValidatorBalancesByIndexAndEpochs fetches the validator balances for the given validators at the specified epochs.
	ValidatorBalancesByIndexAndEpochs(
		ctx context.Context,
		indices []phase0.ValidatorIndex,
		epochs []phase0.Epoch,
	) (
		map[phase0.ValidatorIndex][]*ValidatorBalance,
		error,
	)
}

ValidatorsProvider defines functions to access validator information.

type ValidatorsSetter added in v0.1.4

type ValidatorsSetter interface {
	// SetValidator sets a validator.
	SetValidator(ctx context.Context, validator *Validator) error

	// SetValidatorBalance sets a validator balance.
	SetValidatorBalance(ctx context.Context, validatorBalance *ValidatorBalance) error
}

ValidatorsSetter defines functions to create and update validator information.

type VoluntaryExit

type VoluntaryExit struct {
	InclusionSlot      phase0.Slot
	InclusionBlockRoot phase0.Root
	InclusionIndex     uint64
	ValidatorIndex     phase0.ValidatorIndex
	Epoch              phase0.Epoch
}

VoluntaryExit holds information about a voluntary exit included in a block.

type VoluntaryExitsSetter added in v0.1.4

type VoluntaryExitsSetter interface {
	// SetVoluntaryExit sets a voluntary exit.
	SetVoluntaryExit(ctx context.Context, voluntaryExit *VoluntaryExit) error
}

VoluntaryExitsSetter defines functions to create and update voluntary exits.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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