Documentation
¶
Overview ¶
Package validatorapi defines validator facing API that serves the subset of endpoints related to distributed validation and reverse-proxies the rest to the upstream beacon client.
Index ¶
- func GetDomain(ctx context.Context, eth2Cl Eth2DomainProvider, name DomainName, ...) (eth2p0.Domain, error)
- func NewRouter(h Handler, beaconNodeAddr string) (*mux.Router, error)
- type Component
- func (c Component) AttestationData(parent context.Context, slot eth2p0.Slot, committeeIndex eth2p0.CommitteeIndex) (*eth2p0.AttestationData, error)
- func (c Component) AttesterDuties(ctx context.Context, epoch eth2p0.Epoch, ...) ([]*eth2v1.AttesterDuty, error)
- func (c Component) BeaconBlockProposal(ctx context.Context, slot eth2p0.Slot, randao eth2p0.BLSSignature, _ []byte) (*spec.VersionedBeaconBlock, error)
- func (*Component) ProposerDuties(context.Context, eth2p0.Epoch, []eth2p0.ValidatorIndex) ([]*eth2v1.ProposerDuty, error)
- func (c *Component) RegisterAwaitAttestation(...)
- func (c *Component) RegisterAwaitBeaconBlock(...)
- func (c *Component) RegisterAwaitProposer(fn func(ctx context.Context, slot int64) (core.PubKey, error))
- func (c *Component) RegisterParSigDB(fn func(context.Context, core.Duty, core.ParSignedDataSet) error)
- func (c *Component) RegisterPubKeyByAttestation(...)
- func (c Component) SubmitAttestations(ctx context.Context, attestations []*eth2p0.Attestation) error
- func (c Component) SubmitBeaconBlock(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error
- func (c Component) Validators(ctx context.Context, stateID string, validatorIndices []eth2p0.ValidatorIndex) (map[eth2p0.ValidatorIndex]*eth2v1.Validator, error)
- func (c Component) ValidatorsByPubKey(ctx context.Context, stateID string, pubshares []eth2p0.BLSPubKey) (map[eth2p0.ValidatorIndex]*eth2v1.Validator, error)
- type DomainName
- type Eth2DomainProvider
- type Handler
- type PubShareFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDomain ¶
func GetDomain(ctx context.Context, eth2Cl Eth2DomainProvider, name DomainName, epoch eth2p0.Epoch) (eth2p0.Domain, error)
GetDomain returns the beacon domain for the provided type.
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
func NewComponent ¶
func NewComponent(eth2Svc eth2client.Service, pubShareByKey map[*bls_sig.PublicKey]*bls_sig.PublicKey, shareIdx int) (*Component, error)
NewComponent returns a new instance of the validator API core workflow component.
func NewComponentInsecure ¶
func NewComponentInsecure(eth2Svc eth2client.Service, shareIdx int) (*Component, error)
NewComponentInsecure returns a new instance of the validator API core workflow component that does not perform signature verification.
func (Component) AttestationData ¶
func (c Component) AttestationData(parent context.Context, slot eth2p0.Slot, committeeIndex eth2p0.CommitteeIndex) (*eth2p0.AttestationData, error)
AttestationData implements the eth2client.AttesterDutiesProvider for the router.
func (Component) AttesterDuties ¶
func (c Component) AttesterDuties(ctx context.Context, epoch eth2p0.Epoch, validatorIndices []eth2p0.ValidatorIndex) ([]*eth2v1.AttesterDuty, error)
func (Component) BeaconBlockProposal ¶ added in v0.3.0
func (c Component) BeaconBlockProposal(ctx context.Context, slot eth2p0.Slot, randao eth2p0.BLSSignature, _ []byte) (*spec.VersionedBeaconBlock, error)
BeaconBlockProposal submits the randao for aggregation and inclusion in DutyProposer and then queries the dutyDB for an unsigned beacon block.
func (*Component) ProposerDuties ¶
func (*Component) ProposerDuties(context.Context, eth2p0.Epoch, []eth2p0.ValidatorIndex) ([]*eth2v1.ProposerDuty, error)
func (*Component) RegisterAwaitAttestation ¶
func (c *Component) RegisterAwaitAttestation(fn func(ctx context.Context, slot, commIdx int64) (*eth2p0.AttestationData, error))
RegisterAwaitAttestation registers a function to query attestation data. It only supports a single function, since it is an input of the component.
func (*Component) RegisterAwaitBeaconBlock ¶ added in v0.3.0
func (c *Component) RegisterAwaitBeaconBlock(fn func(ctx context.Context, slot int64) (core.PubKey, *spec.VersionedBeaconBlock, error))
RegisterAwaitBeaconBlock registers a function to query unsigned block. It supports multiple functions since it is the output of the component.
func (*Component) RegisterAwaitProposer ¶ added in v0.3.0
func (c *Component) RegisterAwaitProposer(fn func(ctx context.Context, slot int64) (core.PubKey, error))
RegisterAwaitProposer registers a function to query proposer PubKey by slot. It supports a single function, since it is an input of the component. TODO(corver): Best place to get this is probably Scheduler.
func (*Component) RegisterParSigDB ¶
func (c *Component) RegisterParSigDB(fn func(context.Context, core.Duty, core.ParSignedDataSet) error)
RegisterParSigDB registers a partial signed data set store function. It supports multiple functions since it is the output of the component.
func (*Component) RegisterPubKeyByAttestation ¶
func (c *Component) RegisterPubKeyByAttestation(fn func(ctx context.Context, slot, commIdx, valCommIdx int64) (core.PubKey, error))
RegisterPubKeyByAttestation registers a function to query pubkeys by attestation. It only supports a single function, since it is an input of the component.
func (Component) SubmitAttestations ¶
func (c Component) SubmitAttestations(ctx context.Context, attestations []*eth2p0.Attestation) error
SubmitAttestations implements the eth2client.AttestationsSubmitter for the router.
func (Component) SubmitBeaconBlock ¶ added in v0.3.0
func (Component) Validators ¶
type DomainName ¶
type DomainName string
DomainName as defined in eth2 spec. See "specs/[phase0|altair]/beacon-chain.md#domain-types" in https://github.com/ethereum/consensus-specs.
const ( DomainBeaconProposer DomainName = "DOMAIN_BEACON_PROPOSER" DomainBeaconAttester DomainName = "DOMAIN_BEACON_ATTESTER" DomainRandao DomainName = "DOMAIN_RANDAO" )
type Eth2DomainProvider ¶
type Eth2DomainProvider interface {
eth2client.SpecProvider
eth2client.DomainProvider
}
Eth2DomainProvider is the subset of eth2 beacon api provider required to get a signing domain.
type Handler ¶
type Handler interface {
eth2client.AttestationDataProvider
eth2client.AttestationsSubmitter
eth2client.AttesterDutiesProvider
eth2client.BeaconBlockProposalProvider
eth2client.BeaconBlockSubmitter
eth2client.ProposerDutiesProvider
eth2client.ValidatorsProvider
}
Handler defines the request handler providing the business logic for the validator API router.