Documentation ¶
Overview ¶
Package kv defines a persistent backend for the validator service.
Index ¶
- Variables
- type EncHistoryData
- func (hd EncHistoryData) GetLatestEpochWritten(ctx context.Context) (uint64, error)
- func (hd EncHistoryData) GetTargetData(ctx context.Context, target uint64) (*HistoryData, error)
- func (hd EncHistoryData) SetLatestEpochWritten(ctx context.Context, latestEpochWritten uint64) (EncHistoryData, error)
- func (hd EncHistoryData) SetTargetData(ctx context.Context, target uint64, historyData *HistoryData) (EncHistoryData, error)
- type HistoryData
- type Proposal
- type ProposalHistoryForPubkey
- type Store
- func (store *Store) AttestationHistoryForPubKeysV2(ctx context.Context, publicKeys [][48]byte) (map[[48]byte]EncHistoryData, error)
- func (store *Store) AttestedPublicKeys(ctx context.Context) ([][48]byte, error)
- func (s *Store) Backup(ctx context.Context, outputDir string) error
- func (store *Store) ClearDB() error
- func (store *Store) Close() error
- func (store *Store) DatabasePath() string
- func (s *Store) GenesisValidatorsRoot(ctx context.Context) ([]byte, error)
- func (store *Store) HighestSignedProposal(ctx context.Context, publicKey [48]byte) (uint64, error)
- func (store *Store) LowestSignedProposal(ctx context.Context, publicKey [48]byte) (uint64, error)
- func (store *Store) LowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte) (uint64, error)
- func (store *Store) LowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte) (uint64, error)
- func (store *Store) ProposalHistoryForSlot(ctx context.Context, publicKey [48]byte, slot uint64) ([32]byte, bool, error)
- func (store *Store) ProposedPublicKeys(ctx context.Context) ([][48]byte, error)
- func (store *Store) SaveAttestationHistoryForPubKeyV2(ctx context.Context, pubKey [48]byte, history EncHistoryData) error
- func (store *Store) SaveAttestationHistoryForPubKeysV2(ctx context.Context, historyByPubKeys map[[48]byte]EncHistoryData) error
- func (s *Store) SaveGenesisValidatorsRoot(ctx context.Context, genValRoot []byte) error
- func (store *Store) SaveLowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error
- func (store *Store) SaveLowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error
- func (store *Store) SaveProposalHistoryForSlot(ctx context.Context, pubKey [48]byte, slot uint64, signingRoot []byte) error
- func (store *Store) Size() (int64, error)
- func (store *Store) UpdatePublicKeysBuckets(pubKeys [][48]byte) error
Constants ¶
This section is empty.
Variables ¶
var ProtectionDbFileName = "validator.db"
ProtectionDbFileName Validator slashing protection db file name.
Functions ¶
This section is empty.
Types ¶
type EncHistoryData ¶
type EncHistoryData []byte
EncHistoryData encapsulated history data.
func MarkAllAsAttestedSinceLatestWrittenEpoch ¶
func MarkAllAsAttestedSinceLatestWrittenEpoch( ctx context.Context, hist EncHistoryData, incomingTarget uint64, incomingAtt *HistoryData, ) (EncHistoryData, error)
MarkAllAsAttestedSinceLatestWrittenEpoch returns an attesting history with specified target+epoch pairs since the latest written epoch up to the incoming attestation's target epoch as attested for.
func NewAttestationHistoryArray ¶
func NewAttestationHistoryArray(target uint64) EncHistoryData
NewAttestationHistoryArray creates a new encapsulated attestation history byte array sized by the latest epoch written.
func (EncHistoryData) GetLatestEpochWritten ¶
func (hd EncHistoryData) GetLatestEpochWritten(ctx context.Context) (uint64, error)
func (EncHistoryData) GetTargetData ¶
func (hd EncHistoryData) GetTargetData(ctx context.Context, target uint64) (*HistoryData, error)
func (EncHistoryData) SetLatestEpochWritten ¶
func (hd EncHistoryData) SetLatestEpochWritten(ctx context.Context, latestEpochWritten uint64) (EncHistoryData, error)
func (EncHistoryData) SetTargetData ¶
func (hd EncHistoryData) SetTargetData(ctx context.Context, target uint64, historyData *HistoryData) (EncHistoryData, error)
type HistoryData ¶
HistoryData stores the needed data to confirm if an attestation is slashable or repeated.
func (*HistoryData) IsEmpty ¶
func (h *HistoryData) IsEmpty() bool
type ProposalHistoryForPubkey ¶
type ProposalHistoryForPubkey struct {
Proposals []Proposal
}
ProposalHistoryForPubkey for a validator public key.
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 (*Store) AttestationHistoryForPubKeysV2 ¶
func (store *Store) AttestationHistoryForPubKeysV2(ctx context.Context, publicKeys [][48]byte) (map[[48]byte]EncHistoryData, error)
AttestationHistoryForPubKeysV2 accepts an array of validator public keys and returns a mapping of corresponding attestation history.
func (*Store) AttestedPublicKeys ¶ added in v1.0.1
AttestedPublicKeys retrieves all public keys in our attestation history bucket.
func (*Store) Backup ¶ added in v1.0.4
Backup the database to the datadir backup directory. Example for backup: $DATADIR/backups/prysm_validatordb_1029019.backup
func (*Store) ClearDB ¶
ClearDB removes any previously stored data at the configured data directory.
func (*Store) DatabasePath ¶
DatabasePath at which this database writes files.
func (*Store) GenesisValidatorsRoot ¶
GenesisValidatorsRoot retrieves the genesis validator root from db.
func (*Store) HighestSignedProposal ¶ added in v1.0.1
HighestSignedProposal returns the highest signed proposal slot for a validator public key. If no data exists, returning 0 is a sensible default.
func (*Store) LowestSignedProposal ¶ added in v1.0.1
LowestSignedProposal returns the lowest signed proposal slot for a validator public key. If no data exists, returning 0 is a sensible default.
func (*Store) LowestSignedSourceEpoch ¶ added in v1.0.1
func (store *Store) LowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte) (uint64, error)
LowestSignedSourceEpoch returns the lowest signed source epoch for a validator public key. If no data exists, returning 0 is a sensible default.
func (*Store) LowestSignedTargetEpoch ¶ added in v1.0.1
func (store *Store) LowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte) (uint64, error)
LowestSignedTargetEpoch returns the lowest signed target epoch for a validator public key. If no data exists, returning 0 is a sensible default.
func (*Store) ProposalHistoryForSlot ¶
func (store *Store) ProposalHistoryForSlot(ctx context.Context, publicKey [48]byte, slot uint64) ([32]byte, bool, error)
ProposalHistoryForSlot accepts a validator public key and returns the corresponding signing root as well as a boolean that tells us if we have a proposal history stored at the slot. It is possible we have proposed a slot but stored a nil signing root, so the boolean helps give full information.
func (*Store) ProposedPublicKeys ¶ added in v1.0.1
ProposedPublicKeys retrieves all public keys in our proposals history bucket.
func (*Store) SaveAttestationHistoryForPubKeyV2 ¶
func (store *Store) SaveAttestationHistoryForPubKeyV2(ctx context.Context, pubKey [48]byte, history EncHistoryData) error
SaveAttestationHistoryForPubKeyV2 saves the attestation history for the requested validator public key.
func (*Store) SaveAttestationHistoryForPubKeysV2 ¶
func (store *Store) SaveAttestationHistoryForPubKeysV2(ctx context.Context, historyByPubKeys map[[48]byte]EncHistoryData) error
SaveAttestationHistoryForPubKeysV2 saves the attestation histories for the requested validator public keys.
func (*Store) SaveGenesisValidatorsRoot ¶
SaveGenesisValidatorsRoot saves the genesis validator root to db.
func (*Store) SaveLowestSignedSourceEpoch ¶ added in v1.0.1
func (store *Store) SaveLowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error
SaveLowestSignedSourceEpoch saves the lowest signed source epoch for a validator public key.
func (*Store) SaveLowestSignedTargetEpoch ¶ added in v1.0.1
func (store *Store) SaveLowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error
SaveLowestSignedTargetEpoch saves the lowest signed target epoch for a validator public key.
func (*Store) SaveProposalHistoryForSlot ¶
func (store *Store) SaveProposalHistoryForSlot(ctx context.Context, pubKey [48]byte, slot uint64, signingRoot []byte) error
SaveProposalHistoryForSlot saves the proposal history for the requested validator public key. We also check if the incoming proposal slot is lower than the lowest signed proposal slot for the validator and override its value on disk.
func (*Store) UpdatePublicKeysBuckets ¶
UpdatePublicKeysBuckets for a specified list of keys.