heavycheck

package
v0.0.0-...-59e56fa Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongEventSig  = errors.New("event has wrong signature")
	ErrMalformedTxSig = errors.New("tx has wrong signature")
	ErrWrongTxHash    = errors.New("tx has wrong txs Merkle tree root")
)

Functions

This section is empty.

Types

type ArbitraryTaskData

type ArbitraryTaskData interface {
	GetEvents() inter.Events
	GetResult() []error
	GetOnValidatedFn() OnValidatedFn
}

ArbitraryTaskData is an interface that represents task data getters

type Checker

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

Check which require only parents list + current epoch info

func New

func New(config *lachesis.DagConfig, reader DagReader, txSigner types.Signer, numOfThreads int) *Checker

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

func NewDefault

func NewDefault(config *lachesis.DagConfig, reader DagReader, txSigner types.Signer) *Checker

NewDefault uses N-1 threads

func (*Checker) Enqueue

func (v *Checker) Enqueue(events inter.Events, onValidated OnValidatedFn) 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) Validate

func (v *Checker) Validate(e *inter.Event) error

Validate event

type DagReader

type DagReader interface {
	GetEpochPubKeys() (map[idx.StakerID]common.Address, idx.Epoch)
}

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

type OnValidatedFn

type OnValidatedFn func(ArbitraryTaskData)

OnValidatedFn is a callback type for notifying about validation result.

type TaskData

type TaskData struct {
	Events inter.Events // events to validate
	Result []error      // resulting errors of events, nil if ok
	// contains filtered or unexported fields
}

TaskData is a struct that represents an input data for a check. Used also to validate events

func (*TaskData) GetEvents

func (t *TaskData) GetEvents() inter.Events

GetEvents is a getter function for events

func (*TaskData) GetOnValidatedFn

func (t *TaskData) GetOnValidatedFn() OnValidatedFn

GetOnValidatedFn is a getter function for onValidated callback

func (*TaskData) GetResult

func (t *TaskData) GetResult() []error

GetResult is a getter function for result

Jump to

Keyboard shortcuts

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