mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 08:37:37 +00:00
7f931bf65b
* wip * adding set and delete graffiti * fixing mock * fixing mock linting and putting in scaffolds for unit tests * adding some tests * gaz * adding tests * updating missing unit test * fixing unit test * Update validator/rpc/handlers_keymanager.go Co-authored-by: Sammy Rosso <15244892+saolyn@users.noreply.github.com> * Update validator/client/propose.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/handlers_keymanager.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/client/propose.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * radek's feedback * fixing tests * using wrapper for graffiti * fixing linting * wip * fixing setting proposer settings * more partial fixes to tests * gaz * fixing tests and setting logic * changing keymanager * fixing tests and making graffiti optional in the proposer file * remove unneeded lines * reverting unintended changes * Update validator/client/propose.go Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com> * addressing feedback * removing uneeded line * fixing bad merge resolution * gofmt * gaz --------- Co-authored-by: Sammy Rosso <15244892+saolyn@users.noreply.github.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
75 lines
3.9 KiB
Go
75 lines
3.9 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)
|
|
EventStreamIsRunning() bool
|
|
ProcessEvent(event *event.Event)
|
|
ProposerSettings() *proposer.Settings
|
|
SetProposerSettings(context.Context, *proposer.Settings) error
|
|
GetGraffiti(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) ([]byte, error)
|
|
SetGraffiti(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, graffiti []byte) error
|
|
DeleteGraffiti(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) error
|
|
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)
|