-
Notifications
You must be signed in to change notification settings - Fork 13
/
slashing_protection.go
23 lines (20 loc) · 1.03 KB
/
slashing_protection.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package core
import (
"github.com/attestantio/go-eth2-client/spec/phase0"
)
// SlashingProtector represents the behavior of the slashing protector
type SlashingProtector interface {
IsSlashableAttestation(pubKey []byte, attestation *phase0.AttestationData) (*AttestationSlashStatus, error)
IsSlashableProposal(pubKey []byte, slot phase0.Slot) (*ProposalSlashStatus, error)
UpdateHighestAttestation(pubKey []byte, attestation *phase0.AttestationData) error
UpdateHighestProposal(pubKey []byte, slot phase0.Slot) error
FetchHighestAttestation(pubKey []byte) (*phase0.AttestationData, bool, error)
FetchHighestProposal(pubKey []byte) (phase0.Slot, bool, error)
}
// SlashingStore represents the behavior of the slashing store
type SlashingStore interface {
SaveHighestAttestation(pubKey []byte, attestation *phase0.AttestationData) error
RetrieveHighestAttestation(pubKey []byte) (*phase0.AttestationData, bool, error)
SaveHighestProposal(pubKey []byte, slot phase0.Slot) error
RetrieveHighestProposal(pubKey []byte) (phase0.Slot, bool, error)
}