beacondb

package
v0.1.1-experimental.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVStore

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

KVStore is a wrapper around an sdk.Context that provides access to all beacon related data.

func New

func New(
	kss store.KVStoreService,
) *KVStore

Store creates a new instance of Store.

func (*KVStore) AddValidator

func (kv *KVStore) AddValidator(
	val *beacontypes.Validator,
) error

AddValidator registers a new validator in the beacon state.

func (*KVStore) Context

func (kv *KVStore) Context() context.Context

Context returns the context of the Store.

func (*KVStore) Copy

func (kv *KVStore) Copy() *KVStore

Copy returns a copy of the Store.

func (*KVStore) DequeueDeposits

func (kv *KVStore) DequeueDeposits(
	numDequeue uint64,
) (beacontypes.Deposits, error)

DequeueDeposits returns the first numDequeue deposits in the queue.

func (*KVStore) EnqueueDeposits

func (kv *KVStore) EnqueueDeposits(
	deposits beacontypes.Deposits,
) error

EnqueueDeposits pushes the deposits to the queue.

func (*KVStore) ExpectedDeposits

func (kv *KVStore) ExpectedDeposits(
	numView uint64,
) (beacontypes.Deposits, error)

ExpectedDeposits returns the first numPeek deposits in the queue.

func (*KVStore) GetBalance

func (kv *KVStore) GetBalance(
	idx primitives.ValidatorIndex,
) (primitives.Gwei, error)

GetBalance returns the balance of a validator.

func (*KVStore) GetBalances

func (kv *KVStore) GetBalances() ([]uint64, error)

GetBalances returns the balancse of all validator.

func (*KVStore) GetBlockRootAtIndex

func (kv *KVStore) GetBlockRootAtIndex(
	index uint64,
) (primitives.Root, error)

GetBlockRoot retrieves the block root from the BeaconStore.

func (*KVStore) GetEth1BlockHash

func (kv *KVStore) GetEth1BlockHash() (primitives.ExecutionHash, error)

GetEth1Hash retrieves the Eth1 hash from the BeaconStore.

func (*KVStore) GetEth1DepositIndex

func (kv *KVStore) GetEth1DepositIndex() (uint64, error)

GetEth1DepositIndex retrieves the eth1 deposit index from the beacon state.

func (*KVStore) GetFork

func (kv *KVStore) GetFork() (*primitives.Fork, error)

GetFork gets the fork version for the given epoch.

func (*KVStore) GetGenesisValidatorsRoot

func (kv *KVStore) GetGenesisValidatorsRoot() (primitives.Root, error)

GetGenesisValidatorsRoot retrieves the genesis validators root from the beacon state.

func (*KVStore) GetLatestBlockHeader

func (kv *KVStore) GetLatestBlockHeader() (
	*primitives.BeaconBlockHeader, error,
)

GetLatestBlockHeader retrieves the latest block header from the BeaconStore.

func (*KVStore) GetNextWithdrawalIndex

func (kv *KVStore) GetNextWithdrawalIndex() (uint64, error)

GetNextWithdrawalIndex returns the next withdrawal index.

func (*KVStore) GetNextWithdrawalValidatorIndex

func (kv *KVStore) GetNextWithdrawalValidatorIndex() (
	primitives.ValidatorIndex, error,
)

GetNextWithdrawalValidatorIndex returns the next withdrawal validator index.

func (*KVStore) GetRandaoMixAtIndex

func (kv *KVStore) GetRandaoMixAtIndex(
	index uint64,
) (primitives.Bytes32, error)

GetRandaoMixAtIndex retrieves the current RANDAO mix from the store.

func (*KVStore) GetSlashingAtIndex

func (kv *KVStore) GetSlashingAtIndex(index uint64) (primitives.Gwei, error)

GetSlashingAtIndex retrieves the slashing amount by index from the store.

func (*KVStore) GetSlashings

func (kv *KVStore) GetSlashings() ([]uint64, error)

func (*KVStore) GetSlot

func (kv *KVStore) GetSlot() (primitives.Slot, error)

GetSlot returns the current slot.

func (*KVStore) GetTotalActiveBalances

func (kv *KVStore) GetTotalActiveBalances(
	slotsPerEpoch uint64,
) (primitives.Gwei, error)

GetTotalActiveBalances returns the total active balances of all validatorkv. TODO: unhood this and probably store this as just a value changed on writekv. TODO: this shouldn't live in KVStore

func (*KVStore) GetTotalSlashing

func (kv *KVStore) GetTotalSlashing() (primitives.Gwei, error)

TotalSlashing retrieves the total slashing amount from the store.

func (*KVStore) GetTotalValidators

func (kv *KVStore) GetTotalValidators() (uint64, error)

GetTotalValidators returns the total number of validators.

func (*KVStore) GetValidators

func (kv *KVStore) GetValidators() (
	[]*beacontypes.Validator, error,
)

GetValidators retrieves all validators from the beacon state.

func (*KVStore) GetValidatorsByEffectiveBalance

func (kv *KVStore) GetValidatorsByEffectiveBalance() (
	[]*beacontypes.Validator, error,
)

GetValidatorsByEffectiveBalance retrieves all validators sorted by effective balance from the beacon state.

func (*KVStore) RemoveValidatorAtIndex

func (kv *KVStore) RemoveValidatorAtIndex(
	idx primitives.ValidatorIndex,
) error

RemoveValidatorAtIndex removes a validator at a specified index.

func (*KVStore) Save

func (kv *KVStore) Save()

Save saves the Store.

func (*KVStore) SetBalance

func (kv *KVStore) SetBalance(
	idx primitives.ValidatorIndex,
	balance primitives.Gwei,
) error

SetBalance sets the balance of a validator.

func (*KVStore) SetEth1DepositIndex

func (kv *KVStore) SetEth1DepositIndex(index uint64) error

SetEth1DepositIndex sets the eth1 deposit index in the beacon state.

func (*KVStore) SetFork

func (kv *KVStore) SetFork(fork *primitives.Fork) error

SetFork sets the fork version for the given epoch.

func (*KVStore) SetGenesisValidatorsRoot

func (kv *KVStore) SetGenesisValidatorsRoot(
	root primitives.Root,
) error

SetGenesisValidatorsRoot sets the genesis validators root in the beacon state.

func (*KVStore) SetLatestBlockHeader

func (kv *KVStore) SetLatestBlockHeader(
	header *primitives.BeaconBlockHeader,
) error

SetLatestBlockHeader sets the latest block header in the BeaconStore.

func (*KVStore) SetNextWithdrawalIndex

func (kv *KVStore) SetNextWithdrawalIndex(
	index uint64,
) error

SetNextWithdrawalIndex sets the next withdrawal index.

func (*KVStore) SetNextWithdrawalValidatorIndex

func (kv *KVStore) SetNextWithdrawalValidatorIndex(
	index primitives.ValidatorIndex,
) error

SetNextWithdrawalValidatorIndex sets the next withdrawal validator index.

func (*KVStore) SetSlashingAtIndex

func (kv *KVStore) SetSlashingAtIndex(
	index uint64,
	amount primitives.Gwei,
) error

SetSlashingAtIndex sets the slashing amount in the store.

func (*KVStore) SetSlot

func (kv *KVStore) SetSlot(slot primitives.Slot) error

SetSlot sets the current slot.

func (*KVStore) SetTotalSlashing

func (kv *KVStore) SetTotalSlashing(amount primitives.Gwei) error

SetTotalSlashing sets the total slashing amount in the store.

func (*KVStore) StateRootAtIndex

func (kv *KVStore) StateRootAtIndex(idx uint64) (primitives.Root, error)

StateRootAtIndex returns the state root at the given slot.

func (*KVStore) UpdateBlockRootAtIndex

func (kv *KVStore) UpdateBlockRootAtIndex(
	index uint64,
	root primitives.Root,
) error

UpdateBlockRootAtIndex sets a block root in the BeaconStore.

func (*KVStore) UpdateEth1BlockHash

func (kv *KVStore) UpdateEth1BlockHash(
	hash primitives.ExecutionHash,
) error

UpdateEth1BlockHash sets the Eth1 hash in the BeaconStore.

func (*KVStore) UpdateRandaoMixAtIndex

func (kv *KVStore) UpdateRandaoMixAtIndex(
	index uint64,
	mix primitives.Bytes32,
) error

UpdateRandaoMixAtIndex sets the current RANDAO mix in the store.

func (*KVStore) UpdateStateRootAtIndex

func (kv *KVStore) UpdateStateRootAtIndex(
	idx uint64,
	stateRoot primitives.Root,
) error

UpdateStateRootAtIndex updates the state root at the given slot.

func (*KVStore) UpdateValidatorAtIndex

func (kv *KVStore) UpdateValidatorAtIndex(
	index primitives.ValidatorIndex,
	val *beacontypes.Validator,
) error

UpdateValidatorAtIndex updates a validator at a specific index.

func (*KVStore) ValidatorByIndex

func (kv *KVStore) ValidatorByIndex(
	index primitives.ValidatorIndex,
) (*beacontypes.Validator, error)

ValidatorByIndex returns the validator address by index.

func (*KVStore) ValidatorIndexByPubkey

func (kv *KVStore) ValidatorIndexByPubkey(
	pubkey primitives.BLSPubkey,
) (primitives.ValidatorIndex, error)

ValidatorPubKeyByIndex returns the validator address by index.

func (*KVStore) WithContext

func (kv *KVStore) WithContext(ctx context.Context) *KVStore

WithContext returns a copy of the Store with the given context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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