Documentation ¶
Index ¶
- func TeardownSlasherDB(t testing.TB, db *Store)
- func TempDir() string
- type Store
- func (db *Store) BlockHeader(epoch uint64, validatorID uint64) ([]*ethpb.BeaconBlockHeader, error)
- func (db *Store) ClearDB() error
- func (db *Store) Close() error
- func (db *Store) DatabasePath() string
- func (db *Store) DeleteBlockHeader(epoch uint64, validatorID uint64, blockHeader *ethpb.BeaconBlockHeader) error
- func (db *Store) DeleteIndexedAttestation(idxAttestation *ethpb.IndexedAttestation) error
- func (db *Store) DeletePubKey(validatorID uint64) error
- func (db *Store) DeleteValidatorSpanMap(validatorIdx uint64) error
- func (db *Store) HasBlockHeader(epoch uint64, validatorID uint64) bool
- func (db *Store) HasIndexedAttestation(sourceEpoch uint64, targetEpoch uint64, validatorID uint64) bool
- func (db *Store) IndexedAttestation(sourceEpoch uint64, targetEpoch uint64, validatorID uint64) ([]*ethpb.IndexedAttestation, error)
- func (db *Store) PruneHistory(currentEpoch uint64, historySize uint64) error
- func (db *Store) SaveBlockHeader(epoch uint64, validatorID uint64, blockHeader *ethpb.BeaconBlockHeader) error
- func (db *Store) SaveIndexedAttestation(idxAttestation *ethpb.IndexedAttestation) error
- func (db *Store) SavePubKey(validatorID uint64, pubKey []byte) error
- func (db *Store) SaveValidatorSpansMap(validatorIdx uint64, spanMap *ethpb.EpochSpanMap) error
- func (db *Store) ValidatorPubKey(validatorID uint64) ([]byte, error)
- func (db *Store) ValidatorSpansMap(validatorIdx uint64) (*ethpb.EpochSpanMap, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TeardownSlasherDB ¶
TeardownSlasherDB cleans up a test BeaconDB instance.
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 ¶
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 SetupSlasherDB ¶
SetupSlasherDB instantiates and returns a SlasherDB instance.
func (*Store) BlockHeader ¶
BlockHeader accepts an epoch and validator id and returns the corresponding block header array. Returns nil if the block header for those values does not exist.
func (*Store) DatabasePath ¶
DatabasePath at which this database writes files.
func (*Store) DeleteBlockHeader ¶
func (db *Store) DeleteBlockHeader(epoch uint64, validatorID uint64, blockHeader *ethpb.BeaconBlockHeader) error
DeleteBlockHeader deletes a block header using the epoch and validator id.
func (*Store) DeleteIndexedAttestation ¶
func (db *Store) DeleteIndexedAttestation(idxAttestation *ethpb.IndexedAttestation) error
DeleteIndexedAttestation deletes a indexed attestation using the slot and its root as keys in their respective buckets.
func (*Store) DeletePubKey ¶ added in v0.2.3
DeletePubKey deletes a public key of a validator id.
func (*Store) DeleteValidatorSpanMap ¶ added in v0.2.3
DeleteValidatorSpanMap deletes a validator span map using a validator index as bucket key.
func (*Store) HasBlockHeader ¶
HasBlockHeader accepts an epoch and validator id and returns true if the block header exists.
func (*Store) HasIndexedAttestation ¶
func (db *Store) HasIndexedAttestation(sourceEpoch uint64, targetEpoch uint64, validatorID uint64) bool
HasIndexedAttestation accepts an epoch and validator id and returns true if the indexed attestation exists.
func (*Store) IndexedAttestation ¶
func (db *Store) IndexedAttestation(sourceEpoch uint64, targetEpoch uint64, validatorID uint64) ([]*ethpb.IndexedAttestation, error)
IndexedAttestation accepts a epoch and validator index and returns a list of indexed attestations. Returns nil if the indexed attestation does not exist.
func (*Store) PruneHistory ¶
PruneHistory leaves only records younger then history size.
func (*Store) SaveBlockHeader ¶
func (db *Store) SaveBlockHeader(epoch uint64, validatorID uint64, blockHeader *ethpb.BeaconBlockHeader) error
SaveBlockHeader accepts a block header and writes it to disk.
func (*Store) SaveIndexedAttestation ¶
func (db *Store) SaveIndexedAttestation(idxAttestation *ethpb.IndexedAttestation) error
SaveIndexedAttestation accepts epoch and indexed attestation and writes it to disk.
func (*Store) SavePubKey ¶ added in v0.2.3
SavePubKey accepts a validator id and its public key and writes it to disk.
func (*Store) SaveValidatorSpansMap ¶ added in v0.2.3
func (db *Store) SaveValidatorSpansMap(validatorIdx uint64, spanMap *ethpb.EpochSpanMap) error
SaveValidatorSpansMap accepts a validator index and span map and writes it to disk.
func (*Store) ValidatorPubKey ¶ added in v0.2.3
ValidatorPubKey accepts validator id and returns the corresponding pubkey. Returns nil if the pubkey for this validator id does not exist.
func (*Store) ValidatorSpansMap ¶ added in v0.2.3
func (db *Store) ValidatorSpansMap(validatorIdx uint64) (*ethpb.EpochSpanMap, error)
ValidatorSpansMap accepts validator index and returns the corresponding spans map for slashing detection. Returns nil if the span map for this validator index does not exist.