Documentation ¶
Index ¶
- Variables
- type Parameter
- type Service
- func (s *Service) AggregateValidatorBalancesByIndexAndEpoch(ctx context.Context, validatorIndices []spec.ValidatorIndex, epoch spec.Epoch) (*chaindb.AggregateValidatorBalance, error)
- func (s *Service) AggregateValidatorBalancesByIndexAndEpochRange(ctx context.Context, validatorIndices []spec.ValidatorIndex, ...) ([]*chaindb.AggregateValidatorBalance, error)
- func (s *Service) AggregateValidatorBalancesByIndexAndEpochs(ctx context.Context, validatorIndices []spec.ValidatorIndex, ...) ([]*chaindb.AggregateValidatorBalance, error)
- func (s *Service) AttestationsForBlock(ctx context.Context, blockRoot spec.Root) ([]*chaindb.Attestation, error)
- func (s *Service) AttestationsForSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]*chaindb.Attestation, error)
- func (s *Service) AttestationsInBlock(ctx context.Context, blockRoot spec.Root) ([]*chaindb.Attestation, error)
- func (s *Service) AttestationsInSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]*chaindb.Attestation, error)
- func (s *Service) AttesterDuties(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot, ...) ([]*chaindb.AttesterDuty, error)
- func (s *Service) AttesterSlashingsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*chaindb.AttesterSlashing, error)
- func (s *Service) AttesterSlashingsForValidator(ctx context.Context, index spec.ValidatorIndex) ([]*chaindb.AttesterSlashing, error)
- func (s *Service) BeaconCommitteeBySlotAndIndex(ctx context.Context, slot spec.Slot, index spec.CommitteeIndex) (*chaindb.BeaconCommittee, error)
- func (s *Service) BeginTx(ctx context.Context) (context.Context, context.CancelFunc, error)
- func (s *Service) BlockByRoot(ctx context.Context, root spec.Root) (*chaindb.Block, error)
- func (s *Service) BlocksByParentRoot(ctx context.Context, parentRoot spec.Root) ([]*chaindb.Block, error)
- func (s *Service) BlocksBySlot(ctx context.Context, slot spec.Slot) ([]*chaindb.Block, error)
- func (s *Service) BlocksForSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]*chaindb.Block, error)
- func (s *Service) CanonicalBlockPresenceForSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]bool, error)
- func (s *Service) ChainSpec(ctx context.Context) (map[string]interface{}, error)
- func (s *Service) ChainSpecValue(ctx context.Context, key string) (interface{}, error)
- func (s *Service) CommitTx(ctx context.Context) error
- func (s *Service) DepositsByPublicKey(ctx context.Context, pubKeys []spec.BLSPubKey) (map[spec.BLSPubKey][]*chaindb.Deposit, error)
- func (s *Service) DepositsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*chaindb.Deposit, error)
- func (s *Service) ETH1DepositsByPublicKey(ctx context.Context, pubKeys []spec.BLSPubKey) ([]*chaindb.ETH1Deposit, error)
- func (s *Service) EmptySlots(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Slot, error)
- func (s *Service) Genesis(ctx context.Context) (*api.Genesis, error)
- func (s *Service) GenesisTime(ctx context.Context) (time.Time, error)
- func (s *Service) IndeterminateAttestationSlots(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Slot, error)
- func (s *Service) IndeterminateBlocks(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Root, error)
- func (s *Service) Init(ctx context.Context) (bool, error)
- func (s *Service) LatestBlocks(ctx context.Context) ([]*chaindb.Block, error)
- func (s *Service) LatestCanonicalBlock(ctx context.Context) (spec.Slot, error)
- func (s *Service) Metadata(ctx context.Context, key string) ([]byte, error)
- func (s *Service) ProposerDutiesForSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]*chaindb.ProposerDuty, error)
- func (s *Service) ProposerSlashingsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*chaindb.ProposerSlashing, error)
- func (s *Service) ProposerSlashingsForValidator(ctx context.Context, index spec.ValidatorIndex) ([]*chaindb.ProposerSlashing, error)
- func (s *Service) SetAttestation(ctx context.Context, attestation *chaindb.Attestation) error
- func (s *Service) SetAttesterSlashing(ctx context.Context, attesterSlashing *chaindb.AttesterSlashing) error
- func (s *Service) SetBeaconCommittee(ctx context.Context, beaconCommittee *chaindb.BeaconCommittee) error
- func (s *Service) SetBlock(ctx context.Context, block *chaindb.Block) error
- func (s *Service) SetBlockSummary(ctx context.Context, summary *chaindb.BlockSummary) error
- func (s *Service) SetChainSpecValue(ctx context.Context, key string, value interface{}) error
- func (s *Service) SetDeposit(ctx context.Context, deposit *chaindb.Deposit) error
- func (s *Service) SetETH1Deposit(ctx context.Context, deposit *chaindb.ETH1Deposit) error
- func (s *Service) SetEpochSummary(ctx context.Context, summary *chaindb.EpochSummary) error
- func (s *Service) SetGenesis(ctx context.Context, genesis *api.Genesis) error
- func (s *Service) SetMetadata(ctx context.Context, key string, value []byte) error
- func (s *Service) SetProposerDuty(ctx context.Context, proposerDuty *chaindb.ProposerDuty) error
- func (s *Service) SetProposerSlashing(ctx context.Context, proposerSlashing *chaindb.ProposerSlashing) error
- func (s *Service) SetValidator(ctx context.Context, validator *chaindb.Validator) error
- func (s *Service) SetValidatorBalance(ctx context.Context, balance *chaindb.ValidatorBalance) error
- func (s *Service) SetValidatorEpochSummary(ctx context.Context, summary *chaindb.ValidatorEpochSummary) error
- func (s *Service) SetVoluntaryExit(ctx context.Context, voluntaryExit *chaindb.VoluntaryExit) error
- func (s *Service) SlotDuration(ctx context.Context) (time.Duration, error)
- func (s *Service) SlotsPerEpoch(ctx context.Context) (uint64, error)
- func (s *Service) Spec(ctx context.Context) (map[string]interface{}, error)
- func (s *Service) Upgrade(ctx context.Context) (bool, error)
- func (s *Service) ValidatorBalancesByIndexAndEpoch(ctx context.Context, validatorIndices []spec.ValidatorIndex, epoch spec.Epoch) (map[spec.ValidatorIndex]*chaindb.ValidatorBalance, error)
- func (s *Service) ValidatorBalancesByIndexAndEpochRange(ctx context.Context, validatorIndices []spec.ValidatorIndex, ...) (map[spec.ValidatorIndex][]*chaindb.ValidatorBalance, error)
- func (s *Service) ValidatorBalancesByIndexAndEpochs(ctx context.Context, validatorIndices []spec.ValidatorIndex, ...) (map[spec.ValidatorIndex][]*chaindb.ValidatorBalance, error)
- func (s *Service) Validators(ctx context.Context) ([]*chaindb.Validator, error)
- func (s *Service) ValidatorsByIndex(ctx context.Context, indices []spec.ValidatorIndex) (map[spec.ValidatorIndex]*chaindb.Validator, error)
- func (s *Service) ValidatorsByPublicKey(ctx context.Context, pubKeys []spec.BLSPubKey) (map[spec.BLSPubKey]*chaindb.Validator, error)
- type Tx
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoTransaction is returned when an attempt to carry out a mutation to the database // is not inside a transaction. ErrNoTransaction = errors.New("no transaction for action") )
Functions ¶
This section is empty.
Types ¶
type Parameter ¶
type Parameter interface {
// contains filtered or unexported methods
}
Parameter is the interface for service parameters.
func WithConnectionURL ¶
WithConnectionURL sets the connection URL for this module.
func WithLogLevel ¶
WithLogLevel sets the log level for the module.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a chain database service.
func (*Service) AggregateValidatorBalancesByIndexAndEpoch ¶ added in v0.2.0
func (s *Service) AggregateValidatorBalancesByIndexAndEpoch( ctx context.Context, validatorIndices []spec.ValidatorIndex, epoch spec.Epoch, ) ( *chaindb.AggregateValidatorBalance, error, )
AggregateValidatorBalancesByIndexAndEpoch fetches the aggregate validator balances for the given validators and epoch.
func (*Service) AggregateValidatorBalancesByIndexAndEpochRange ¶ added in v0.2.0
func (s *Service) AggregateValidatorBalancesByIndexAndEpochRange( ctx context.Context, validatorIndices []spec.ValidatorIndex, startEpoch spec.Epoch, endEpoch spec.Epoch, ) ( []*chaindb.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.
func (*Service) AggregateValidatorBalancesByIndexAndEpochs ¶ added in v0.2.0
func (s *Service) AggregateValidatorBalancesByIndexAndEpochs( ctx context.Context, validatorIndices []spec.ValidatorIndex, epochs []spec.Epoch, ) ( []*chaindb.AggregateValidatorBalance, error, )
AggregateValidatorBalancesByIndexAndEpochs fetches the validator balances for the given validators at the specified epochs.
func (*Service) AttestationsForBlock ¶ added in v0.1.5
func (s *Service) AttestationsForBlock(ctx context.Context, blockRoot spec.Root) ([]*chaindb.Attestation, error)
AttestationsForBlock fetches all attestations made for the given block.
func (*Service) AttestationsForSlotRange ¶ added in v0.1.5
func (s *Service) AttestationsForSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]*chaindb.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.
func (*Service) AttestationsInBlock ¶ added in v0.1.5
func (s *Service) AttestationsInBlock(ctx context.Context, blockRoot spec.Root) ([]*chaindb.Attestation, error)
AttestationsInBlock fetches all attestations contained in the given block.
func (*Service) AttestationsInSlotRange ¶ added in v0.2.0
func (s *Service) AttestationsInSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]*chaindb.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.
func (*Service) AttesterDuties ¶ added in v0.1.5
func (s *Service) AttesterDuties(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot, validatorIndices []spec.ValidatorIndex) ([]*chaindb.AttesterDuty, error)
AttesterDuties fetches the attester duties at the given slot range for the given validator indices.
func (*Service) AttesterSlashingsForSlotRange ¶ added in v0.3.0
func (s *Service) AttesterSlashingsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*chaindb.AttesterSlashing, error)
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.
func (*Service) AttesterSlashingsForValidator ¶ added in v0.3.0
func (s *Service) AttesterSlashingsForValidator(ctx context.Context, index spec.ValidatorIndex) ([]*chaindb.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.
func (*Service) BeaconCommitteeBySlotAndIndex ¶ added in v0.1.5
func (s *Service) BeaconCommitteeBySlotAndIndex(ctx context.Context, slot spec.Slot, index spec.CommitteeIndex) (*chaindb.BeaconCommittee, error)
BeaconCommitteeBySlotAndIndex fetches the beacon committee with the given slot and index.
func (*Service) BeginTx ¶
BeginTx begins a transaction on the database. The transaction can be rolled back by invoking the cancel function.
func (*Service) BlockByRoot ¶ added in v0.1.5
BlockByRoot fetches the block with the given root.
func (*Service) BlocksByParentRoot ¶ added in v0.1.5
func (s *Service) BlocksByParentRoot(ctx context.Context, parentRoot spec.Root) ([]*chaindb.Block, error)
BlocksByParentRoot fetches the blocks with the given root.
func (*Service) BlocksBySlot ¶ added in v0.1.5
BlocksBySlot fetches all blocks with the given slot.
func (*Service) BlocksForSlotRange ¶ added in v0.3.0
func (s *Service) BlocksForSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]*chaindb.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.
func (*Service) CanonicalBlockPresenceForSlotRange ¶ added in v0.3.0
func (s *Service) CanonicalBlockPresenceForSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot) ([]bool, 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.
func (*Service) ChainSpecValue ¶ added in v0.2.0
ChainSpecValue fetches a chain specification value given its key.
func (*Service) DepositsByPublicKey ¶ added in v0.2.0
func (s *Service) DepositsByPublicKey(ctx context.Context, pubKeys []spec.BLSPubKey) (map[spec.BLSPubKey][]*chaindb.Deposit, error)
DepositsByPublicKey fetches deposits for a given set of validator public keys.
func (*Service) DepositsForSlotRange ¶ added in v0.3.0
func (s *Service) DepositsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*chaindb.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.
func (*Service) ETH1DepositsByPublicKey ¶ added in v0.2.0
func (s *Service) ETH1DepositsByPublicKey(ctx context.Context, pubKeys []spec.BLSPubKey) ([]*chaindb.ETH1Deposit, error)
ETH1DepositsByPublicKey fetches Ethereum 1 deposits for a given set of validator public keys.
func (*Service) EmptySlots ¶ added in v0.1.5
func (s *Service) EmptySlots(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Slot, error)
EmptySlots fetches the slots in the given range without a block in the database.
func (*Service) GenesisTime ¶ added in v0.2.0
GenesisTime provides the genesis time of the chain.
func (*Service) IndeterminateAttestationSlots ¶ added in v0.2.0
func (s *Service) IndeterminateAttestationSlots(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Slot, error)
IndeterminateAttestationSlots fetches the slots in the given range with attestations that do not have a canonical status.
func (*Service) IndeterminateBlocks ¶ added in v0.2.0
func (s *Service) IndeterminateBlocks(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Root, error)
IndeterminateBlocks fetches the blocks in the given range that do not have a canonical status.
func (*Service) LatestBlocks ¶ added in v0.2.0
LatestBlocks fetches the blocks with the highest slot number for in the database.
func (*Service) LatestCanonicalBlock ¶ added in v0.3.0
LatestCanonicalBlock returns the slot of the latest canonical block known in the database.
func (*Service) ProposerDutiesForSlotRange ¶ added in v0.3.0
func (s *Service) ProposerDutiesForSlotRange(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot, ) ( []*chaindb.ProposerDuty, error, )
ProposerDutiesForSlotRange fetches all proposer duties for a slot range.
func (*Service) ProposerSlashingsForSlotRange ¶ added in v0.1.5
func (s *Service) ProposerSlashingsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*chaindb.ProposerSlashing, error)
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.
func (*Service) ProposerSlashingsForValidator ¶ added in v0.3.0
func (s *Service) ProposerSlashingsForValidator(ctx context.Context, index spec.ValidatorIndex) ([]*chaindb.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.
func (*Service) SetAttestation ¶
SetAttestation sets an attestation.
func (*Service) SetAttesterSlashing ¶
func (s *Service) SetAttesterSlashing(ctx context.Context, attesterSlashing *chaindb.AttesterSlashing) error
SetAttesterSlashing sets an attester slashing.
func (*Service) SetBeaconCommittee ¶
func (s *Service) SetBeaconCommittee(ctx context.Context, beaconCommittee *chaindb.BeaconCommittee) error
SetBeaconCommittee sets a beacon committee.
func (*Service) SetBlockSummary ¶ added in v0.3.0
SetBlockSummary sets a block summary.
func (*Service) SetChainSpecValue ¶ added in v0.2.0
SetChainSpecValue sets the value of the provided key.
func (*Service) SetDeposit ¶ added in v0.2.0
SetDeposit sets a deposit.
func (*Service) SetETH1Deposit ¶ added in v0.2.0
SetETH1Deposit sets an Ethereum 1 deposit.
func (*Service) SetEpochSummary ¶ added in v0.3.0
SetEpochSummary sets an epoch summary.
func (*Service) SetGenesis ¶ added in v0.2.0
SetGenesis sets the genesis information.
func (*Service) SetMetadata ¶
SetMetadata sets a metadata key to a JSON value.
func (*Service) SetProposerDuty ¶
SetProposerDuty sets a proposer duty.
func (*Service) SetProposerSlashing ¶
func (s *Service) SetProposerSlashing(ctx context.Context, proposerSlashing *chaindb.ProposerSlashing) error
SetProposerSlashing sets a proposer slashing.
func (*Service) SetValidator ¶
SetValidator sets a validator.
func (*Service) SetValidatorBalance ¶
SetValidatorBalance sets a validator's balance.
func (*Service) SetValidatorEpochSummary ¶ added in v0.3.0
func (s *Service) SetValidatorEpochSummary(ctx context.Context, summary *chaindb.ValidatorEpochSummary) error
SetValidatorEpochSummary sets a validator epoch summary.
func (*Service) SetVoluntaryExit ¶
SetVoluntaryExit sets a voluntary exit.
func (*Service) SlotDuration ¶ added in v0.2.0
SlotDuration provides the duration of a slot of the chain.
func (*Service) SlotsPerEpoch ¶ added in v0.2.0
SlotsPerEpoch provides the slots per epoch of the chain.
func (*Service) Upgrade ¶ added in v0.2.0
Upgrade upgrades the database. Returns true if the upgrade requires blocks to be refetched.
func (*Service) ValidatorBalancesByIndexAndEpoch ¶ added in v0.1.5
func (s *Service) ValidatorBalancesByIndexAndEpoch( ctx context.Context, validatorIndices []spec.ValidatorIndex, epoch spec.Epoch, ) ( map[spec.ValidatorIndex]*chaindb.ValidatorBalance, error, )
ValidatorBalancesByIndexAndEpoch fetches the validator balances for the given validators and epoch.
func (*Service) ValidatorBalancesByIndexAndEpochRange ¶ added in v0.1.5
func (s *Service) ValidatorBalancesByIndexAndEpochRange( ctx context.Context, validatorIndices []spec.ValidatorIndex, startEpoch spec.Epoch, endEpoch spec.Epoch, ) ( map[spec.ValidatorIndex][]*chaindb.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.
func (*Service) ValidatorBalancesByIndexAndEpochs ¶ added in v0.1.5
func (s *Service) ValidatorBalancesByIndexAndEpochs( ctx context.Context, validatorIndices []spec.ValidatorIndex, epochs []spec.Epoch, ) ( map[spec.ValidatorIndex][]*chaindb.ValidatorBalance, error, )
ValidatorBalancesByIndexAndEpochs fetches the validator balances for the given validators at the specified epochs.
func (*Service) Validators ¶ added in v0.1.4
Validators fetches all validators.
func (*Service) ValidatorsByIndex ¶ added in v0.1.5
func (s *Service) ValidatorsByIndex(ctx context.Context, indices []spec.ValidatorIndex) (map[spec.ValidatorIndex]*chaindb.Validator, error)
ValidatorsByIndex fetches all validators matching the given indices.
func (*Service) ValidatorsByPublicKey ¶ added in v0.1.5
func (s *Service) ValidatorsByPublicKey(ctx context.Context, pubKeys []spec.BLSPubKey) (map[spec.BLSPubKey]*chaindb.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.
Source Files ¶
- aggregatevalidatorbalances.go
- attestations.go
- attesterslashing.go
- beaconcommittees.go
- blocks.go
- blocksummaries.go
- chainspec.go
- deposits.go
- epochsummaries.go
- eth1deposits.go
- genesis.go
- metadata.go
- parameters.go
- proposerduties.go
- proposerslashings.go
- service.go
- spec.go
- tx.go
- upgrader.go
- validatorepochsummaries.go
- validators.go
- voluntaryexits.go