tortoise

package
v0.2.3-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetricsSubsystem is a subsystem shared by all metrics exposed by this
	// package.
	MetricsSubsystem = "consensus"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.0.0

type Config struct {
	LayerSize       uint32
	Database        database.Database
	MeshDatabase    blockDataProvider
	ATXDB           atxDataProvider
	Clock           layerClock
	Hdist           uint32   // hare lookback distance: the distance over which we use the input vector/hare results
	Zdist           uint32   // hare result wait distance: the distance over which we're willing to wait for hare results
	ConfidenceParam uint32   // confidence wait distance: how long we wait for global consensus to be established
	GlobalThreshold *big.Rat // threshold required to finalize blocks and layers
	LocalThreshold  *big.Rat // threshold that determines whether a node votes based on local or global opinion
	WindowSize      uint32   // tortoise sliding window: how many layers we store data for
	Log             log.Log
	RerunInterval   time.Duration // how often to rerun from genesis
}

Config holds the arguments and dependencies to create a verifying tortoise instance.

type Opinion

type Opinion map[types.BlockID]vec

Opinion is opinions on other blocks.

type ThreadSafeVerifyingTortoise

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

ThreadSafeVerifyingTortoise is a thread safe verifying tortoise wrapper, it just locks all actions.

func NewVerifyingTortoise

func NewVerifyingTortoise(ctx context.Context, cfg Config) *ThreadSafeVerifyingTortoise

NewVerifyingTortoise creates ThreadSafeVerifyingTortoise instance.

func (*ThreadSafeVerifyingTortoise) BaseBlock

BaseBlock chooses a base block and creates a differences list. needs the hare results for latest layers.

func (*ThreadSafeVerifyingTortoise) HandleIncomingLayer

func (trtl *ThreadSafeVerifyingTortoise) HandleIncomingLayer(ctx context.Context, layerID types.LayerID) (oldVerified, newVerified types.LayerID, reverted bool)

HandleIncomingLayer processes all layer block votes returns the old verified layer and new verified layer after taking into account the blocks votes

func (*ThreadSafeVerifyingTortoise) HandleLateBlocks

func (trtl *ThreadSafeVerifyingTortoise) HandleLateBlocks(ctx context.Context, blocks []*types.Block) (types.LayerID, types.LayerID)

HandleLateBlocks processes votes and goodness for late blocks (for late block definition see white paper). Returns the old verified layer and new verified layer after taking into account the blocks' votes.

func (*ThreadSafeVerifyingTortoise) LatestComplete

func (trtl *ThreadSafeVerifyingTortoise) LatestComplete() types.LayerID

LatestComplete returns the latest verified layer

func (*ThreadSafeVerifyingTortoise) Persist

func (trtl *ThreadSafeVerifyingTortoise) Persist(ctx context.Context) error

Persist saves a copy of the current tortoise state to the database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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