github.com/prysmaticlabs/prysm@v1.4.4/validator/db/iface/interface.go (about) 1 // Package iface defines an interface for the validator database. 2 package iface 3 4 import ( 5 "context" 6 "io" 7 8 types "github.com/prysmaticlabs/eth2-types" 9 ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1" 10 "github.com/prysmaticlabs/prysm/shared/backuputil" 11 "github.com/prysmaticlabs/prysm/validator/db/kv" 12 ) 13 14 // Ensure the kv store implements the interface. 15 var _ = ValidatorDB(&kv.Store{}) 16 17 // ValidatorDB defines the necessary methods for a Prysm validator DB. 18 type ValidatorDB interface { 19 io.Closer 20 backuputil.BackupExporter 21 DatabasePath() string 22 ClearDB() error 23 RunUpMigrations(ctx context.Context) error 24 RunDownMigrations(ctx context.Context) error 25 UpdatePublicKeysBuckets(publicKeys [][48]byte) error 26 27 // Genesis information related methods. 28 GenesisValidatorsRoot(ctx context.Context) ([]byte, error) 29 SaveGenesisValidatorsRoot(ctx context.Context, genValRoot []byte) error 30 31 // Proposer protection related methods. 32 HighestSignedProposal(ctx context.Context, publicKey [48]byte) (types.Slot, bool, error) 33 LowestSignedProposal(ctx context.Context, publicKey [48]byte) (types.Slot, bool, error) 34 ProposalHistoryForPubKey(ctx context.Context, publicKey [48]byte) ([]*kv.Proposal, error) 35 ProposalHistoryForSlot(ctx context.Context, publicKey [48]byte, slot types.Slot) ([32]byte, bool, error) 36 SaveProposalHistoryForSlot(ctx context.Context, pubKey [48]byte, slot types.Slot, signingRoot []byte) error 37 ProposedPublicKeys(ctx context.Context) ([][48]byte, error) 38 39 // Attester protection related methods. 40 // Methods to store and read blacklisted public keys from EIP-3076 41 // slashing protection imports. 42 EIPImportBlacklistedPublicKeys(ctx context.Context) ([][48]byte, error) 43 SaveEIPImportBlacklistedPublicKeys(ctx context.Context, publicKeys [][48]byte) error 44 SigningRootAtTargetEpoch(ctx context.Context, publicKey [48]byte, target types.Epoch) ([32]byte, error) 45 LowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte) (types.Epoch, bool, error) 46 LowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte) (types.Epoch, bool, error) 47 AttestedPublicKeys(ctx context.Context) ([][48]byte, error) 48 CheckSlashableAttestation( 49 ctx context.Context, pubKey [48]byte, signingRoot [32]byte, att *ethpb.IndexedAttestation, 50 ) (kv.SlashingKind, error) 51 SaveAttestationForPubKey( 52 ctx context.Context, pubKey [48]byte, signingRoot [32]byte, att *ethpb.IndexedAttestation, 53 ) error 54 SaveAttestationsForPubKey( 55 ctx context.Context, pubKey [48]byte, signingRoots [][32]byte, atts []*ethpb.IndexedAttestation, 56 ) error 57 AttestationHistoryForPubKey( 58 ctx context.Context, pubKey [48]byte, 59 ) ([]*kv.AttestationRecord, error) 60 61 // Graffiti ordered index related methods 62 SaveGraffitiOrderedIndex(ctx context.Context, index uint64) error 63 GraffitiOrderedIndex(ctx context.Context, fileHash [32]byte) (uint64, error) 64 }