proposals

package
v0.2.20-beta.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

View Source
var (
	CalcEligibleLayer   = util.CalcEligibleLayer
	GetNumEligibleSlots = util.GetNumEligibleSlots
	// ComputeWeightPerEligibility computes the ballot weight per eligibility w.r.t the active set recorded in its reference ballot.
	ComputeWeightPerEligibility = util.ComputeWeightPerEligibility
)

Functions

func SerializeVRFMessage

func SerializeVRFMessage(beacon types.Beacon, epoch types.EpochID, counter uint32) ([]byte, error)

SerializeVRFMessage serializes a message for generating/verifying a VRF signature.

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, decoder ballotDecoder, 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

func (h *Handler) HandleSyncedBallot(ctx context.Context, data []byte) error

HandleSyncedBallot handles Ballot data from sync.

func (*Handler) HandleSyncedProposal

func (h *Handler) HandleSyncedProposal(ctx context.Context, data []byte) error

HandleSyncedProposal handles Proposal data from sync.

type Opt

type Opt func(h *Handler)

Opt for configuring Handler.

func WithConfig

func WithConfig(cfg Config) Opt

WithConfig defines protocol parameters.

func WithLogger

func WithLogger(logger log.Log) Opt

WithLogger defines logger for Handler.

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.

func (*Validator) CheckEligibility

func (v *Validator) CheckEligibility(ctx context.Context, ballot *types.Ballot) (bool, error)

CheckEligibility checks that a ballot is eligible in the layer that it specifies.

type VrfMessage

type VrfMessage struct {
	Beacon  types.Beacon
	Epoch   types.EpochID
	Counter uint32
}

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)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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