Documentation ¶
Index ¶
- Constants
- Variables
- type Store
- func (k *Store) ArchivedActiveValidatorChanges(ctx context.Context, epoch uint64) (*pb.ArchivedActiveSetChanges, error)
- func (k *Store) ArchivedBalances(ctx context.Context, epoch uint64) ([]uint64, error)
- func (k *Store) ArchivedCommitteeInfo(ctx context.Context, epoch uint64) (*pb.ArchivedCommitteeInfo, error)
- func (k *Store) ArchivedPointRoot(ctx context.Context, index uint64) [32]byte
- func (k *Store) ArchivedValidatorParticipation(ctx context.Context, epoch uint64) (*ethpb.ValidatorParticipation, error)
- func (k *Store) Attestations(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.Attestation, error)
- func (k *Store) AttestationsByDataRoot(ctx context.Context, attDataRoot [32]byte) ([]*ethpb.Attestation, error)
- func (k *Store) AttesterSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.AttesterSlashing, error)
- func (k *Store) Backup(ctx context.Context) error
- func (k *Store) Block(ctx context.Context, blockRoot [32]byte) (*ethpb.SignedBeaconBlock, error)
- func (k *Store) BlockRoots(ctx context.Context, f *filters.QueryFilter) ([][32]byte, error)
- func (k *Store) Blocks(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.SignedBeaconBlock, error)
- func (k *Store) ClearDB() error
- func (k *Store) Close() error
- func (k *Store) DatabasePath() string
- func (k *Store) DeleteAttestation(ctx context.Context, attDataRoot [32]byte) error
- func (k *Store) DeleteAttestations(ctx context.Context, attDataRoots [][32]byte) error
- func (k *Store) DeleteAttesterSlashing(ctx context.Context, slashingRoot [32]byte) error
- func (k *Store) DeleteBlock(ctx context.Context, blockRoot [32]byte) error
- func (k *Store) DeleteBlocks(ctx context.Context, blockRoots [][32]byte) error
- func (k *Store) DeleteProposerSlashing(ctx context.Context, slashingRoot [32]byte) error
- func (k *Store) DeleteState(ctx context.Context, blockRoot [32]byte) error
- func (k *Store) DeleteStates(ctx context.Context, blockRoots [][32]byte) error
- func (k *Store) DeleteVoluntaryExit(ctx context.Context, exitRoot [32]byte) error
- func (k *Store) DepositContractAddress(ctx context.Context) ([]byte, error)
- func (k *Store) FinalizedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, error)
- func (k *Store) GenesisBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error)
- func (k *Store) GenesisState(ctx context.Context) (*state.BeaconState, error)
- func (k *Store) HasArchivedPoint(ctx context.Context, index uint64) bool
- func (k *Store) HasAttestation(ctx context.Context, attDataRoot [32]byte) bool
- func (k *Store) HasAttesterSlashing(ctx context.Context, slashingRoot [32]byte) bool
- func (k *Store) HasBlock(ctx context.Context, blockRoot [32]byte) bool
- func (k *Store) HasProposerSlashing(ctx context.Context, slashingRoot [32]byte) bool
- func (k *Store) HasState(ctx context.Context, blockRoot [32]byte) bool
- func (k *Store) HasStateSummary(ctx context.Context, blockRoot [32]byte) bool
- func (k *Store) HasVoluntaryExit(ctx context.Context, exitRoot [32]byte) bool
- func (k *Store) HeadBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error)
- func (k *Store) HeadState(ctx context.Context) (*state.BeaconState, error)
- func (k *Store) HighestSlotBlocks(ctx context.Context) ([]*ethpb.SignedBeaconBlock, error)
- func (k *Store) HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*ethpb.SignedBeaconBlock, error)
- func (k *Store) HighestSlotStates(ctx context.Context) ([]*state.BeaconState, error)
- func (k *Store) HighestSlotStatesBelow(ctx context.Context, slot uint64) ([]*state.BeaconState, error)
- func (kv *Store) HistoricalStatesDeleted(ctx context.Context) error
- func (k *Store) IsFinalizedBlock(ctx context.Context, blockRoot [32]byte) bool
- func (k *Store) JustifiedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, error)
- func (k *Store) LastArchivedIndex(ctx context.Context) (uint64, error)
- func (k *Store) LastArchivedIndexRoot(ctx context.Context) [32]byte
- func (k *Store) PowchainData(ctx context.Context) (*db.ETH1ChainData, error)
- func (k *Store) ProposerSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.ProposerSlashing, error)
- func (k *Store) SaveArchivedActiveValidatorChanges(ctx context.Context, epoch uint64, changes *pb.ArchivedActiveSetChanges) error
- func (k *Store) SaveArchivedBalances(ctx context.Context, epoch uint64, balances []uint64) error
- func (k *Store) SaveArchivedCommitteeInfo(ctx context.Context, epoch uint64, info *pb.ArchivedCommitteeInfo) error
- func (k *Store) SaveArchivedPointRoot(ctx context.Context, blockRoot [32]byte, index uint64) error
- func (k *Store) SaveArchivedValidatorParticipation(ctx context.Context, epoch uint64, part *ethpb.ValidatorParticipation) error
- func (k *Store) SaveAttestation(ctx context.Context, att *ethpb.Attestation) error
- func (k *Store) SaveAttestations(ctx context.Context, atts []*ethpb.Attestation) error
- func (k *Store) SaveAttesterSlashing(ctx context.Context, slashing *ethpb.AttesterSlashing) error
- func (k *Store) SaveBlock(ctx context.Context, signed *ethpb.SignedBeaconBlock) error
- func (k *Store) SaveBlocks(ctx context.Context, blocks []*ethpb.SignedBeaconBlock) error
- func (k *Store) SaveDepositContractAddress(ctx context.Context, addr common.Address) error
- func (k *Store) SaveFinalizedCheckpoint(ctx context.Context, checkpoint *ethpb.Checkpoint) error
- func (k *Store) SaveGenesisBlockRoot(ctx context.Context, blockRoot [32]byte) error
- func (k *Store) SaveHeadBlockRoot(ctx context.Context, blockRoot [32]byte) error
- func (k *Store) SaveJustifiedCheckpoint(ctx context.Context, checkpoint *ethpb.Checkpoint) error
- func (k *Store) SaveLastArchivedIndex(ctx context.Context, index uint64) error
- func (k *Store) SavePowchainData(ctx context.Context, data *db.ETH1ChainData) error
- func (k *Store) SaveProposerSlashing(ctx context.Context, slashing *ethpb.ProposerSlashing) error
- func (k *Store) SaveState(ctx context.Context, state *state.BeaconState, blockRoot [32]byte) error
- func (k *Store) SaveStateSummaries(ctx context.Context, summaries []*pb.StateSummary) error
- func (k *Store) SaveStateSummary(ctx context.Context, summary *pb.StateSummary) error
- func (k *Store) SaveStates(ctx context.Context, states []*state.BeaconState, blockRoots [][32]byte) error
- func (k *Store) SaveVoluntaryExit(ctx context.Context, exit *ethpb.VoluntaryExit) error
- func (k *Store) State(ctx context.Context, blockRoot [32]byte) (*state.BeaconState, error)
- func (k *Store) StateSummary(ctx context.Context, blockRoot [32]byte) (*pb.StateSummary, error)
- func (k *Store) VoluntaryExit(ctx context.Context, exitRoot [32]byte) (*ethpb.VoluntaryExit, error)
Constants ¶
const ( // VotesCacheSize with 1M validators will be 8MB. VotesCacheSize = 1 << 23 // NumOfVotes specifies the vote cache size. NumOfVotes = 1 << 20 )
Variables ¶
var BlockCacheSize = int64(1 << 21)
BlockCacheSize specifies 1000 slots worth of blocks cached, which would be approximately 2MB
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store defines an implementation of the Prysm Database interface using BoltDB as the underlying persistent kv-store for eth2.
func NewKVStore ¶
func NewKVStore(dirPath string, stateSummaryCache *cache.StateSummaryCache) (*Store, error)
NewKVStore initializes a new boltDB key-value store at the directory path specified, creates the kv-buckets based on the schema, and stores an open connection db object as a property of the Store struct.
func (*Store) ArchivedActiveValidatorChanges ¶
func (k *Store) ArchivedActiveValidatorChanges(ctx context.Context, epoch uint64) (*pb.ArchivedActiveSetChanges, error)
ArchivedActiveValidatorChanges retrieval by epoch.
func (*Store) ArchivedBalances ¶
ArchivedBalances retrieval by epoch.
func (*Store) ArchivedCommitteeInfo ¶
func (k *Store) ArchivedCommitteeInfo(ctx context.Context, epoch uint64) (*pb.ArchivedCommitteeInfo, error)
ArchivedCommitteeInfo retrieval by epoch.
func (*Store) ArchivedPointRoot ¶ added in v0.3.2
ArchivedPointRoot returns the block root of an archived point from the DB. This is essential for cold state management and to restore a cold state.
func (*Store) ArchivedValidatorParticipation ¶
func (k *Store) ArchivedValidatorParticipation(ctx context.Context, epoch uint64) (*ethpb.ValidatorParticipation, error)
ArchivedValidatorParticipation retrieval by epoch.
func (*Store) Attestations ¶
func (k *Store) Attestations(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.Attestation, error)
Attestations retrieves a list of attestations by filter criteria.
func (*Store) AttestationsByDataRoot ¶
func (k *Store) AttestationsByDataRoot(ctx context.Context, attDataRoot [32]byte) ([]*ethpb.Attestation, error)
AttestationsByDataRoot returns any (aggregated) attestations matching this data root.
func (*Store) AttesterSlashing ¶
func (k *Store) AttesterSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.AttesterSlashing, error)
AttesterSlashing retrieval by hash tree root.
func (*Store) Backup ¶
Backup the database to the datadir backup directory. Example for backup at slot 345: $DATADIR/backups/prysm_beacondb_at_slot_0000345.backup
func (*Store) BlockRoots ¶
BlockRoots retrieves a list of beacon block roots by filter criteria.
func (*Store) Blocks ¶
func (k *Store) Blocks(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.SignedBeaconBlock, error)
Blocks retrieves a list of beacon blocks by filter criteria.
func (*Store) DatabasePath ¶
DatabasePath at which this database writes files.
func (*Store) DeleteAttestation ¶
DeleteAttestation by attestation data root.
func (*Store) DeleteAttestations ¶
DeleteAttestations by attestation data roots.
func (*Store) DeleteAttesterSlashing ¶
DeleteAttesterSlashing clears an attester slashing from the db by its hash tree root.
func (*Store) DeleteBlock ¶
DeleteBlock by block root.
func (*Store) DeleteBlocks ¶
DeleteBlocks by block roots.
func (*Store) DeleteProposerSlashing ¶
DeleteProposerSlashing clears a proposer slashing from the db by its hash tree root.
func (*Store) DeleteState ¶
DeleteState by block root.
func (*Store) DeleteStates ¶
DeleteStates by block roots.
Note: bkt.Delete(key) uses a binary search to find the item in the database. Iterating with a cursor is faster when there are a large set of keys to delete. This method is O(n) deletion where n is the number of keys in the database. The alternative of calling bkt.Delete on each key to delete would be O(m*log(n)) which would be much slower given a large set of keys to delete.
func (*Store) DeleteVoluntaryExit ¶
DeleteVoluntaryExit clears a voluntary exit from the db by its signing root.
func (*Store) DepositContractAddress ¶
DepositContractAddress returns contract address is the address of the deposit contract on the proof of work chain.
func (*Store) FinalizedCheckpoint ¶
FinalizedCheckpoint returns the latest finalized checkpoint in beacon chain.
func (*Store) GenesisBlock ¶ added in v0.3.0
GenesisBlock retrieves the genesis block of the beacon chain.
func (*Store) GenesisState ¶
GenesisState returns the genesis state in beacon chain.
func (*Store) HasArchivedPoint ¶ added in v0.3.2
HasArchivedPoint returns true if an archived point exists in DB.
func (*Store) HasAttestation ¶
HasAttestation checks if an attestation by its attestation data root exists in the db.
func (*Store) HasAttesterSlashing ¶
HasAttesterSlashing verifies if a slashing is stored in the db.
func (*Store) HasProposerSlashing ¶
HasProposerSlashing verifies if a slashing is stored in the db.
func (*Store) HasStateSummary ¶ added in v0.3.2
HasStateSummary returns true if a state summary exists in DB.
func (*Store) HasVoluntaryExit ¶
HasVoluntaryExit verifies if a voluntary exit is stored in the db by its signing root.
func (*Store) HighestSlotBlocks ¶ added in v0.3.8
HighestSlotBlocks returns the blocks with the highest slot from the db.
func (*Store) HighestSlotBlocksBelow ¶ added in v0.3.8
func (k *Store) HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*ethpb.SignedBeaconBlock, error)
HighestSlotBlocksBelow returns the block with the highest slot below the input slot from the db.
func (*Store) HighestSlotStates ¶ added in v0.3.8
HighestSlotStates returns the states with the highest slot from the db. Ideally there should just be one state per slot, but given validator can double propose, a single slot could have multiple block roots and reuslts states. This returns a list of states.
func (*Store) HighestSlotStatesBelow ¶ added in v0.3.9
func (k *Store) HighestSlotStatesBelow(ctx context.Context, slot uint64) ([]*state.BeaconState, error)
HighestSlotStatesBelow returns the states with the highest slot below the input slot from the db. Ideally there should just be one state per slot, but given validator can double propose, a single slot could have multiple block roots and reuslts states. This returns a list of states.
func (*Store) HistoricalStatesDeleted ¶
HistoricalStatesDeleted verifies historical states exist in DB.
func (*Store) IsFinalizedBlock ¶ added in v0.2.3
IsFinalizedBlock returns true if the block root is present in the finalized block root index. A beacon block root contained exists in this index if it is considered finalized and canonical. Note: beacon blocks from the latest finalized epoch return true, whether or not they are considered canonical in the "head view" of the beacon node.
func (*Store) JustifiedCheckpoint ¶
JustifiedCheckpoint returns the latest justified checkpoint in beacon chain.
func (*Store) LastArchivedIndex ¶ added in v0.3.10
LastArchivedIndex from the db.
func (*Store) LastArchivedIndexRoot ¶ added in v0.3.5
LastArchivedIndexRoot from the db.
func (*Store) PowchainData ¶ added in v0.3.0
PowchainData retrieves the powchain data.
func (*Store) ProposerSlashing ¶
func (k *Store) ProposerSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.ProposerSlashing, error)
ProposerSlashing retrieval by slashing root.
func (*Store) SaveArchivedActiveValidatorChanges ¶
func (k *Store) SaveArchivedActiveValidatorChanges(ctx context.Context, epoch uint64, changes *pb.ArchivedActiveSetChanges) error
SaveArchivedActiveValidatorChanges by epoch.
func (*Store) SaveArchivedBalances ¶
SaveArchivedBalances by epoch.
func (*Store) SaveArchivedCommitteeInfo ¶
func (k *Store) SaveArchivedCommitteeInfo(ctx context.Context, epoch uint64, info *pb.ArchivedCommitteeInfo) error
SaveArchivedCommitteeInfo by epoch.
func (*Store) SaveArchivedPointRoot ¶ added in v0.3.2
SaveArchivedPointRoot saves an archived point root to the DB. This is used for cold state management.
func (*Store) SaveArchivedValidatorParticipation ¶
func (k *Store) SaveArchivedValidatorParticipation(ctx context.Context, epoch uint64, part *ethpb.ValidatorParticipation) error
SaveArchivedValidatorParticipation by epoch.
func (*Store) SaveAttestation ¶
SaveAttestation to the db.
func (*Store) SaveAttestations ¶
SaveAttestations via batch updates to the db.
func (*Store) SaveAttesterSlashing ¶
SaveAttesterSlashing to the db by its hash tree root.
func (*Store) SaveBlocks ¶
SaveBlocks via bulk updates to the db.
func (*Store) SaveDepositContractAddress ¶
SaveDepositContractAddress to the db. It returns an error if an address has been previously saved.
func (*Store) SaveFinalizedCheckpoint ¶
SaveFinalizedCheckpoint saves finalized checkpoint in beacon chain.
func (*Store) SaveGenesisBlockRoot ¶
SaveGenesisBlockRoot to the db.
func (*Store) SaveHeadBlockRoot ¶
SaveHeadBlockRoot to the db.
func (*Store) SaveJustifiedCheckpoint ¶
SaveJustifiedCheckpoint saves justified checkpoint in beacon chain.
func (*Store) SaveLastArchivedIndex ¶ added in v0.3.5
SaveLastArchivedIndex to the db.
func (*Store) SavePowchainData ¶ added in v0.3.0
SavePowchainData saves the pow chain data.
func (*Store) SaveProposerSlashing ¶
SaveProposerSlashing to the db by its hash tree root.
func (*Store) SaveState ¶
SaveState stores a state to the db using block's signing root which was used to generate the state.
func (*Store) SaveStateSummaries ¶ added in v0.3.9
SaveStateSummaries saves state summary objects to the DB.
func (*Store) SaveStateSummary ¶ added in v0.3.2
SaveStateSummary saves a state summary object to the DB.
func (*Store) SaveStates ¶ added in v0.3.2
func (k *Store) SaveStates(ctx context.Context, states []*state.BeaconState, blockRoots [][32]byte) error
SaveStates stores multiple states to the db using the provided corresponding roots.
func (*Store) SaveVoluntaryExit ¶
SaveVoluntaryExit to the db by its signing root.
func (*Store) State ¶
State returns the saved state using block's signing root, this particular block was used to generate the state.
func (*Store) StateSummary ¶ added in v0.3.2
StateSummary returns the state summary object from the db using input block root.
func (*Store) VoluntaryExit ¶
VoluntaryExit retrieval by signing root.