mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
ad8716a58e
* Finish refactor for attestation protection * Finish refactor for proposal history * Revert "Finish refactor for proposal history" This reverts commit 2f13720063da8c9bd972d2007d673ab8b8f1b44e. * Fix tests * Implement UpdateProtections * Implement refactor * Fixes * fix * Undo proposer changes * Fix test * Final look through * Add tests for protections function * Add lock * Add flag in front of attester protection code * Add proper rwlocks and fix flags * fix * fix build * Fix atestation tests * Fix deprecated flags * Add protect attester to standard attesting test * Remove comment * gofmt Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
26 lines
1.0 KiB
Go
26 lines
1.0 KiB
Go
// Package iface defines an interface for the validator database.
|
|
package iface
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/prysmaticlabs/go-bitfield"
|
|
slashpb "github.com/prysmaticlabs/prysm/proto/slashing"
|
|
)
|
|
|
|
// ValidatorDB defines the necessary methods for a Prysm validator DB.
|
|
type ValidatorDB interface {
|
|
io.Closer
|
|
DatabasePath() string
|
|
ClearDB() error
|
|
// Proposer protection related methods.
|
|
ProposalHistoryForEpoch(ctx context.Context, publicKey []byte, epoch uint64) (bitfield.Bitlist, error)
|
|
SaveProposalHistoryForEpoch(ctx context.Context, publicKey []byte, epoch uint64, history bitfield.Bitlist) error
|
|
DeleteProposalHistory(ctx context.Context, publicKey []byte) error
|
|
// Attester protection related methods.
|
|
AttestationHistoryForPubKeys(ctx context.Context, publicKeys [][48]byte) (map[[48]byte]*slashpb.AttestationHistory, error)
|
|
SaveAttestationHistoryForPubKeys(ctx context.Context, historyByPubKey map[[48]byte]*slashpb.AttestationHistory) error
|
|
DeleteAttestationHistory(ctx context.Context, publicKey []byte) error
|
|
}
|