shardchain

package
v1.1.56 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEpochStartTrigger

func NewEpochStartTrigger(args *ArgsShardEpochStartTrigger) (*trigger, error)

NewEpochStartTrigger creates a trigger to signal start of epoch

func NewPeerMiniBlockSyncer added in v1.0.102

func NewPeerMiniBlockSyncer(arguments ArgPeerMiniBlockSyncer) (*peerMiniBlockSyncer, error)

NewPeerMiniBlockSyncer creates a new peerMiniBlockSyncer object

Types

type ArgPeerMiniBlockSyncer added in v1.0.102

type ArgPeerMiniBlockSyncer struct {
	MiniBlocksPool storage.Cacher
	Requesthandler epochStart.RequestHandler
}

ArgPeerMiniBlockSyncer holds all dependencies required to create a peerMiniBlockSyncer

type ArgsShardEpochStartTrigger

type ArgsShardEpochStartTrigger struct {
	Marshalizer marshal.Marshalizer
	Hasher      hashing.Hasher

	HeaderValidator epochStart.HeaderValidator
	Uint64Converter typeConverters.Uint64ByteSliceConverter

	DataPool             dataRetriever.PoolsHolder
	Storage              dataRetriever.StorageService
	RequestHandler       epochStart.RequestHandler
	EpochStartNotifier   epochStart.Notifier
	PeerMiniBlocksSyncer process.ValidatorInfoSyncer
	Rounder              process.Rounder

	Epoch    uint32
	Validity uint64
	Finality uint64
}

ArgsShardEpochStartTrigger struct { defines the arguments needed for new start of epoch trigger

type TestTrigger

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

TestTrigger extends start of epoch trigger and is used in integration tests as it exposes some functions that are not supposed to be used in production code Exported functions simplify the reproduction of edge cases

func (TestTrigger) Close added in v1.0.116

func (t TestTrigger) Close() error

Close will close the endless running go routine

func (TestTrigger) Epoch

func (t TestTrigger) Epoch() uint32

Epoch returns the current epoch number

func (TestTrigger) EpochFinalityAttestingRound

func (t TestTrigger) EpochFinalityAttestingRound() uint64

EpochFinalityAttestingRound returns the round when epoch start block was finalized

func (TestTrigger) EpochStartMetaHdrHash

func (t TestTrigger) EpochStartMetaHdrHash() []byte

EpochStartMetaHdrHash returns the announcing meta header hash which created the new epoch

func (TestTrigger) EpochStartRound

func (t TestTrigger) EpochStartRound() uint64

EpochStartRound returns the start round of the current epoch

func (TestTrigger) ForceEpochStart

func (t TestTrigger) ForceEpochStart(_ uint64)

ForceEpochStart does nothing in this implementation

func (*TestTrigger) GetRoundsPerEpoch

func (t *TestTrigger) GetRoundsPerEpoch() uint64

GetRoundsPerEpoch gets the number of rounds per epoch

func (TestTrigger) GetSavedStateKey

func (t TestTrigger) GetSavedStateKey() []byte

GetSavedStateKey returns the last saved trigger state key

func (TestTrigger) IsEpochStart

func (t TestTrigger) IsEpochStart() bool

IsEpochStart returns true if conditions are fulfilled for start of epoch

func (TestTrigger) IsInterfaceNil

func (t TestTrigger) IsInterfaceNil() bool

IsInterfaceNil returns true if underlying object is nil

func (TestTrigger) LoadState

func (t TestTrigger) LoadState(key []byte) error

LoadState loads into trigger the saved state

func (TestTrigger) MetaEpoch added in v1.0.104

func (t TestTrigger) MetaEpoch() uint32

MetaEpoch returns the highest finalized meta epoch number

func (TestTrigger) RequestEpochStartIfNeeded

func (t TestTrigger) RequestEpochStartIfNeeded(interceptedHeader data.HeaderHandler)

RequestEpochStartIfNeeded request the needed epoch start block if metablock with new epoch was received

func (TestTrigger) RevertStateToBlock

func (t TestTrigger) RevertStateToBlock(header data.HeaderHandler) error

RevertStateToBlock will revert the state of the trigger to the current block

func (TestTrigger) SetAppStatusHandler added in v0.0.5

func (t TestTrigger) SetAppStatusHandler(handler core.AppStatusHandler) error

SetAppStatusHandler will set the satus handler for the trigger

func (TestTrigger) SetCurrentEpochStartRound

func (t TestTrigger) SetCurrentEpochStartRound(_ uint64)

SetCurrentEpochStartRound sets the round when the current epoch started

func (*TestTrigger) SetEpoch added in v1.0.138

func (t *TestTrigger) SetEpoch(epoch uint32)

SetEpoch sets the current epoch for the testTrigger

func (TestTrigger) SetFinalityAttestingRound

func (t TestTrigger) SetFinalityAttestingRound(_ uint64)

SetFinalityAttestingRound sets the round which finalized the start of epoch block

func (*TestTrigger) SetMinRoundsBetweenEpochs added in v1.1.3

func (t *TestTrigger) SetMinRoundsBetweenEpochs(_ uint64)

SetMinRoundsBetweenEpochs does nothing as trigger in shards is not done by chronology

func (TestTrigger) SetProcessed

func (t TestTrigger) SetProcessed(header data.HeaderHandler, _ data.BodyHandler)

SetProcessed sets start of epoch to false and cleans underlying structure

func (*TestTrigger) SetRoundsPerEpoch

func (t *TestTrigger) SetRoundsPerEpoch(_ uint64)

SetRoundsPerEpoch does nothing as trigger in shards is not done by chronology

func (*TestTrigger) SetTrigger

func (t *TestTrigger) SetTrigger(triggerHandler epochStart.TriggerHandler)

SetTrigger sets the start of epoch trigger

func (TestTrigger) Update

func (t TestTrigger) Update(_ uint64, _ uint64)

Update updates the end-of-epoch trigger

type TriggerRegistry

type TriggerRegistry struct {
	IsEpochStart                bool
	NewEpochHeaderReceived      bool
	Epoch                       uint32
	MetaEpoch                   uint32
	CurrentRoundIndex           int64
	EpochStartRound             uint64
	EpochFinalityAttestingRound uint64
	EpochMetaBlockHash          []byte
	EpochStartShardHeader       *block.Header
}

TriggerRegistry holds the data required to correctly initialize the trigger when booting from saved state

Jump to

Keyboard shortcuts

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