Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Configuration
- type Graffiti
- type Store
- func (s *Store) AttestationHistoryForPubKey(_ context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) ([]*common.AttestationRecord, error)
- func (s *Store) AttestedPublicKeys(_ context.Context) ([][fieldparams.BLSPubkeyLength]byte, error)
- func (s *Store) Backup(_ context.Context, outputDir string, permissionOverride bool) error
- func (s *Store) ClearDB() error
- func (*Store) Close() error
- func (s *Store) DatabasePath() string
- func (*Store) EIPImportBlacklistedPublicKeys(_ context.Context) ([][fieldparams.BLSPubkeyLength]byte, error)
- func (s *Store) GenesisValidatorsRoot(_ context.Context) ([]byte, error)
- func (s *Store) GraffitiFileHash() ([32]byte, bool, error)
- func (s *Store) GraffitiOrderedIndex(_ context.Context, fileHash [32]byte) (uint64, error)
- func (*Store) HighestSignedProposal(_ context.Context, _ [fieldparams.BLSPubkeyLength]byte) (primitives.Slot, bool, error)
- func (s *Store) ImportStandardProtectionJSON(ctx context.Context, r io.Reader) error
- func (*Store) LowestSignedProposal(_ context.Context, _ [fieldparams.BLSPubkeyLength]byte) (primitives.Slot, bool, error)
- func (s *Store) LowestSignedSourceEpoch(_ context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) (primitives.Epoch, bool, error)
- func (s *Store) LowestSignedTargetEpoch(_ context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) (primitives.Epoch, bool, error)
- func (s *Store) ProposalHistoryForPubKey(_ context.Context, publicKey [fieldparams.BLSPubkeyLength]byte) ([]*common.Proposal, error)
- func (*Store) ProposalHistoryForSlot(_ context.Context, _ [fieldparams.BLSPubkeyLength]byte, _ primitives.Slot) ([fieldparams.RootLength]byte, bool, bool, error)
- func (s *Store) ProposedPublicKeys(_ context.Context) ([][fieldparams.BLSPubkeyLength]byte, error)
- func (s *Store) ProposerSettings(_ context.Context) (*proposer.Settings, error)
- func (s *Store) ProposerSettingsExists(_ context.Context) (bool, error)
- func (*Store) RunDownMigrations(_ context.Context) error
- func (*Store) RunUpMigrations(_ context.Context) error
- func (s *Store) SaveAttestationForPubKey(_ context.Context, pubkey [fieldparams.BLSPubkeyLength]byte, _ [32]byte, ...) error
- func (s *Store) SaveAttestationsForPubKey(_ context.Context, pubkey [fieldparams.BLSPubkeyLength]byte, _ [][]byte, ...) error
- func (*Store) SaveEIPImportBlacklistedPublicKeys(_ context.Context, _ [][fieldparams.BLSPubkeyLength]byte) error
- func (s *Store) SaveGenesisValidatorsRoot(_ context.Context, genValRoot []byte) error
- func (s *Store) SaveGraffitiOrderedIndex(_ context.Context, index uint64) error
- func (s *Store) SaveProposalHistoryForSlot(_ context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, ...) error
- func (s *Store) SaveProposerSettings(_ context.Context, proposerSettings *proposer.Settings) error
- func (*Store) SigningRootAtTargetEpoch(_ context.Context, _ [fieldparams.BLSPubkeyLength]byte, _ primitives.Epoch) ([]byte, error)
- func (s *Store) SlashableAttestationCheck(ctx context.Context, indexedAtt ethpb.IndexedAtt, ...) error
- func (s *Store) SlashableProposalCheck(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, ...) error
- func (s *Store) UpdatePublicKeysBuckets(pubKeys [][fieldparams.BLSPubkeyLength]byte) error
- type ValidatorSlashingProtection
Constants ¶
const (
DatabaseDirName = "validator-client-data"
)
Variables ¶
var ErrNoProposerSettingsFound = errors.New("no proposer settings found in bucket")
ErrNoProposerSettingsFound is an error thrown when no settings are found.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
PubKeys [][fieldparams.BLSPubkeyLength]byte
}
Config represents store's config object.
type Configuration ¶
type Configuration struct { GenesisValidatorsRoot *string `yaml:"genesisValidatorsRoot,omitempty"` ProposerSettings *validatorpb.ProposerSettingsPayload `yaml:"proposerSettings,omitempty"` Graffiti *Graffiti `yaml:"graffiti,omitempty"` }
Configuration contains the genesis information, the proposer settings and the graffiti.
type Graffiti ¶
type Graffiti struct { // In BoltDB implementation, calling GraffitiOrderedIndex with // the filehash stored in DB, but without an OrderedIndex already // stored in DB returns 0. // ==> Using the default value of uint64 is OK. OrderedIndex uint64 FileHash *string }
Graffiti contains the graffiti information.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a filesystem implementation of the validator client database.
func (*Store) AttestationHistoryForPubKey ¶
func (s *Store) AttestationHistoryForPubKey( _ context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, ) ([]*common.AttestationRecord, error)
AttestationHistoryForPubKey returns the attestation history for a public key.
func (*Store) AttestedPublicKeys ¶
func (s *Store) AttestedPublicKeys(_ context.Context) ([][fieldparams.BLSPubkeyLength]byte, error)
AttestedPublicKeys returns the list of public keys in the database.
func (*Store) ClearDB ¶
ClearDB removes any previously stored data at the configured data directory.
func (*Store) DatabasePath ¶
DatabasePath returns the path at which this database writes files.
func (*Store) EIPImportBlacklistedPublicKeys ¶
func (*Store) EIPImportBlacklistedPublicKeys(_ context.Context) ([][fieldparams.BLSPubkeyLength]byte, error)
EIPImportBlacklistedPublicKeys is implemented only to satisfy the interface.
func (*Store) GenesisValidatorsRoot ¶
func (*Store) GraffitiOrderedIndex ¶
func (*Store) HighestSignedProposal ¶
func (*Store) HighestSignedProposal(_ context.Context, _ [fieldparams.BLSPubkeyLength]byte) (primitives.Slot, bool, error)
HighestSignedProposal is implemented only to satisfy the interface.
func (*Store) ImportStandardProtectionJSON ¶
ImportStandardProtectionJSON takes in EIP-3076 compliant JSON file used for slashing protection by Ethereum validators and imports its data into Prysm's internal minimal representation of slashing protection in the validator client's database.
func (*Store) LowestSignedProposal ¶
func (*Store) LowestSignedProposal(_ context.Context, _ [fieldparams.BLSPubkeyLength]byte) (primitives.Slot, bool, error)
LowestSignedProposal is implemented only to satisfy the interface.
func (*Store) LowestSignedSourceEpoch ¶
func (s *Store) LowestSignedSourceEpoch(_ context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) (primitives.Epoch, bool, error)
LowestSignedSourceEpoch is implemented only to satisfy the interface.
func (*Store) LowestSignedTargetEpoch ¶
func (s *Store) LowestSignedTargetEpoch(_ context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) (primitives.Epoch, bool, error)
LowestSignedTargetEpoch returns the lowest signed target epoch for a public key, a boolean indicating if it exists and an error.
func (*Store) ProposalHistoryForPubKey ¶
func (s *Store) ProposalHistoryForPubKey(_ context.Context, publicKey [fieldparams.BLSPubkeyLength]byte) ([]*common.Proposal, error)
ProposalHistoryForPubKey returns the proposal history for a given public key.
func (*Store) ProposalHistoryForSlot ¶
func (*Store) ProposalHistoryForSlot(_ context.Context, _ [fieldparams.BLSPubkeyLength]byte, _ primitives.Slot) ([fieldparams.RootLength]byte, bool, bool, error)
ProposalHistoryForSlot is implemented only to satisfy the interface.
func (*Store) ProposedPublicKeys ¶
func (s *Store) ProposedPublicKeys(_ context.Context) ([][fieldparams.BLSPubkeyLength]byte, error)
ProposedPublicKeys returns the list of public keys we have in the database. To be consistent with the complete, BoltDB implementation, pubkeys returned by this function do not necessarily have proposed a block.
func (*Store) ProposerSettings ¶
ProposerSettings returns the proposer settings.
func (*Store) ProposerSettingsExists ¶
ProposerSettingsExists returns true if proposer settings exists, false otherwise.
func (*Store) RunDownMigrations ¶
RunDownMigrations only exists to satisfy the interface.
func (*Store) RunUpMigrations ¶
RunUpMigrations only exists to satisfy the interface.
func (*Store) SaveAttestationForPubKey ¶
func (s *Store) SaveAttestationForPubKey( _ context.Context, pubkey [fieldparams.BLSPubkeyLength]byte, _ [32]byte, att ethpb.IndexedAtt, ) error
SaveAttestationForPubKey checks if the incoming attestation is valid regarding EIP-3076 minimal slashing protection. If so, it updates the database with the incoming source and target, and returns nil. If not, it does not modify the database and return an error.
func (*Store) SaveAttestationsForPubKey ¶
func (s *Store) SaveAttestationsForPubKey( _ context.Context, pubkey [fieldparams.BLSPubkeyLength]byte, _ [][]byte, atts []*ethpb.IndexedAttestation, ) error
SaveAttestationsForPubKey saves the attestation history for a list of public keys WITHOUT checking if the incoming attestations are valid regarding EIP-3076 minimal slashing protection. For each public key, incoming sources and targets epochs are compared with recorded source and target epochs, and maximums are saved.
func (*Store) SaveEIPImportBlacklistedPublicKeys ¶
func (*Store) SaveEIPImportBlacklistedPublicKeys(_ context.Context, _ [][fieldparams.BLSPubkeyLength]byte) error
SaveEIPImportBlacklistedPublicKeys is implemented only to satisfy the interface.
func (*Store) SaveGenesisValidatorsRoot ¶
SaveGenesisValidatorsRoot saves the genesis validators root to db.
func (*Store) SaveGraffitiOrderedIndex ¶
func (*Store) SaveProposalHistoryForSlot ¶
func (s *Store) SaveProposalHistoryForSlot( _ context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, slot primitives.Slot, _ []byte, ) error
SaveProposalHistoryForSlot checks if the incoming proposal is valid regarding EIP-3076 minimal slashing protection. If so, it updates the database with the incoming slot, and returns nil. If not, it does not modify the database and return an error.
func (*Store) SaveProposerSettings ¶
SaveProposerSettings saves the proposer settings.
func (*Store) SigningRootAtTargetEpoch ¶
func (*Store) SigningRootAtTargetEpoch(_ context.Context, _ [fieldparams.BLSPubkeyLength]byte, _ primitives.Epoch) ([]byte, error)
SigningRootAtTargetEpoch is implemented only to satisfy the interface.
func (*Store) SlashableAttestationCheck ¶
func (s *Store) SlashableAttestationCheck( ctx context.Context, indexedAtt ethpb.IndexedAtt, pubKey [fieldparams.BLSPubkeyLength]byte, signingRoot32 [32]byte, _ bool, _ *prometheus.CounterVec, ) error
SlashableAttestationCheck checks if an attestation is slashable by comparing it with the attesting history for the given public key in our minimal slashing protection database defined by EIP-3076. If it is not, it updates the database.
func (*Store) SlashableProposalCheck ¶
func (s *Store) SlashableProposalCheck( ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, signedBlock interfaces.ReadOnlySignedBeaconBlock, signingRoot [fieldparams.RootLength]byte, emitAccountMetrics bool, validatorProposeFailVec *prometheus.CounterVec, ) error
SlashableProposalCheck checks if a block proposal is slashable by comparing it with the block proposals history for the given public key in our minimal slashing protection database defined by EIP-3076. If it is not, it update the database.
func (*Store) UpdatePublicKeysBuckets ¶
func (s *Store) UpdatePublicKeysBuckets(pubKeys [][fieldparams.BLSPubkeyLength]byte) error
UpdatePublicKeysBuckets creates a file for each public key in the database directory if needed.
type ValidatorSlashingProtection ¶
type ValidatorSlashingProtection struct { LatestSignedBlockSlot *uint64 `yaml:"latestSignedBlockSlot,omitempty"` LastSignedAttestationSourceEpoch uint64 `yaml:"lastSignedAttestationSourceEpoch"` LastSignedAttestationTargetEpoch *uint64 `yaml:"lastSignedAttestationTargetEpoch,omitempty"` }
ValidatorSlashingProtection contains the latest signed block slot, the last signed attestation. It is used to protect against validator slashing, implementing the EIP-3076 minimal slashing protection database. https://eips.ethereum.org/EIPS/eip-3076