Documentation ¶
Overview ¶
nolint
Index ¶
- Variables
- func CalcEligibleLayer(epochNumber types.EpochID, layersPerEpoch uint32, vrfSig []byte) types.LayerID
- func ComputeWeightPerEligibility(cdb *datastore.CachedDB, ballot *types.Ballot, ...) (util.Weight, error)
- func GetNumEligibleSlots(weight, totalWeight uint64, committeeSize uint32, layersPerEpoch uint32) (uint32, error)
- func SerializeVRFMessage(beacon types.Beacon, epoch types.EpochID, counter uint32) ([]byte, error)
- type Config
- type Handler
- type Opt
- type Validator
- type VrfMessage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrZeroTotalWeight is returned when zero total epoch weight is used when calculating eligible slots. ErrZeroTotalWeight = errors.New("zero total weight not allowed") )
Functions ¶
func CalcEligibleLayer ¶
func CalcEligibleLayer(epochNumber types.EpochID, layersPerEpoch uint32, vrfSig []byte) types.LayerID
CalcEligibleLayer calculates the eligible layer from the VRF signature.
func ComputeWeightPerEligibility ¶
func ComputeWeightPerEligibility( cdb *datastore.CachedDB, ballot *types.Ballot, layerSize, layersPerEpoch uint32, ) (util.Weight, error)
ComputeWeightPerEligibility computes the ballot weight per eligibility w.r.t the active set recorded in its reference ballot.
Types ¶
type Config ¶
type Config struct { LayerSize uint32 LayersPerEpoch uint32 GoldenATXID types.ATXID MaxExceptions int Hdist uint32 }
Config defines configuration for the handler.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler processes Proposal from gossip and, if deems it valid, propagates it to peers.
func NewHandler ¶
func NewHandler(cdb *datastore.CachedDB, f system.Fetcher, bc system.BeaconCollector, m meshProvider, opts ...Opt) *Handler
NewHandler creates new Handler.
func (*Handler) HandleProposal ¶
func (h *Handler) HandleProposal(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
HandleProposal is the gossip receiver for Proposal.
func (*Handler) HandleSyncedBallot ¶
HandleSyncedBallot handles Ballot data from sync.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates the eligibility of a Ballot. the validation focuses on eligibility only and assumes the Ballot to be valid otherwise.
func NewEligibilityValidator ¶
func NewEligibilityValidator( avgLayerSize, layersPerEpoch uint32, cdb *datastore.CachedDB, bc system.BeaconCollector, m meshProvider, lg log.Log, ) *Validator
NewEligibilityValidator returns a new EligibilityValidator.
type VrfMessage ¶
VrfMessage is a verification message.
func (*VrfMessage) DecodeScale ¶
func (t *VrfMessage) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*VrfMessage) EncodeScale ¶
func (t *VrfMessage) EncodeScale(enc *scale.Encoder) (total int, err error)