metachain

package
v1.0.114 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEndOfEpochEconomicsDataCreator

func NewEndOfEpochEconomicsDataCreator(args ArgsNewEpochEconomics) (*economics, error)

NewEndOfEpochEconomicsDataCreator creates a new end of epoch economics data creator object

func NewEpochStartData

func NewEpochStartData(args ArgsNewEpochStartData) (*epochStartData, error)

NewEpochStartData creates a new epoch start creator

func NewEpochStartRewardsCreator

func NewEpochStartRewardsCreator(args ArgsNewRewardsCreator) (*rewardsCreator, error)

NewEpochStartRewardsCreator creates a new rewards creator object

func NewEpochStartTrigger

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

NewEpochStartTrigger creates a trigger for start of epoch

func NewValidatorInfoCreator

func NewValidatorInfoCreator(args ArgsNewValidatorInfoCreator) (*validatorInfoCreator, error)

NewValidatorInfoCreator creates a new validatorInfo creator object

Types

type ArgsNewEpochEconomics

type ArgsNewEpochEconomics struct {
	Marshalizer         marshal.Marshalizer
	Hasher              hashing.Hasher
	Store               dataRetriever.StorageService
	ShardCoordinator    sharding.Coordinator
	NodesConfigProvider epochStart.NodesConfigProvider
	RewardsHandler      process.RewardsHandler
	RoundTime           process.RoundTimeDurationHandler
}

ArgsNewEpochEconomics is the argument for the economics constructor

type ArgsNewEpochStartData

type ArgsNewEpochStartData struct {
	Marshalizer       marshal.Marshalizer
	Hasher            hashing.Hasher
	Store             dataRetriever.StorageService
	DataPool          dataRetriever.PoolsHolder
	BlockTracker      process.BlockTracker
	ShardCoordinator  sharding.Coordinator
	EpochStartTrigger process.EpochStartTriggerHandler
	RequestHandler    epochStart.RequestHandler
}

ArgsNewEpochStartData defines the input parameters for epoch start data creator

type ArgsNewMetaEpochStartTrigger

type ArgsNewMetaEpochStartTrigger struct {
	GenesisTime        time.Time
	Settings           *config.EpochStartConfig
	Epoch              uint32
	EpochStartRound    uint64
	EpochStartNotifier epochStart.Notifier
	Marshalizer        marshal.Marshalizer
	Hasher             hashing.Hasher
	Storage            dataRetriever.StorageService
}

ArgsNewMetaEpochStartTrigger defines struct needed to create a new start of epoch trigger

type ArgsNewRewardsCreator

type ArgsNewRewardsCreator struct {
	ShardCoordinator sharding.Coordinator
	PubkeyConverter  state.PubkeyConverter
	RewardsStorage   storage.Storer
	MiniBlockStorage storage.Storer
	Hasher           hashing.Hasher
	Marshalizer      marshal.Marshalizer
	DataPool         dataRetriever.PoolsHolder
	CommunityAddress string
}

ArgsNewRewardsCreator defines the arguments structure needed to create a new rewards creator

type ArgsNewValidatorInfoCreator

type ArgsNewValidatorInfoCreator struct {
	ShardCoordinator sharding.Coordinator
	MiniBlockStorage storage.Storer
	Hasher           hashing.Hasher
	Marshalizer      marshal.Marshalizer
	DataPool         dataRetriever.PoolsHolder
}

ArgsNewValidatorInfoCreator defines the arguments structure needed to create a new validatorInfo creator

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) Epoch

func (t TestTrigger) Epoch() uint32

Epoch return the current epoch

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(round uint64) error

ForceEpochStart sets the conditions for start of epoch to true in case of edge cases

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 return true if conditions are fulfilled for start of epoch

func (TestTrigger) IsInterfaceNil

func (t TestTrigger) IsInterfaceNil() bool

IsInterfaceNil return 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 return the current epoch

func (TestTrigger) RequestEpochStartIfNeeded

func (t TestTrigger) RequestEpochStartIfNeeded(_ 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(round uint64)

SetCurrentEpochStartRound sets the round when the current epoch started

func (TestTrigger) SetEpochStartMetaHdrHash

func (t TestTrigger) SetEpochStartMetaHdrHash(metaHdrHash []byte)

SetEpochStartMetaHdrHash sets the epoch start meta header has

func (TestTrigger) SetFinalityAttestingRound

func (t TestTrigger) SetFinalityAttestingRound(round uint64)

SetFinalityAttestingRound sets the round which finalized the start of epoch block

func (TestTrigger) SetProcessed

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

SetProcessed sets start of epoch to false and cleans underlying structure

func (*TestTrigger) SetRoundsPerEpoch

func (t *TestTrigger) SetRoundsPerEpoch(roundsPerEpoch uint64)

SetRoundsPerEpoch sets the number of round between epochs

func (*TestTrigger) SetTrigger

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

SetTrigger sets the start of epoch trigger

func (TestTrigger) Update

func (t TestTrigger) Update(round uint64, nonce uint64)

Update processes changes in the trigger

type TriggerRegistry

type TriggerRegistry struct {
	Epoch                       uint32
	CurrentRound                uint64
	EpochFinalityAttestingRound uint64
	CurrEpochStartRound         uint64
	PrevEpochStartRound         uint64
	EpochStartMetaHash          []byte
	EpochStartMeta              *block.MetaBlock
}

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