pool

package
v0.34.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2025 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregate

type Aggregate struct {
	Participants phase0.AttestationBits
	Sig          common.BLSSignature
}

type Assignment

type Assignment struct {
	Index common.ValidatorIndex
	Epoch common.Epoch
}

type AttRef

type AttRef struct {
	DataRoot common.Root
	Sig      common.BLSSignature
}

type AttSearchOption

type AttSearchOption func(a *attSearch)

func WithCommittee

func WithCommittee(index common.CommitteeIndex) AttSearchOption

func WithSlot

func WithSlot(slot common.Slot) AttSearchOption

type AttestationPool

type AttestationPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewAttestationPool

func NewAttestationPool(spec *common.Spec) *AttestationPool

func (*AttestationPool) AddAttestation

func (ap *AttestationPool) AddAttestation(ctx context.Context, att *phase0.Attestation, committee common.CommitteeIndices) error

func (*AttestationPool) Packing

func (ap *AttestationPool) Packing(ctx context.Context,
	source common.Checkpoint, target common.Checkpoint,
	headRoot common.Root, headSlot common.Slot,
	maxCount uint64, maxTime time.Duration,
	included func(epoch common.Epoch, index common.ValidatorIndex)) ([]phase0.Attestation, error)

Approximation of the optimal attestation packing. Attestations must match source, get prioritized if the target is correct, and more if the head is correct. Attestations may not be included if they already are (checked via included func). Maximum attestation output and packing-time constraints apply.

func (*AttestationPool) Prune

func (ap *AttestationPool) Prune(epoch common.Epoch)

Prune pool based on current epoch, attestations which cannot be included anymore will get pruned.

func (*AttestationPool) Search

func (ap *AttestationPool) Search(opts ...AttSearchOption) (out []*phase0.Attestation)

type AttesterSlashingPool

type AttesterSlashingPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewAttesterSlashingPool

func NewAttesterSlashingPool(spec *common.Spec) *AttesterSlashingPool

func (*AttesterSlashingPool) AddAttesterSlashing

func (asp *AttesterSlashingPool) AddAttesterSlashing(ctx context.Context, sl *phase0.AttesterSlashing) error

This does not filter slashings that are a subset of other slashings. The pool merely collects them. Make sure to protect against spam elsewhere as a caller.

func (*AttesterSlashingPool) All

func (*AttesterSlashingPool) Pack added in v0.16.0

func (asp *AttesterSlashingPool) Pack(estReward func(sl *phase0.AttesterSlashing) int, n uint) []*phase0.AttesterSlashing

Pack n slashings, removes the slashings from the pool. A reward estimator is used to pick the best slashings. Slashings with negative rewards will not be packed.

type IndexedAttData

type IndexedAttData struct {
	Data      phase0.AttestationData
	Committee common.CommitteeIndices
}

type MinAggregates

type MinAggregates struct {
	Aggregates []Aggregate
	// The OR of all bitfields contained in Aggregates list, to easily filter out subsets
	Participants phase0.AttestationBits
	// Things already covered by the sum of the above aggregates, but maybe useful later. Keep a limited number of these.
	Extra []Aggregate
}

type ProposerSlashingPool

type ProposerSlashingPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewProposerSlashingPool

func NewProposerSlashingPool(spec *common.Spec) *ProposerSlashingPool

func (*ProposerSlashingPool) AddProposerSlashing

func (psp *ProposerSlashingPool) AddProposerSlashing(ctx context.Context, sl *phase0.ProposerSlashing) error

func (*ProposerSlashingPool) All added in v0.16.0

func (*ProposerSlashingPool) Pack added in v0.16.0

func (psp *ProposerSlashingPool) Pack(estReward func(sl *phase0.ProposerSlashing) int, n uint) []*phase0.ProposerSlashing

Pack n slashings, removes the slashings from the pool. A reward estimator is used to pick the best slashings. Slashings with negative rewards will not be packed.

type SubnetContrib added in v0.27.0

type SubnetContrib struct {
	// A bit is set if a signature from the validator at the corresponding
	// index in the subcommittee is present in the aggregate `signature`.
	AggregationBits altair.SyncCommitteeSubnetBits
	// Signature by the validator(s) over the block root of `slot`
	Signature common.BLSSignature
}

type SyncCommitteeContributions added in v0.27.0

type SyncCommitteeContributions map[common.Root]map[uint64][]*SubnetContrib

beacon root -> subnet -> contributions

type SyncCommitteeMessages added in v0.27.0

type SyncCommitteeMessages map[common.ValidatorIndex]*altair.SyncCommitteeMessage

func (SyncCommitteeMessages) Select added in v0.27.0

type SyncCommitteePool added in v0.27.0

type SyncCommitteePool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SyncCommitteePool is a very short lived buffer: - The sync committee messages of the previous, current and next slot are buffered - The sync committee contributions (subnet aggregates) of the previous, current and next slot are buffered - As soon as a slot is done, Reset(slot) should be called to transition to a new slot, rotating out buffers. - Nothing is aggregated ahead of time; packing work is avoided if we are not selected as aggregator - At any time the validator can run PackAggregate and PackContribution for the approximate current slot (previous/current/next slot accepted) and beacon block root.

func NewSyncCommitteePool added in v0.27.0

func NewSyncCommitteePool(spec *common.Spec) *SyncCommitteePool

func (*SyncCommitteePool) AddSyncCommitteeContribution added in v0.27.0

func (sp *SyncCommitteePool) AddSyncCommitteeContribution(ctx context.Context, contrib *altair.SyncCommitteeContribution) error

func (*SyncCommitteePool) AddSyncCommitteeMessage added in v0.27.0

func (sp *SyncCommitteePool) AddSyncCommitteeMessage(ctx context.Context, msg *altair.SyncCommitteeMessage) error

func (*SyncCommitteePool) PackAggregate added in v0.27.0

func (sp *SyncCommitteePool) PackAggregate(ctx context.Context, slot common.Slot, beaconBlockRoot common.Root, syncCommittee []common.ValidatorIndex) (*altair.SyncAggregate, error)

func (*SyncCommitteePool) PackContribution added in v0.27.0

func (sp *SyncCommitteePool) PackContribution(ctx context.Context, slot common.Slot, beaconBlockRoot common.Root, subnet uint64, subComm []common.ValidatorIndex) (*altair.SyncCommitteeContribution, error)

func (*SyncCommitteePool) Reset added in v0.27.0

func (sp *SyncCommitteePool) Reset(slot common.Slot)

type VoluntaryExitPool

type VoluntaryExitPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewVoluntaryExitPool

func NewVoluntaryExitPool(spec *common.Spec) *VoluntaryExitPool

func (*VoluntaryExitPool) AddVoluntaryExit

func (vep *VoluntaryExitPool) AddVoluntaryExit(ctx context.Context, exit *phase0.SignedVoluntaryExit) error

func (*VoluntaryExitPool) All added in v0.16.0

func (*VoluntaryExitPool) Pack added in v0.16.0

Pack n exits, removes the exits from the pool. A ranking function is used to pick the best exits. Exits with negative rank function outputs will not be packed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL