tortoise

package
v0.2.8-beta.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.0.0

type Config struct {
	Hdist           uint32        `mapstructure:"tortoise-hdist"`            // hare/input vector lookback distance
	Zdist           uint32        `mapstructure:"tortoise-zdist"`            // hare result wait distance
	ConfidenceParam uint32        `mapstructure:"tortoise-confidence-param"` // layers to wait for global consensus
	WindowSize      uint32        `mapstructure:"tortoise-window-size"`      // size of the tortoise sliding window (in layers)
	GlobalThreshold *big.Rat      `mapstructure:"tortoise-global-threshold"` // threshold for finalizing blocks and layers
	LocalThreshold  *big.Rat      `mapstructure:"tortoise-local-threshold"`  // threshold for choosing when to use weak coin
	RerunInterval   time.Duration `mapstructure:"tortoise-rerun-interval"`
	MaxExceptions   int           `mapstructure:"tortoise-max-exceptions"` // if candidate for base block has more than max exceptions it will be ignored

	LayerSize                uint32
	BadBeaconVoteDelayLayers uint32 // number of layers to delay votes for blocks with bad beacon values during self-healing
	MeshProcessed            types.LayerID
}

Config for protocol parameters.

func DefaultConfig added in v1.0.0

func DefaultConfig() Config

DefaultConfig for Tortoise.

type Opinion

type Opinion map[types.BlockID]sign

Opinion is opinions on other blocks.

type Opt added in v1.0.0

type Opt func(t *Tortoise)

Opt for configuring tortoise.

func WithConfig added in v1.0.0

func WithConfig(cfg Config) Opt

WithConfig defines protocol parameters.

func WithContext

func WithContext(ctx context.Context) Opt

WithContext defines context for tortoise.

func WithLogger added in v1.0.0

func WithLogger(logger log.Log) Opt

WithLogger defines logger for tortoise.

type Tortoise

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

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

func New added in v1.0.0

func New(mdb blockDataProvider, atxdb atxDataProvider, beacons system.BeaconGetter, opts ...Opt) *Tortoise

New creates Tortoise instance.

func (*Tortoise) BaseBallot

func (trtl *Tortoise) BaseBallot(ctx context.Context) (types.BallotID, [][]types.BlockID, error)

BaseBallot chooses a base ballot and creates a differences list. needs the hare results for latest layers.

func (*Tortoise) HandleIncomingLayer added in v0.1.11

func (trtl *Tortoise) HandleIncomingLayer(ctx context.Context, layerID types.LayerID) (types.LayerID, types.LayerID, bool)

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

func (*Tortoise) LatestComplete

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

LatestComplete returns the latest verified layer.

func (*Tortoise) Stop

func (trtl *Tortoise) Stop()

Stop background workers.

func (*Tortoise) WaitReady

func (trtl *Tortoise) WaitReady(ctx context.Context) error

WaitReady waits until state will be reloaded from disk.

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