heavycheck

package
v0.0.0-...-985cc99 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxBlocksPerEpoch is chosen so that even if validator chooses the latest non-liable epoch for BVs,
	// he still cannot vote for latest blocks (latest = from last 128 epochs), as an epoch has at least one block
	// The value is larger than a maximum possible number of blocks
	// in an epoch where a single validator doesn't have 2/3W+1 weight
	MaxBlocksPerEpoch = idx.Block(basiccheck.MaxLiableEpochs - 128)
)

Variables

View Source
var (
	ErrWrongEventSig            = errors.New("event has wrong signature")
	ErrMalformedTxSig           = errors.New("tx has wrong signature")
	ErrWrongPayloadHash         = errors.New("event has wrong payload hash")
	ErrPubkeyChanged            = errors.New("validator pubkey has changed, cannot create BVs/EV for older epochs")
	ErrUnknownEpochEventLocator = errors.New("event locator has unknown epoch")
	ErrImpossibleBVsEpoch       = errors.New("BVs have an impossible epoch")
	ErrUnknownEpochBVs          = errors.New("BVs are unprocessable yet")
	ErrUnknownEpochEV           = errors.New("EV is unprocessable yet")
)

Functions

This section is empty.

Types

type BVsOnly

type BVsOnly struct {
	*Checker
}

func (*BVsOnly) Enqueue

func (c *BVsOnly) Enqueue(bvs inter.LlrSignedBlockVotes, onValidated func(error)) error

type Checker

type Checker struct {
	// contains filtered or unexported fields
}

Checker which requires only parents list + current epoch info

func New

func New(config Config, reader Reader, txSigner types.Signer) *Checker

New validator which performs heavy checks, related to signatures validation and Merkle tree validation

func (*Checker) EnqueueBVs

func (v *Checker) EnqueueBVs(bvs inter.LlrSignedBlockVotes, onValidated func(error)) error

func (*Checker) EnqueueEV

func (v *Checker) EnqueueEV(ev inter.LlrSignedEpochVote, onValidated func(error)) error

func (*Checker) EnqueueEvent

func (v *Checker) EnqueueEvent(e inter.EventPayloadI, onValidated func(error)) error

func (*Checker) Overloaded

func (v *Checker) Overloaded() bool

func (*Checker) Start

func (v *Checker) Start()

func (*Checker) Stop

func (v *Checker) Stop()

func (*Checker) ValidateBVs

func (v *Checker) ValidateBVs(bvs inter.LlrSignedBlockVotes) error

func (*Checker) ValidateEV

func (v *Checker) ValidateEV(ev inter.LlrSignedEpochVote) error

func (*Checker) ValidateEvent

func (v *Checker) ValidateEvent(e inter.EventPayloadI) error

ValidateEvent runs heavy checks for event

func (*Checker) ValidateEventLocator

func (v *Checker) ValidateEventLocator(e inter.SignedEventLocator, authEpoch idx.Epoch, authErr error, checkPayload func() bool) error

type Config

type Config struct {
	MaxQueuedTasks int // the maximum number of tasks to queue up
	Threads        int
}

func DefaultConfig

func DefaultConfig() Config

type EVOnly

type EVOnly struct {
	*Checker
}

func (*EVOnly) Enqueue

func (c *EVOnly) Enqueue(ers inter.LlrSignedEpochVote, onValidated func(error)) error

type EventsOnly

type EventsOnly struct {
	*Checker
}

func (*EventsOnly) Enqueue

func (c *EventsOnly) Enqueue(e dag.Event, onValidated func(error)) error

type Reader

type Reader interface {
	GetEpochPubKeys() (map[idx.ValidatorID]validatorpk.PubKey, idx.Epoch)
	GetEpochPubKeysOf(idx.Epoch) map[idx.ValidatorID]validatorpk.PubKey
	GetEpochBlockStart(idx.Epoch) idx.Block
}

Reader is accessed by the validator to get the current state.

Jump to

Keyboard shortcuts

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