mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 02:02:18 +00:00
d6ae838bbf
* WIP * event stream wip * returning nil * temp removing some tests * wip health checks * fixing conficts * updating fields based on linting * fixing more errors * fixing mocks * fixing more mocks * fixing more linting * removing white space for lint * fixing log format * gaz * reverting changes on grpc * fixing unit tests * adding in tests for health tracker and event stream * adding more tests for streaming slot * gaz * Update api/client/event/event_stream.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * review comments * Update validator/client/runner.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/client/validator.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/client/validator.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/client/validator.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/client/validator.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/client/beacon-api/beacon_api_validator_client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/client/validator.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/client/validator.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * addressing radek comments * Update validator/client/validator.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * addressing review feedback * moving things to below next slot ticker * fixing tests * update naming * adding TODO comment * Update api/client/beacon/health.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * addressing comments * fixing broken linting * fixing more import issues * fixing more import issues * linting * updating based on radek's comments * addressing more comments * fixing nogo error * fixing duplicate import * gaz * adding radek's review suggestion * Update proto/prysm/v1alpha1/node.proto Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com> * preston review comments * Update api/client/event/event_stream.go Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com> * Update validator/client/validator.go Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com> * addressing some more preston review items * fixing tests for linting * fixing missed linting * updating based on feedback to simplify * adding interface check at the top * reverting some comments * cleaning up intatiations * reworking the health tracker * fixing linting * fixing more linting to adhear to interface * adding interface check at the the top of the file * fixing unit tests * attempting to fix dependency cycle * addressing radek's comment * Update validator/client/beacon-api/beacon_api_validator_client.go Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com> * adding more tests and feedback items * fixing TODO comment --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
72 lines
3.7 KiB
Go
72 lines
3.7 KiB
Go
package iface
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/api/client/beacon"
|
|
"github.com/prysmaticlabs/prysm/v5/api/client/event"
|
|
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
|
"github.com/prysmaticlabs/prysm/v5/config/proposer"
|
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
|
"github.com/prysmaticlabs/prysm/v5/crypto/bls"
|
|
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
|
validatorpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/validator-client"
|
|
"github.com/prysmaticlabs/prysm/v5/validator/keymanager"
|
|
)
|
|
|
|
// ValidatorRole defines the validator role.
|
|
type ValidatorRole int8
|
|
|
|
const (
|
|
// RoleUnknown means that the role of the validator cannot be determined.
|
|
RoleUnknown ValidatorRole = iota
|
|
// RoleAttester means that the validator should submit an attestation.
|
|
RoleAttester
|
|
// RoleProposer means that the validator should propose a block.
|
|
RoleProposer
|
|
// RoleAggregator means that the validator should submit an aggregation and proof.
|
|
RoleAggregator
|
|
// RoleSyncCommittee means that the validator should submit a sync committee message.
|
|
RoleSyncCommittee
|
|
// RoleSyncCommitteeAggregator means the validator should aggregate sync committee messages and submit a sync committee contribution.
|
|
RoleSyncCommitteeAggregator
|
|
)
|
|
|
|
// Validator interface defines the primary methods of a validator client.
|
|
type Validator interface {
|
|
Done()
|
|
WaitForChainStart(ctx context.Context) error
|
|
WaitForSync(ctx context.Context) error
|
|
WaitForActivation(ctx context.Context, accountsChangedChan chan [][fieldparams.BLSPubkeyLength]byte) error
|
|
CanonicalHeadSlot(ctx context.Context) (primitives.Slot, error)
|
|
NextSlot() <-chan primitives.Slot
|
|
SlotDeadline(slot primitives.Slot) time.Time
|
|
LogValidatorGainsAndLosses(ctx context.Context, slot primitives.Slot) error
|
|
UpdateDuties(ctx context.Context, slot primitives.Slot) error
|
|
RolesAt(ctx context.Context, slot primitives.Slot) (map[[fieldparams.BLSPubkeyLength]byte][]ValidatorRole, error) // validator pubKey -> roles
|
|
SubmitAttestation(ctx context.Context, slot primitives.Slot, pubKey [fieldparams.BLSPubkeyLength]byte)
|
|
ProposeBlock(ctx context.Context, slot primitives.Slot, pubKey [fieldparams.BLSPubkeyLength]byte)
|
|
SubmitAggregateAndProof(ctx context.Context, slot primitives.Slot, pubKey [fieldparams.BLSPubkeyLength]byte)
|
|
SubmitSyncCommitteeMessage(ctx context.Context, slot primitives.Slot, pubKey [fieldparams.BLSPubkeyLength]byte)
|
|
SubmitSignedContributionAndProof(ctx context.Context, slot primitives.Slot, pubKey [fieldparams.BLSPubkeyLength]byte)
|
|
LogSubmittedAtts(slot primitives.Slot)
|
|
LogSubmittedSyncCommitteeMessages()
|
|
UpdateDomainDataCaches(ctx context.Context, slot primitives.Slot)
|
|
WaitForKeymanagerInitialization(ctx context.Context) error
|
|
Keymanager() (keymanager.IKeymanager, error)
|
|
HandleKeyReload(ctx context.Context, currentKeys [][fieldparams.BLSPubkeyLength]byte) (bool, error)
|
|
CheckDoppelGanger(ctx context.Context) error
|
|
PushProposerSettings(ctx context.Context, km keymanager.IKeymanager, slot primitives.Slot, deadline time.Time) error
|
|
SignValidatorRegistrationRequest(ctx context.Context, signer SigningFunc, newValidatorRegistration *ethpb.ValidatorRegistrationV1) (*ethpb.SignedValidatorRegistrationV1, error)
|
|
StartEventStream(ctx context.Context, topics []string, eventsChan chan<- *event.Event)
|
|
ProcessEvent(event *event.Event)
|
|
ProposerSettings() *proposer.Settings
|
|
SetProposerSettings(context.Context, *proposer.Settings) error
|
|
EventStreamIsRunning() bool
|
|
HealthTracker() *beacon.NodeHealthTracker
|
|
}
|
|
|
|
// SigningFunc interface defines a type for the a function that signs a message
|
|
type SigningFunc func(context.Context, *validatorpb.SignRequest) (bls.Signature, error)
|