Documentation
¶
Index ¶
- func DutyToProto(duty Duty) *pbv1.Duty
- func NewDutyDeadlineFunc(ctx context.Context, eth2Cl eth2wrap.Client) (func(Duty) (time.Time, bool), error)
- func ParSignedDataSetToProto(set ParSignedDataSet) (*pbv1.ParSignedDataSet, error)
- func ParSignedDataToProto(data ParSignedData) (*pbv1.ParSignedData, error)
- func StartDutyTrace(ctx context.Context, duty Duty, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func UnsignedDataSetToProto(set UnsignedDataSet) (*pbv1.UnsignedDataSet, error)
- func Wire(sched Scheduler, fetch Fetcher, cons Consensus, dutyDB DutyDB, ...)
- type AggSigDB
- type AggregatedAttestation
- type Attestation
- type AttestationData
- type AttesterDefinition
- type Broadcaster
- type Consensus
- type Deadliner
- type Duty
- func DutyFromProto(duty *pbv1.Duty) Duty
- func NewAggregatorDuty(slot int64) Duty
- func NewAttesterDuty(slot int64) Duty
- func NewBuilderProposerDuty(slot int64) Duty
- func NewBuilderRegistrationDuty(slot int64) Duty
- func NewPrepareAggregatorDuty(slot int64) Duty
- func NewProposerDuty(slot int64) Duty
- func NewRandaoDuty(slot int64) Duty
- func NewSignatureDuty(slot int64) Duty
- func NewVoluntaryExit(slot int64) Duty
- type DutyDB
- type DutyDefinition
- type DutyDefinitionSet
- type DutyType
- type EmptyDefinition
- type Fetcher
- type ParSigDB
- type ParSigEx
- type ParSignedData
- func NewPartialAttestation(att *eth2p0.Attestation, shareIdx int) ParSignedData
- func NewPartialSignature(sig Signature, shareIdx int) ParSignedData
- func NewPartialSignedAggregateAndProof(data *eth2p0.SignedAggregateAndProof, shareIdx int) ParSignedData
- func NewPartialSignedBeaconCommitteeSubscription(sub *eth2exp.BeaconCommitteeSubscription, shareIdx int) ParSignedData
- func NewPartialSignedRandao(epoch eth2p0.Epoch, randao eth2p0.BLSSignature, shareIdx int) ParSignedData
- func NewPartialSignedVoluntaryExit(exit *eth2p0.SignedVoluntaryExit, shareIdx int) ParSignedData
- func NewPartialVersionedSignedBeaconBlock(block *spec.VersionedSignedBeaconBlock, shareIdx int) (ParSignedData, error)
- func NewPartialVersionedSignedBlindedBeaconBlock(block *eth2api.VersionedSignedBlindedBeaconBlock, shareIdx int) (ParSignedData, error)
- func NewPartialVersionedSignedValidatorRegistration(registration *eth2api.VersionedSignedValidatorRegistration, shareIdx int) (ParSignedData, error)
- func ParSignedDataFromProto(typ DutyType, data *pbv1.ParSignedData) (ParSignedData, error)
- type ParSignedDataSet
- type ProposerDefinition
- type PubKey
- type Scheduler
- type SigAgg
- type Signature
- type SignedAggregateAndProof
- func (s SignedAggregateAndProof) Clone() (SignedData, error)
- func (s SignedAggregateAndProof) MarshalJSON() ([]byte, error)
- func (s SignedAggregateAndProof) SetSignature(sig Signature) (SignedData, error)
- func (s SignedAggregateAndProof) Signature() Signature
- func (s *SignedAggregateAndProof) UnmarshalJSON(input []byte) error
- type SignedBeaconCommitteeSubscription
- func (s SignedBeaconCommitteeSubscription) Clone() (SignedData, error)
- func (s SignedBeaconCommitteeSubscription) MarshalJSON() ([]byte, error)
- func (s SignedBeaconCommitteeSubscription) SetSignature(sig Signature) (SignedData, error)
- func (s SignedBeaconCommitteeSubscription) Signature() Signature
- func (s *SignedBeaconCommitteeSubscription) UnmarshalJSON(input []byte) error
- type SignedData
- type SignedRandao
- type SignedSyncContribution
- func (s SignedSyncContribution) Clone() (SignedData, error)
- func (s SignedSyncContribution) MarshalJSON() ([]byte, error)
- func (s SignedSyncContribution) SetSignature(sig Signature) (SignedData, error)
- func (s SignedSyncContribution) Signature() Signature
- func (s *SignedSyncContribution) UnmarshalJSON(input []byte) error
- type SignedSyncMessage
- type SignedVoluntaryExit
- func (e SignedVoluntaryExit) Clone() (SignedData, error)
- func (e SignedVoluntaryExit) MarshalJSON() ([]byte, error)
- func (e SignedVoluntaryExit) SetSignature(sig Signature) (SignedData, error)
- func (e SignedVoluntaryExit) Signature() Signature
- func (e *SignedVoluntaryExit) UnmarshalJSON(b []byte) error
- type Slot
- type SyncCommitteeDefinition
- type SyncContribution
- type UnsignedData
- type UnsignedDataSet
- type ValidatorAPI
- type VersionedBeaconBlock
- type VersionedBlindedBeaconBlock
- type VersionedSignedBeaconBlock
- func (b VersionedSignedBeaconBlock) Clone() (SignedData, error)
- func (b VersionedSignedBeaconBlock) MarshalJSON() ([]byte, error)
- func (b VersionedSignedBeaconBlock) SetSignature(sig Signature) (SignedData, error)
- func (b VersionedSignedBeaconBlock) Signature() Signature
- func (b *VersionedSignedBeaconBlock) UnmarshalJSON(input []byte) error
- type VersionedSignedBlindedBeaconBlock
- func (b VersionedSignedBlindedBeaconBlock) Clone() (SignedData, error)
- func (b VersionedSignedBlindedBeaconBlock) MarshalJSON() ([]byte, error)
- func (b VersionedSignedBlindedBeaconBlock) SetSignature(sig Signature) (SignedData, error)
- func (b VersionedSignedBlindedBeaconBlock) Signature() Signature
- func (b *VersionedSignedBlindedBeaconBlock) UnmarshalJSON(input []byte) error
- type VersionedSignedValidatorRegistration
- func (r VersionedSignedValidatorRegistration) Clone() (SignedData, error)
- func (r VersionedSignedValidatorRegistration) MarshalJSON() ([]byte, error)
- func (r VersionedSignedValidatorRegistration) SetSignature(sig Signature) (SignedData, error)
- func (r VersionedSignedValidatorRegistration) Signature() Signature
- func (r *VersionedSignedValidatorRegistration) UnmarshalJSON(input []byte) error
- type WireOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DutyToProto ¶ added in v0.3.0
DutyToProto returns the duty as a protobuf.
func NewDutyDeadlineFunc ¶ added in v0.6.0
func NewDutyDeadlineFunc(ctx context.Context, eth2Cl eth2wrap.Client) (func(Duty) (time.Time, bool), error)
NewDutyDeadlineFunc returns the function that provides duty deadlines or false if the duty never deadlines.
func ParSignedDataSetToProto ¶ added in v0.3.0
func ParSignedDataSetToProto(set ParSignedDataSet) (*pbv1.ParSignedDataSet, error)
ParSignedDataSetToProto returns the set as a protobuf.
func ParSignedDataToProto ¶ added in v0.3.0
func ParSignedDataToProto(data ParSignedData) (*pbv1.ParSignedData, error)
ParSignedDataToProto returns the data as a protobuf.
func StartDutyTrace ¶
func StartDutyTrace(ctx context.Context, duty Duty, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
StartDutyTrace returns a context and span rooted to the duty traceID and wrapped in a duty span. This creates a new trace root and should generally only be called when a new duty is scheduled or when a duty is received from the VC or peer.
func UnsignedDataSetToProto ¶ added in v0.4.0
func UnsignedDataSetToProto(set UnsignedDataSet) (*pbv1.UnsignedDataSet, error)
UnsignedDataSetToProto returns the set as a protobuf.
func Wire ¶
func Wire(sched Scheduler, fetch Fetcher, cons Consensus, dutyDB DutyDB, vapi ValidatorAPI, parSigDB ParSigDB, parSigEx ParSigEx, sigAgg SigAgg, aggSigDB AggSigDB, bcast Broadcaster, opts ...WireOption, )
Wire wires the workflow components together.
Types ¶
type AggSigDB ¶
type AggSigDB interface {
// Store stores aggregated signed duty data.
Store(context.Context, Duty, PubKey, SignedData) error
// Await blocks and returns the aggregated signed duty data when available.
Await(context.Context, Duty, PubKey) (SignedData, error)
}
AggSigDB persists aggregated signed duty data.
type AggregatedAttestation ¶ added in v0.10.1
type AggregatedAttestation struct {
eth2p0.Attestation
}
AggregatedAttestation wraps un unsigned aggregated attestation and implements the UnsignedData interface.
func NewAggregatedAttestation ¶ added in v0.10.1
func NewAggregatedAttestation(att *eth2p0.Attestation) AggregatedAttestation
NewAggregatedAttestation returns a new aggregated attestation.
func (AggregatedAttestation) Clone ¶ added in v0.10.1
func (a AggregatedAttestation) Clone() (UnsignedData, error)
func (AggregatedAttestation) MarshalJSON ¶ added in v0.10.1
func (a AggregatedAttestation) MarshalJSON() ([]byte, error)
func (*AggregatedAttestation) UnmarshalJSON ¶ added in v0.10.1
func (a *AggregatedAttestation) UnmarshalJSON(input []byte) error
type Attestation ¶ added in v0.7.0
type Attestation struct {
eth2p0.Attestation
}
Attestation is a signed attestation and implements SignedData.
func NewAttestation ¶ added in v0.7.0
func NewAttestation(att *eth2p0.Attestation) Attestation
NewAttestation is a convenience function that returns a new wrapped attestation.
func (Attestation) Clone ¶ added in v0.7.0
func (a Attestation) Clone() (SignedData, error)
func (Attestation) MarshalJSON ¶ added in v0.7.0
func (a Attestation) MarshalJSON() ([]byte, error)
func (Attestation) SetSignature ¶ added in v0.7.0
func (a Attestation) SetSignature(sig Signature) (SignedData, error)
func (Attestation) Signature ¶ added in v0.7.0
func (a Attestation) Signature() Signature
func (*Attestation) UnmarshalJSON ¶ added in v0.7.0
func (a *Attestation) UnmarshalJSON(b []byte) error
type AttestationData ¶
type AttestationData struct {
Data eth2p0.AttestationData
Duty eth2v1.AttesterDuty
}
AttestationData wraps the eth2 attestation data and adds the original duty. The original duty allows mapping the partial signed response from the VC back to the validator pubkey via the aggregation bits field.
func (AttestationData) Clone ¶ added in v0.7.0
func (a AttestationData) Clone() (UnsignedData, error)
func (AttestationData) MarshalJSON ¶ added in v0.7.0
func (a AttestationData) MarshalJSON() ([]byte, error)
func (*AttestationData) UnmarshalJSON ¶ added in v0.7.0
func (a *AttestationData) UnmarshalJSON(data []byte) error
type AttesterDefinition ¶ added in v0.7.0
type AttesterDefinition struct {
eth2v1.AttesterDuty
}
AttesterDefinition defines an attester duty. It implements DutyDefinition. Note the slight rename from Duty to Definition to avoid overloading the term Duty.
func NewAttesterDefinition ¶ added in v0.7.0
func NewAttesterDefinition(duty *eth2v1.AttesterDuty) AttesterDefinition
NewAttesterDefinition is a convenience function that returns a new attester definition.
func (AttesterDefinition) Clone ¶ added in v0.7.0
func (d AttesterDefinition) Clone() (DutyDefinition, error)
func (AttesterDefinition) MarshalJSON ¶ added in v0.7.0
func (d AttesterDefinition) MarshalJSON() ([]byte, error)
type Broadcaster ¶
Broadcaster broadcasts aggregated signed duty data to the beacon node.
type Consensus ¶
type Consensus interface {
// Propose triggers consensus game of the proposed duty unsigned data set.
Propose(context.Context, Duty, UnsignedDataSet) error
// Subscribe registers a callback for resolved (reached consensus) duty unsigned data set.
Subscribe(func(context.Context, Duty, UnsignedDataSet) error)
}
Consensus comes to consensus on proposed duty data.
type Deadliner ¶ added in v0.9.0
type Deadliner interface {
// Add returns true if the duty was added for future deadline scheduling. It is idempotent
// and returns true if the duty was previously added and still awaits deadline scheduling. It
// returns false if the duty has already expired and cannot therefore be added for scheduling.
Add(duty Duty) bool
// C returns the same read channel every time and contains deadlined duties.
// It should only be called by a single goroutine.
C() <-chan Duty
}
Deadliner provides duty Deadline functionality. The C method isn’t thread safe and may only be used by a single goroutine. So, multiple instances are required for different components and use cases.
func NewDeadliner ¶ added in v0.9.0
NewDeadliner returns a new instance of Deadline.
It also starts a goroutine which is responsible for reading and storing duties, and sending the deadlined duty to receiver's deadlineChan until the context is closed.
type Duty ¶
type Duty struct {
// Slot is the Ethereum consensus layer slot.
Slot int64
// Type is the duty type performed in the slot.
Type DutyType
}
Duty is the unit of work of the core workflow.
func DutyFromProto ¶ added in v0.3.0
DutyFromProto returns the duty from a protobuf.
func NewAggregatorDuty ¶ added in v0.10.1
NewAggregatorDuty returns a new aggregator duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutyAggregator}
vs
core.NewAggregatorDuty(slot)
func NewAttesterDuty ¶
NewAttesterDuty returns a new attester duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutyAttester}
vs
core.NewAttesterDuty(slot)
func NewBuilderProposerDuty ¶ added in v0.9.0
NewBuilderProposerDuty returns a new builder proposer duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutyBuilderProposer}
vs
core.NewBuilderProposerDuty(slot)
func NewBuilderRegistrationDuty ¶ added in v0.10.0
NewBuilderRegistrationDuty returns a new builder registration duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutyBuilderRegistration}
vs
core.NewBuilderRegistrationDuty(slot)
func NewPrepareAggregatorDuty ¶ added in v0.10.1
NewPrepareAggregatorDuty returns a new prepare aggregator duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutyPrepareAggregator}
vs
core.NewPrepareAggregatorDuty(slot)
func NewProposerDuty ¶ added in v0.3.0
NewProposerDuty returns a new proposer duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutyProposer}
vs
core.NewProposerDuty(slot)
func NewRandaoDuty ¶ added in v0.3.0
NewRandaoDuty returns a new randao duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutyRandao}
vs
core.NewRandaoDuty(slot)
func NewSignatureDuty ¶ added in v0.10.0
NewSignatureDuty returns a new Signature duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutySignature}
vs
core.NewSignatureDuty(slot)
func NewVoluntaryExit ¶ added in v0.9.0
NewVoluntaryExit returns a new voluntary exit duty. It is a convenience function that is slightly more readable and concise than the struct literal equivalent:
core.Duty{Slot: slot, Type: core.DutyExit}
vs
core.NewVoluntaryExit(slot)
type DutyDB ¶
type DutyDB interface {
// Store stores the unsigned duty data set.
Store(context.Context, Duty, UnsignedDataSet) error
// AwaitBeaconBlock blocks and returns the proposed beacon block
// for the slot when available.
AwaitBeaconBlock(ctx context.Context, slot int64) (*spec.VersionedBeaconBlock, error)
// AwaitBlindedBeaconBlock blocks and returns the proposed blinded beacon block
// for the slot when available.
AwaitBlindedBeaconBlock(ctx context.Context, slot int64) (*eth2api.VersionedBlindedBeaconBlock, error)
// AwaitAttestation blocks and returns the attestation data
// for the slot and committee index when available.
AwaitAttestation(ctx context.Context, slot, commIdx int64) (*eth2p0.AttestationData, error)
// PubKeyByAttestation returns the validator PubKey for the provided attestation data
// slot, committee index and validator committee index. This allows mapping of attestation
// data response to validator.
PubKeyByAttestation(ctx context.Context, slot, commIdx, valCommIdx int64) (PubKey, error)
// AwaitAggAttestation blocks and returns the aggregated attestation for the slot
// and attestation when available.
AwaitAggAttestation(ctx context.Context, slot int64, attestationRoot eth2p0.Root) (*eth2p0.Attestation, error)
}
DutyDB persists unsigned duty data sets and makes it available for querying. It also acts as slashing database.
type DutyDefinition ¶ added in v0.7.0
type DutyDefinition interface {
// Clone returns a cloned copy of the DutyDefinition.
Clone() (DutyDefinition, error)
// Marshaler returns the json serialised duty definition.
json.Marshaler
}
DutyDefinition defines the duty including parameters required to fetch the duty data, it is the result of resolving duties at the start of an epoch.
func NewSyncCommitteDefinition ¶ added in v0.10.1
func NewSyncCommitteDefinition(duty *eth2v1.SyncCommitteeDuty) DutyDefinition
type DutyDefinitionSet ¶ added in v0.7.0
type DutyDefinitionSet map[PubKey]DutyDefinition
DutyDefinitionSet is a set of duty definitions, one per validator.
func (DutyDefinitionSet) Clone ¶ added in v0.7.0
func (s DutyDefinitionSet) Clone() (DutyDefinitionSet, error)
Clone returns a cloned copy of the DutyDefinitionSet. For an immutable core workflow architecture, remember to clone data when it leaves the current scope (sharing, storing, returning, etc).
type DutyType ¶
type DutyType int
DutyType enumerates the different types of duties.
const ( DutyUnknown DutyType = 0 DutyProposer DutyType = 1 DutyAttester DutyType = 2 DutySignature DutyType = 3 DutyExit DutyType = 4 DutyBuilderProposer DutyType = 5 DutyBuilderRegistration DutyType = 6 DutyRandao DutyType = 7 DutyPrepareAggregator DutyType = 8 DutyAggregator DutyType = 9 DutySyncMessage DutyType = 10 DutyPrepareSyncContribution DutyType = 11 DutySyncContribution DutyType = 12 )
func AllDutyTypes ¶
func AllDutyTypes() []DutyType
AllDutyTypes returns a list of all valid duty types.
type EmptyDefinition ¶ added in v0.10.1
type EmptyDefinition struct{}
EmptyDefinition is an empty implementation of DutyDefinition.
func NewEmptyDefinition ¶ added in v0.10.1
func NewEmptyDefinition() EmptyDefinition
NewEmptyDefinition returns a convenience function that returns a new EmptyDefinition.
func (EmptyDefinition) Clone ¶ added in v0.10.1
func (EmptyDefinition) Clone() (DutyDefinition, error)
func (EmptyDefinition) MarshalJSON ¶ added in v0.10.1
func (EmptyDefinition) MarshalJSON() ([]byte, error)
type Fetcher ¶
type Fetcher interface {
// Fetch triggers fetching of a proposed duty data set.
Fetch(context.Context, Duty, DutyDefinitionSet) error
// Subscribe registers a callback for proposed unsigned duty data sets.
Subscribe(func(context.Context, Duty, UnsignedDataSet) error)
// RegisterAggSigDB registers a function to get resolved aggregated
// signed data from the AggSigDB (e.g., randao reveals).
RegisterAggSigDB(func(context.Context, Duty, PubKey) (SignedData, error))
// RegisterAwaitAttData registers a function to get attestation data from DutyDB.
RegisterAwaitAttData(func(ctx context.Context, slot int64, commIdx int64) (*eth2p0.AttestationData, error))
}
Fetcher fetches proposed unsigned duty data.
type ParSigDB ¶
type ParSigDB interface {
// StoreInternal stores an internally received partially signed duty data set.
StoreInternal(context.Context, Duty, ParSignedDataSet) error
// StoreExternal stores an externally received partially signed duty data set.
StoreExternal(context.Context, Duty, ParSignedDataSet) error
// SubscribeInternal registers a callback when an internal
// partially signed duty set is stored.
SubscribeInternal(func(context.Context, Duty, ParSignedDataSet) error)
// SubscribeThreshold registers a callback when *threshold*
// partially signed duty is reached for a DV.
SubscribeThreshold(func(context.Context, Duty, PubKey, []ParSignedData) error)
}
ParSigDB persists partial signatures and sends them to the partial signature exchange and aggregation.
type ParSigEx ¶
type ParSigEx interface {
// Broadcast broadcasts the partially signed duty data set to all peers.
Broadcast(context.Context, Duty, ParSignedDataSet) error
// Subscribe registers a callback when a partially signed duty set
// is received from a peer.
Subscribe(func(context.Context, Duty, ParSignedDataSet) error)
}
ParSigEx exchanges partially signed duty data sets.
type ParSignedData ¶
type ParSignedData struct {
// SignedData is a partially signed duty data.
SignedData
ShareIdx int
}
ParSignedData is a partially signed duty data only signed by a single threshold BLS share.
func NewPartialAttestation ¶ added in v0.7.0
func NewPartialAttestation(att *eth2p0.Attestation, shareIdx int) ParSignedData
NewPartialAttestation is a convenience function that returns a new partially signed attestation.
func NewPartialSignature ¶ added in v0.7.0
func NewPartialSignature(sig Signature, shareIdx int) ParSignedData
NewPartialSignature is a convenience function that returns a new partially signature.
func NewPartialSignedAggregateAndProof ¶ added in v0.10.1
func NewPartialSignedAggregateAndProof(data *eth2p0.SignedAggregateAndProof, shareIdx int) ParSignedData
NewPartialSignedAggregateAndProof is a convenience function which returns a new partially signed SignedAggregateAndProof.
func NewPartialSignedBeaconCommitteeSubscription ¶ added in v0.10.1
func NewPartialSignedBeaconCommitteeSubscription(sub *eth2exp.BeaconCommitteeSubscription, shareIdx int) ParSignedData
NewPartialSignedBeaconCommitteeSubscription is a convenience function which returns new partially signed BeaconCommitteeSubscription.
func NewPartialSignedRandao ¶ added in v0.10.0
func NewPartialSignedRandao(epoch eth2p0.Epoch, randao eth2p0.BLSSignature, shareIdx int) ParSignedData
NewPartialSignedRandao is a convenience function that returns a new partially signed Randao Reveal.
func NewPartialSignedVoluntaryExit ¶ added in v0.7.0
func NewPartialSignedVoluntaryExit(exit *eth2p0.SignedVoluntaryExit, shareIdx int) ParSignedData
NewPartialSignedVoluntaryExit is a convenience function that returns a new partially signed voluntary exit.
func NewPartialVersionedSignedBeaconBlock ¶ added in v0.7.0
func NewPartialVersionedSignedBeaconBlock(block *spec.VersionedSignedBeaconBlock, shareIdx int) (ParSignedData, error)
NewPartialVersionedSignedBeaconBlock is a convenience function that returns a new partial signed block.
func NewPartialVersionedSignedBlindedBeaconBlock ¶ added in v0.9.0
func NewPartialVersionedSignedBlindedBeaconBlock(block *eth2api.VersionedSignedBlindedBeaconBlock, shareIdx int) (ParSignedData, error)
NewPartialVersionedSignedBlindedBeaconBlock is a convenience function that returns a new partial signed block.
func NewPartialVersionedSignedValidatorRegistration ¶ added in v0.10.0
func NewPartialVersionedSignedValidatorRegistration(registration *eth2api.VersionedSignedValidatorRegistration, shareIdx int) (ParSignedData, error)
NewPartialVersionedSignedValidatorRegistration is a convenience function that returns a new partially signed validator (builder) registration.
func ParSignedDataFromProto ¶ added in v0.3.0
func ParSignedDataFromProto(typ DutyType, data *pbv1.ParSignedData) (ParSignedData, error)
ParSignedDataFromProto returns the data from a protobuf.
func (ParSignedData) Clone ¶ added in v0.7.0
func (d ParSignedData) Clone() (ParSignedData, error)
Clone returns a cloned copy of the ParSignedData. For an immutable core workflow architecture, remember to clone data when it leaves the current scope (sharing, storing, returning, etc).
type ParSignedDataSet ¶
type ParSignedDataSet map[PubKey]ParSignedData
ParSignedDataSet is a set of partially signed duty data objects, one per validator.
func ParSignedDataSetFromProto ¶ added in v0.3.0
func ParSignedDataSetFromProto(typ DutyType, set *pbv1.ParSignedDataSet) (ParSignedDataSet, error)
ParSignedDataSetFromProto returns the set from a protobuf.
func (ParSignedDataSet) Clone ¶ added in v0.7.0
func (s ParSignedDataSet) Clone() (ParSignedDataSet, error)
Clone returns a cloned copy of the ParSignedDataSet. For an immutable core workflow architecture, remember to clone data when it leaves the current scope (sharing, storing, returning, etc).
type ProposerDefinition ¶ added in v0.7.0
type ProposerDefinition struct {
eth2v1.ProposerDuty
}
ProposerDefinition defines a block proposer duty. It implements DutyDefinition. Note the slight rename from Duty to Definition to avoid overloading the term Duty.
func NewProposerDefinition ¶ added in v0.7.0
func NewProposerDefinition(duty *eth2v1.ProposerDuty) ProposerDefinition
NewProposerDefinition is a convenience function that returns a new proposer definition.
func (ProposerDefinition) Clone ¶ added in v0.7.0
func (d ProposerDefinition) Clone() (DutyDefinition, error)
func (ProposerDefinition) MarshalJSON ¶ added in v0.7.0
func (d ProposerDefinition) MarshalJSON() ([]byte, error)
type PubKey ¶
type PubKey string
PubKey is the DV root public key, the identifier of a validator in the core workflow. It is a hex formatted string, e.g. "0xb82bc680e...".
func PubKeyFromBytes ¶
PubKeyFromBytes returns a new public key from raw bytes.
type Scheduler ¶
type Scheduler interface {
// SubscribeDuties subscribes a callback function for triggered duties.
SubscribeDuties(func(context.Context, Duty, DutyDefinitionSet) error)
// SubscribeSlots subscribes a callback function for triggered slots.
SubscribeSlots(func(context.Context, Slot) error)
// GetDutyDefinition returns the definition set for a duty if already resolved.
GetDutyDefinition(context.Context, Duty) (DutyDefinitionSet, error)
}
Scheduler triggers the start of a duty workflow.
type SigAgg ¶
type SigAgg interface {
// Aggregate aggregates the partially signed duty data for the DV.
Aggregate(context.Context, Duty, PubKey, []ParSignedData) error
// Subscribe registers a callback for aggregated signed duty data.
Subscribe(func(context.Context, Duty, PubKey, SignedData) error)
}
SigAgg aggregates threshold partial signatures.
type Signature ¶
type Signature []byte
Signature is a BLS12-381 Signature. It implements SignedData.
func SigFromETH2 ¶
func SigFromETH2(sig eth2p0.BLSSignature) Signature
SigFromETH2 returns a new signature from eth2 phase0 BLSSignature.
func (Signature) Clone ¶ added in v0.7.0
func (s Signature) Clone() (SignedData, error)
func (Signature) MarshalJSON ¶ added in v0.7.0
func (Signature) SetSignature ¶ added in v0.7.0
func (Signature) SetSignature(sig Signature) (SignedData, error)
func (Signature) ToETH2 ¶
func (s Signature) ToETH2() eth2p0.BLSSignature
ToETH2 returns the signature as an eth2 phase0 BLSSignature.
func (*Signature) UnmarshalJSON ¶ added in v0.7.0
type SignedAggregateAndProof ¶ added in v0.10.1
type SignedAggregateAndProof struct {
eth2p0.SignedAggregateAndProof
}
SignedAggregateAndProof wraps eth2p0.SignedAggregateAndProof and implements SignedData.
func NewSignedAggregateAndProof ¶ added in v0.10.1
func NewSignedAggregateAndProof(data *eth2p0.SignedAggregateAndProof) SignedAggregateAndProof
NewSignedAggregateAndProof is a convenience function which returns a new signed SignedAggregateAndProof.
func (SignedAggregateAndProof) Clone ¶ added in v0.10.1
func (s SignedAggregateAndProof) Clone() (SignedData, error)
func (SignedAggregateAndProof) MarshalJSON ¶ added in v0.10.1
func (s SignedAggregateAndProof) MarshalJSON() ([]byte, error)
func (SignedAggregateAndProof) SetSignature ¶ added in v0.10.1
func (s SignedAggregateAndProof) SetSignature(sig Signature) (SignedData, error)
func (SignedAggregateAndProof) Signature ¶ added in v0.10.1
func (s SignedAggregateAndProof) Signature() Signature
func (*SignedAggregateAndProof) UnmarshalJSON ¶ added in v0.10.1
func (s *SignedAggregateAndProof) UnmarshalJSON(input []byte) error
type SignedBeaconCommitteeSubscription ¶ added in v0.10.1
type SignedBeaconCommitteeSubscription struct {
eth2exp.BeaconCommitteeSubscription
}
SignedBeaconCommitteeSubscription is a Signed BeaconCommitteeSubscription which implements SignedData.
func NewBeaconCommitteeSubscription ¶ added in v0.10.1
func NewBeaconCommitteeSubscription(sub *eth2exp.BeaconCommitteeSubscription) SignedBeaconCommitteeSubscription
NewBeaconCommitteeSubscription is a convenience function which returns new signed BeaconCommitteeSubscription.
func (SignedBeaconCommitteeSubscription) Clone ¶ added in v0.10.1
func (s SignedBeaconCommitteeSubscription) Clone() (SignedData, error)
func (SignedBeaconCommitteeSubscription) MarshalJSON ¶ added in v0.10.1
func (s SignedBeaconCommitteeSubscription) MarshalJSON() ([]byte, error)
func (SignedBeaconCommitteeSubscription) SetSignature ¶ added in v0.10.1
func (s SignedBeaconCommitteeSubscription) SetSignature(sig Signature) (SignedData, error)
func (SignedBeaconCommitteeSubscription) Signature ¶ added in v0.10.1
func (s SignedBeaconCommitteeSubscription) Signature() Signature
func (*SignedBeaconCommitteeSubscription) UnmarshalJSON ¶ added in v0.10.1
func (s *SignedBeaconCommitteeSubscription) UnmarshalJSON(input []byte) error
type SignedData ¶ added in v0.7.0
type SignedData interface {
// Signature returns the signed duty data's signature.
Signature() Signature
// SetSignature returns a copy of signed duty data with the signature replaced.
SetSignature(Signature) (SignedData, error)
// Clone returns a cloned copy of the SignedData. For an immutable core workflow architecture,
// remember to clone data when it leaves the current scope (sharing, storing, returning, etc).
Clone() (SignedData, error)
// Marshaler returns the json serialised signed duty data (including the signature).
json.Marshaler
}
SignedData is a signed duty data.
type SignedRandao ¶ added in v0.10.0
type SignedRandao struct {
eth2util.SignedEpoch
}
SignedRandao is a signed Randao Reveal which implements SignedData.
func (SignedRandao) Clone ¶ added in v0.10.0
func (s SignedRandao) Clone() (SignedData, error)
func (SignedRandao) MarshalJSON ¶ added in v0.10.0
func (s SignedRandao) MarshalJSON() ([]byte, error)
func (SignedRandao) SetSignature ¶ added in v0.10.0
func (s SignedRandao) SetSignature(sig Signature) (SignedData, error)
func (SignedRandao) Signature ¶ added in v0.10.0
func (s SignedRandao) Signature() Signature
func (*SignedRandao) UnmarshalJSON ¶ added in v0.10.0
func (s *SignedRandao) UnmarshalJSON(input []byte) error
type SignedSyncContribution ¶ added in v0.10.1
type SignedSyncContribution struct {
altair.SignedContributionAndProof
}
SignedSyncContribution wraps altair.SignedContributionAndProof and implements SignedData.
func (SignedSyncContribution) Clone ¶ added in v0.10.1
func (s SignedSyncContribution) Clone() (SignedData, error)
func (SignedSyncContribution) MarshalJSON ¶ added in v0.10.1
func (s SignedSyncContribution) MarshalJSON() ([]byte, error)
func (SignedSyncContribution) SetSignature ¶ added in v0.10.1
func (s SignedSyncContribution) SetSignature(sig Signature) (SignedData, error)
func (SignedSyncContribution) Signature ¶ added in v0.10.1
func (s SignedSyncContribution) Signature() Signature
func (*SignedSyncContribution) UnmarshalJSON ¶ added in v0.10.1
func (s *SignedSyncContribution) UnmarshalJSON(input []byte) error
type SignedSyncMessage ¶ added in v0.10.1
type SignedSyncMessage struct {
altair.SyncCommitteeMessage
}
SignedSyncMessage wraps altair.SyncCommitteeMessage and implements SignedData.
func (SignedSyncMessage) Clone ¶ added in v0.10.1
func (s SignedSyncMessage) Clone() (SignedData, error)
func (SignedSyncMessage) MarshalJSON ¶ added in v0.10.1
func (s SignedSyncMessage) MarshalJSON() ([]byte, error)
func (SignedSyncMessage) SetSignature ¶ added in v0.10.1
func (s SignedSyncMessage) SetSignature(sig Signature) (SignedData, error)
func (SignedSyncMessage) Signature ¶ added in v0.10.1
func (s SignedSyncMessage) Signature() Signature
func (*SignedSyncMessage) UnmarshalJSON ¶ added in v0.10.1
func (s *SignedSyncMessage) UnmarshalJSON(input []byte) error
type SignedVoluntaryExit ¶ added in v0.7.0
type SignedVoluntaryExit struct {
eth2p0.SignedVoluntaryExit
}
func NewSignedVoluntaryExit ¶ added in v0.7.0
func NewSignedVoluntaryExit(exit *eth2p0.SignedVoluntaryExit) SignedVoluntaryExit
NewSignedVoluntaryExit is a convenience function that returns a new signed voluntary exit.
func (SignedVoluntaryExit) Clone ¶ added in v0.7.0
func (e SignedVoluntaryExit) Clone() (SignedData, error)
func (SignedVoluntaryExit) MarshalJSON ¶ added in v0.7.0
func (e SignedVoluntaryExit) MarshalJSON() ([]byte, error)
func (SignedVoluntaryExit) SetSignature ¶ added in v0.7.0
func (e SignedVoluntaryExit) SetSignature(sig Signature) (SignedData, error)
func (SignedVoluntaryExit) Signature ¶ added in v0.7.0
func (e SignedVoluntaryExit) Signature() Signature
func (*SignedVoluntaryExit) UnmarshalJSON ¶ added in v0.7.0
func (e *SignedVoluntaryExit) UnmarshalJSON(b []byte) error
type Slot ¶ added in v0.10.0
Slot is a beacon chain slot including chain metadata to infer epoch and next slot.
func (Slot) FirstInEpoch ¶ added in v0.10.0
FirstInEpoch returns true if this is the first slot in the epoch.
func (Slot) LastInEpoch ¶ added in v0.10.0
LastInEpoch returns true if this is the last slot in the epoch.
type SyncCommitteeDefinition ¶ added in v0.10.1
type SyncCommitteeDefinition struct {
eth2v1.SyncCommitteeDuty
}
func (SyncCommitteeDefinition) Clone ¶ added in v0.10.1
func (s SyncCommitteeDefinition) Clone() (DutyDefinition, error)
func (SyncCommitteeDefinition) MarshalJSON ¶ added in v0.10.1
func (s SyncCommitteeDefinition) MarshalJSON() ([]byte, error)
type SyncContribution ¶ added in v0.10.1
type SyncContribution struct {
altair.SyncCommitteeContribution
}
func (SyncContribution) Clone ¶ added in v0.10.1
func (s SyncContribution) Clone() (UnsignedData, error)
func (SyncContribution) MarshalJSON ¶ added in v0.10.1
func (s SyncContribution) MarshalJSON() ([]byte, error)
func (*SyncContribution) UnmarshalJSON ¶ added in v0.10.1
func (s *SyncContribution) UnmarshalJSON(input []byte) error
type UnsignedData ¶
type UnsignedData interface {
// Clone returns a cloned copy of the UnsignedData. For an immutable core workflow architecture,
// remember to clone data when it leaves the current scope (sharing, storing, returning, etc).
Clone() (UnsignedData, error)
// Marshaler returns the json serialised unsigned duty data.
json.Marshaler
}
UnsignedData represents an unsigned duty data object.
func UnmarshalUnsignedData ¶ added in v0.7.0
func UnmarshalUnsignedData(typ DutyType, data []byte) (UnsignedData, error)
UnmarshalUnsignedData returns an instantiated unsigned data based on the duty type. TODO(corver): Unexport once leadercast is removed or uses protobufs.
type UnsignedDataSet ¶
type UnsignedDataSet map[PubKey]UnsignedData
UnsignedDataSet is a set of unsigned duty data objects, one per validator.
func UnsignedDataSetFromProto ¶ added in v0.4.0
func UnsignedDataSetFromProto(typ DutyType, set *pbv1.UnsignedDataSet) (UnsignedDataSet, error)
UnsignedDataSetFromProto returns the set from a protobuf.
func (UnsignedDataSet) Clone ¶ added in v0.7.0
func (s UnsignedDataSet) Clone() (UnsignedDataSet, error)
Clone returns a cloned copy of the UnsignedDataSet. For an immutable core workflow architecture, remember to clone data when it leaves the current scope (sharing, storing, returning, etc).
type ValidatorAPI ¶
type ValidatorAPI interface {
// RegisterAwaitBeaconBlock registers a function to query unsigned beacon block by slot.
RegisterAwaitBeaconBlock(func(ctx context.Context, slot int64) (*spec.VersionedBeaconBlock, error))
// RegisterAwaitBlindedBeaconBlock registers a function to query unsigned blinded beacon block by slot.
RegisterAwaitBlindedBeaconBlock(func(ctx context.Context, slot int64) (*eth2api.VersionedBlindedBeaconBlock, error))
// RegisterAwaitAttestation registers a function to query attestation data.
RegisterAwaitAttestation(func(ctx context.Context, slot, commIdx int64) (*eth2p0.AttestationData, error))
// RegisterPubKeyByAttestation registers a function to query validator by attestation.
RegisterPubKeyByAttestation(func(ctx context.Context, slot, commIdx, valCommIdx int64) (PubKey, error))
// RegisterGetDutyDefinition registers a function to query duty definitions.
RegisterGetDutyDefinition(func(context.Context, Duty) (DutyDefinitionSet, error))
// RegisterAwaitAggAttestation registers a function to query aggregated attestation.
RegisterAwaitAggAttestation(fn func(ctx context.Context, slot int64, attestationDataRoot eth2p0.Root) (*eth2p0.Attestation, error))
// RegisterAggSigDB registers a function to query aggregated signed data from aggSigDB.
RegisterAwaitAggSigDB(func(context.Context, Duty, PubKey) (SignedData, error))
// Subscribe registers a function to store partially signed data sets.
Subscribe(func(context.Context, Duty, ParSignedDataSet) error)
}
ValidatorAPI provides a beacon node API to validator clients. It serves duty data from the DutyDB and stores partial signed data in the ParSigDB.
type VersionedBeaconBlock ¶ added in v0.7.0
type VersionedBeaconBlock struct {
spec.VersionedBeaconBlock
}
func NewVersionedBeaconBlock ¶ added in v0.7.0
func NewVersionedBeaconBlock(block *spec.VersionedBeaconBlock) (VersionedBeaconBlock, error)
NewVersionedBeaconBlock validates and returns a new wrapped VersionedBeaconBlock.
func (VersionedBeaconBlock) Clone ¶ added in v0.7.0
func (b VersionedBeaconBlock) Clone() (UnsignedData, error)
func (VersionedBeaconBlock) MarshalJSON ¶ added in v0.7.0
func (b VersionedBeaconBlock) MarshalJSON() ([]byte, error)
func (*VersionedBeaconBlock) UnmarshalJSON ¶ added in v0.7.0
func (b *VersionedBeaconBlock) UnmarshalJSON(input []byte) error
type VersionedBlindedBeaconBlock ¶ added in v0.9.0
type VersionedBlindedBeaconBlock struct {
eth2api.VersionedBlindedBeaconBlock
}
func NewVersionedBlindedBeaconBlock ¶ added in v0.9.0
func NewVersionedBlindedBeaconBlock(block *eth2api.VersionedBlindedBeaconBlock) (VersionedBlindedBeaconBlock, error)
NewVersionedBlindedBeaconBlock validates and returns a new wrapped VersionedBlindedBeaconBlock.
func (VersionedBlindedBeaconBlock) Clone ¶ added in v0.9.0
func (b VersionedBlindedBeaconBlock) Clone() (UnsignedData, error)
func (VersionedBlindedBeaconBlock) MarshalJSON ¶ added in v0.9.0
func (b VersionedBlindedBeaconBlock) MarshalJSON() ([]byte, error)
func (*VersionedBlindedBeaconBlock) UnmarshalJSON ¶ added in v0.9.0
func (b *VersionedBlindedBeaconBlock) UnmarshalJSON(input []byte) error
type VersionedSignedBeaconBlock ¶ added in v0.7.0
type VersionedSignedBeaconBlock struct {
spec.VersionedSignedBeaconBlock // Could subtype instead of embed, but aligning with Attestation that cannot subtype.
}
VersionedSignedBeaconBlock is a signed versioned beacon block and implements SignedData.
func NewVersionedSignedBeaconBlock ¶ added in v0.7.0
func NewVersionedSignedBeaconBlock(block *spec.VersionedSignedBeaconBlock) (VersionedSignedBeaconBlock, error)
NewVersionedSignedBeaconBlock validates and returns a new wrapped VersionedSignedBeaconBlock.
func (VersionedSignedBeaconBlock) Clone ¶ added in v0.7.0
func (b VersionedSignedBeaconBlock) Clone() (SignedData, error)
func (VersionedSignedBeaconBlock) MarshalJSON ¶ added in v0.7.0
func (b VersionedSignedBeaconBlock) MarshalJSON() ([]byte, error)
func (VersionedSignedBeaconBlock) SetSignature ¶ added in v0.7.0
func (b VersionedSignedBeaconBlock) SetSignature(sig Signature) (SignedData, error)
func (VersionedSignedBeaconBlock) Signature ¶ added in v0.7.0
func (b VersionedSignedBeaconBlock) Signature() Signature
func (*VersionedSignedBeaconBlock) UnmarshalJSON ¶ added in v0.7.0
func (b *VersionedSignedBeaconBlock) UnmarshalJSON(input []byte) error
type VersionedSignedBlindedBeaconBlock ¶ added in v0.9.0
type VersionedSignedBlindedBeaconBlock struct {
eth2api.VersionedSignedBlindedBeaconBlock // Could subtype instead of embed, but aligning with Attestation that cannot subtype.
}
VersionedSignedBlindedBeaconBlock is a signed versioned blinded beacon block and implements SignedData.
func NewVersionedSignedBlindedBeaconBlock ¶ added in v0.9.0
func NewVersionedSignedBlindedBeaconBlock(block *eth2api.VersionedSignedBlindedBeaconBlock) (VersionedSignedBlindedBeaconBlock, error)
NewVersionedSignedBlindedBeaconBlock validates and returns a new wrapped VersionedSignedBlindedBeaconBlock.
func (VersionedSignedBlindedBeaconBlock) Clone ¶ added in v0.9.0
func (b VersionedSignedBlindedBeaconBlock) Clone() (SignedData, error)
func (VersionedSignedBlindedBeaconBlock) MarshalJSON ¶ added in v0.9.0
func (b VersionedSignedBlindedBeaconBlock) MarshalJSON() ([]byte, error)
func (VersionedSignedBlindedBeaconBlock) SetSignature ¶ added in v0.9.0
func (b VersionedSignedBlindedBeaconBlock) SetSignature(sig Signature) (SignedData, error)
func (VersionedSignedBlindedBeaconBlock) Signature ¶ added in v0.9.0
func (b VersionedSignedBlindedBeaconBlock) Signature() Signature
func (*VersionedSignedBlindedBeaconBlock) UnmarshalJSON ¶ added in v0.9.0
func (b *VersionedSignedBlindedBeaconBlock) UnmarshalJSON(input []byte) error
type VersionedSignedValidatorRegistration ¶ added in v0.10.0
type VersionedSignedValidatorRegistration struct {
eth2api.VersionedSignedValidatorRegistration
}
VersionedSignedValidatorRegistration is a signed versioned validator (builder) registration and implements SignedData.
func NewVersionedSignedValidatorRegistration ¶ added in v0.10.0
func NewVersionedSignedValidatorRegistration(registration *eth2api.VersionedSignedValidatorRegistration) (VersionedSignedValidatorRegistration, error)
NewVersionedSignedValidatorRegistration is a convenience function that returns a new signed validator (builder) registration.
func (VersionedSignedValidatorRegistration) Clone ¶ added in v0.10.0
func (r VersionedSignedValidatorRegistration) Clone() (SignedData, error)
func (VersionedSignedValidatorRegistration) MarshalJSON ¶ added in v0.10.0
func (r VersionedSignedValidatorRegistration) MarshalJSON() ([]byte, error)
func (VersionedSignedValidatorRegistration) SetSignature ¶ added in v0.10.0
func (r VersionedSignedValidatorRegistration) SetSignature(sig Signature) (SignedData, error)
func (VersionedSignedValidatorRegistration) Signature ¶ added in v0.10.0
func (r VersionedSignedValidatorRegistration) Signature() Signature
func (*VersionedSignedValidatorRegistration) UnmarshalJSON ¶ added in v0.10.0
func (r *VersionedSignedValidatorRegistration) UnmarshalJSON(input []byte) error
type WireOption ¶
type WireOption func(*wireFuncs)
WireOption defines a functional option to configure wiring.
func WithAsyncRetry ¶ added in v0.3.0
func WithAsyncRetry(retryer *retry.Retryer[Duty]) WireOption
WithAsyncRetry wraps component input functions with the async Retryer adding robustness to network issues.
func WithTracing ¶
func WithTracing() WireOption
WithTracing wraps component input functions with tracing spans.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bcast provides the core workflow's broadcaster component that broadcasts/submits aggregated signed duty data to the beacon node.
|
Package bcast provides the core workflow's broadcaster component that broadcasts/submits aggregated signed duty data to the beacon node. |
|
corepb
|
|
|
Package priority implements the priority protocol that resolves arbitrary cluster wide priorities.
|
Package priority implements the priority protocol that resolves arbitrary cluster wide priorities. |
|
Package qbft is an implementation of the https://arxiv.org/pdf/2002.03613.pdf paper referenced by the QBFT spec https://github.com/ConsenSys/qbft-formal-spec-and-verification.
|
Package qbft is an implementation of the https://arxiv.org/pdf/2002.03613.pdf paper referenced by the QBFT spec https://github.com/ConsenSys/qbft-formal-spec-and-verification. |
|
Package sigagg provides the sigagg core workflow component that aggregates *threshold* partial signed duty data objects into an aggregated signed duty data object ready to be broadcasted to the beacon chain.
|
Package sigagg provides the sigagg core workflow component that aggregates *threshold* partial signed duty data objects into an aggregated signed duty data object ready to be broadcasted to the beacon chain. |
|
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.
|
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. |