2020-04-29 21:32:39 +00:00
|
|
|
// Package iface defines an interface for the validator database.
|
2020-01-08 18:16:17 +00:00
|
|
|
package iface
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
|
2020-11-10 14:14:11 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/validator/db/kv"
|
2020-01-08 18:16:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ValidatorDB defines the necessary methods for a Prysm validator DB.
|
|
|
|
type ValidatorDB interface {
|
|
|
|
io.Closer
|
|
|
|
DatabasePath() string
|
|
|
|
ClearDB() error
|
2020-08-31 23:38:20 +00:00
|
|
|
UpdatePublicKeysBuckets(publicKeys [][48]byte) error
|
2020-11-20 18:06:12 +00:00
|
|
|
|
|
|
|
// Genesis information related methods.
|
|
|
|
GenesisValidatorsRoot(ctx context.Context) ([]byte, error)
|
|
|
|
SaveGenesisValidatorsRoot(ctx context.Context, genValRoot []byte) error
|
|
|
|
|
2020-01-08 18:16:17 +00:00
|
|
|
// Proposer protection related methods.
|
2020-11-25 21:37:39 +00:00
|
|
|
HighestSignedProposal(ctx context.Context, publicKey [48]byte) (uint64, error)
|
|
|
|
LowestSignedProposal(ctx context.Context, publicKey [48]byte) (uint64, error)
|
2020-11-25 22:24:07 +00:00
|
|
|
ProposalHistoryForSlot(ctx context.Context, publicKey [48]byte, slot uint64) ([32]byte, bool, error)
|
2020-11-25 20:04:43 +00:00
|
|
|
SaveProposalHistoryForSlot(ctx context.Context, pubKey [48]byte, slot uint64, signingRoot []byte) error
|
2020-11-25 21:37:39 +00:00
|
|
|
ProposedPublicKeys(ctx context.Context) ([][48]byte, error)
|
2020-09-14 01:55:33 +00:00
|
|
|
|
2020-01-19 22:05:48 +00:00
|
|
|
// Attester protection related methods.
|
2020-11-26 17:35:36 +00:00
|
|
|
LowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte) (uint64, error)
|
|
|
|
LowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte) (uint64, error)
|
|
|
|
SaveLowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error
|
|
|
|
SaveLowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error
|
2020-11-10 14:14:11 +00:00
|
|
|
AttestationHistoryForPubKeysV2(ctx context.Context, publicKeys [][48]byte) (map[[48]byte]kv.EncHistoryData, error)
|
|
|
|
SaveAttestationHistoryForPubKeysV2(ctx context.Context, historyByPubKeys map[[48]byte]kv.EncHistoryData) error
|
2020-11-12 22:07:32 +00:00
|
|
|
SaveAttestationHistoryForPubKeyV2(ctx context.Context, pubKey [48]byte, history kv.EncHistoryData) error
|
2020-11-25 21:37:39 +00:00
|
|
|
AttestedPublicKeys(ctx context.Context) ([][48]byte, error)
|
2020-01-08 18:16:17 +00:00
|
|
|
}
|