github.com/prysmaticlabs/prysm@v1.4.4/validator/client/iface/validator.go (about) 1 package iface 2 3 import ( 4 "context" 5 "errors" 6 "time" 7 8 types "github.com/prysmaticlabs/eth2-types" 9 "github.com/prysmaticlabs/prysm/validator/keymanager" 10 ) 11 12 // ErrConnectionIssue represents a connection problem. 13 var ErrConnectionIssue = errors.New("could not connect") 14 15 // ValidatorRole defines the validator role. 16 type ValidatorRole int8 17 18 const ( 19 // RoleUnknown means that the role of the validator cannot be determined. 20 RoleUnknown ValidatorRole = iota 21 // RoleAttester means that the validator should submit an attestation. 22 RoleAttester 23 // RoleProposer means that the validator should propose a block. 24 RoleProposer 25 // RoleAggregator means that the validator should submit an aggregation and proof. 26 RoleAggregator 27 ) 28 29 // Validator interface defines the primary methods of a validator client. 30 type Validator interface { 31 Done() 32 WaitForChainStart(ctx context.Context) error 33 WaitForSync(ctx context.Context) error 34 WaitForActivation(ctx context.Context, accountsChangedChan chan [][48]byte) error 35 SlasherReady(ctx context.Context) error 36 CanonicalHeadSlot(ctx context.Context) (types.Slot, error) 37 NextSlot() <-chan types.Slot 38 SlotDeadline(slot types.Slot) time.Time 39 LogValidatorGainsAndLosses(ctx context.Context, slot types.Slot) error 40 UpdateDuties(ctx context.Context, slot types.Slot) error 41 RolesAt(ctx context.Context, slot types.Slot) (map[[48]byte][]ValidatorRole, error) // validator pubKey -> roles 42 SubmitAttestation(ctx context.Context, slot types.Slot, pubKey [48]byte) 43 ProposeBlock(ctx context.Context, slot types.Slot, pubKey [48]byte) 44 SubmitAggregateAndProof(ctx context.Context, slot types.Slot, pubKey [48]byte) 45 LogAttestationsSubmitted() 46 LogNextDutyTimeLeft(slot types.Slot) error 47 UpdateDomainDataCaches(ctx context.Context, slot types.Slot) 48 WaitForWalletInitialization(ctx context.Context) error 49 AllValidatorsAreExited(ctx context.Context) (bool, error) 50 GetKeymanager() keymanager.IKeymanager 51 ReceiveBlocks(ctx context.Context, connectionErrorChannel chan<- error) 52 HandleKeyReload(ctx context.Context, newKeys [][48]byte) (bool, error) 53 CheckDoppelGanger(ctx context.Context) error 54 }