metachain

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllNodeKeys added in v1.7.0

func GetAllNodeKeys(validatorsInfo state.ShardValidatorsInfoMapHandler) map[uint32][][]byte

GetAllNodeKeys returns all <shard,pubKeys> from the provided map

func NewAuctionListDisplayer added in v1.7.1

func NewAuctionListDisplayer(args ArgsAuctionListDisplayer) (*auctionListDisplayer, error)

NewAuctionListDisplayer creates an auction list data displayer, useful for debugging purposes during selection process

func NewAuctionListSelector added in v1.7.0

func NewAuctionListSelector(args AuctionListSelectorArgs) (*auctionListSelector, error)

NewAuctionListSelector will create a new auctionListSelector, which handles selection of nodes from auction list based on their top up

func NewBaseRewardsCreator

func NewBaseRewardsCreator(args BaseRewardsCreatorArgs) (*baseRewardsCreator, error)

NewBaseRewardsCreator will create a new base rewards creator instance

func NewEndOfEpochEconomicsDataCreator

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

NewEndOfEpochEconomicsDataCreator creates a new end of epoch economics data creator object

func NewEpochEconomicsStatistics

func NewEpochEconomicsStatistics() *epochEconomicsStatistics

NewEpochEconomicsStatistics creates the end of epoch economics statistics

func NewEpochStartData

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

NewEpochStartData creates a new epoch start creator

func NewEpochStartTrigger

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

NewEpochStartTrigger creates a trigger for start of epoch

func NewRewardsCreator

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

NewRewardsCreator creates a new rewards creator object

func NewRewardsCreatorProxy

func NewRewardsCreatorProxy(args RewardsCreatorProxyArgs) (*rewardsCreatorProxy, error)

NewRewardsCreatorProxy creates a rewards creator proxy instance

func NewRewardsCreatorV2

func NewRewardsCreatorV2(args RewardsCreatorArgsV2) (*rewardsCreatorV2, error)

NewRewardsCreatorV2 creates a new rewards creator object

func NewStakingDataProvider

func NewStakingDataProvider(args StakingDataProviderArgs) (*stakingDataProvider, error)

NewStakingDataProvider will create a new instance of a staking data provider able to aid in the final rewards computation as this will retrieve the staking data from the system VM

func NewSystemSCProcessor

func NewSystemSCProcessor(args ArgsNewEpochStartSystemSCProcessing) (*systemSCProcessor, error)

NewSystemSCProcessor creates the end of epoch system smart contract processor

func NewTableDisplayer added in v1.7.1

func NewTableDisplayer() *tableDisplayer

NewTableDisplayer will create a component able to display tables in logger

func NewValidatorInfoCreator

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

NewValidatorInfoCreator creates a new validatorInfo creator object

func UnmarshalTrigger

func UnmarshalTrigger(marshaller marshal.Marshalizer, data []byte) (*block.MetaTriggerRegistry, error)

UnmarshalTrigger unmarshalls the trigger with json, for backwards compatibility

Types

type ArgsAuctionListDisplayer added in v1.7.1

type ArgsAuctionListDisplayer struct {
	TableDisplayHandler      TableDisplayHandler
	ValidatorPubKeyConverter core.PubkeyConverter
	AddressPubKeyConverter   core.PubkeyConverter
	AuctionConfig            config.SoftAuctionConfig
	Denomination             int
}

ArgsAuctionListDisplayer is a struct placeholder for arguments needed to create an auction list displayer

type ArgsNewEpochEconomics

type ArgsNewEpochEconomics struct {
	Marshalizer           marshal.Marshalizer
	Hasher                hashing.Hasher
	Store                 dataRetriever.StorageService
	ShardCoordinator      sharding.Coordinator
	RewardsHandler        process.RewardsHandler
	RoundTime             process.RoundTimeDurationHandler
	GenesisEpoch          uint32
	GenesisNonce          uint64
	GenesisTotalSupply    *big.Int
	EconomicsDataNotified epochStart.EpochEconomicsDataProvider
	StakingV2EnableEpoch  uint32
}

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
	GenesisEpoch        uint32
	EnableEpochsHandler common.EnableEpochsHandler
}

ArgsNewEpochStartData defines the input parameters for epoch start data creator

type ArgsNewEpochStartSystemSCProcessing

type ArgsNewEpochStartSystemSCProcessing struct {
	SystemVM             vmcommon.VMExecutionHandler
	UserAccountsDB       state.AccountsAdapter
	PeerAccountsDB       state.AccountsAdapter
	Marshalizer          marshal.Marshalizer
	StartRating          uint32
	ValidatorInfoCreator epochStart.ValidatorInfoCreator
	ChanceComputer       nodesCoordinator.ChanceComputer
	ShardCoordinator     sharding.Coordinator

	EndOfEpochCallerAddress []byte
	StakingSCAddress        []byte
	ESDTOwnerAddressBytes   []byte

	GenesisNodesConfig           sharding.GenesisNodesSetupHandler
	EpochNotifier                process.EpochNotifier
	NodesConfigProvider          epochStart.NodesConfigProvider
	StakingDataProvider          epochStart.StakingDataProvider
	AuctionListSelector          epochStart.AuctionListSelector
	MaxNodesChangeConfigProvider epochStart.MaxNodesChangeConfigProvider
	EnableEpochsHandler          common.EnableEpochsHandler
}

ArgsNewEpochStartSystemSCProcessing defines the arguments structure for the end of epoch system sc processor

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
	AppStatusHandler   core.AppStatusHandler
	DataPool           dataRetriever.PoolsHolder
}

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

type ArgsNewRewardsCreator

type ArgsNewRewardsCreator struct {
	BaseRewardsCreatorArgs
}

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

type ArgsNewValidatorInfoCreator

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

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

type AuctionListDisplayHandler added in v1.7.1

type AuctionListDisplayHandler interface {
	DisplayOwnersData(ownersData map[string]*OwnerAuctionData)
	DisplayOwnersSelectedNodes(ownersData map[string]*OwnerAuctionData)
	DisplayAuctionList(
		auctionList []state.ValidatorInfoHandler,
		ownersData map[string]*OwnerAuctionData,
		numOfSelectedNodes uint32,
	)
	IsInterfaceNil() bool
}

AuctionListDisplayHandler should be able to display auction list data during selection process

type AuctionListSelectorArgs added in v1.7.0

type AuctionListSelectorArgs struct {
	ShardCoordinator             sharding.Coordinator
	StakingDataProvider          epochStart.StakingDataProvider
	MaxNodesChangeConfigProvider epochStart.MaxNodesChangeConfigProvider
	AuctionListDisplayHandler    AuctionListDisplayHandler
	SoftAuctionConfig            config.SoftAuctionConfig
	Denomination                 int
}

AuctionListSelectorArgs is a struct placeholder for all arguments required to create an auctionListSelector

type BaseRewardsCreatorArgs

type BaseRewardsCreatorArgs struct {
	ShardCoordinator              sharding.Coordinator
	PubkeyConverter               core.PubkeyConverter
	RewardsStorage                storage.Storer
	MiniBlockStorage              storage.Storer
	Hasher                        hashing.Hasher
	Marshalizer                   marshal.Marshalizer
	DataPool                      dataRetriever.PoolsHolder
	ProtocolSustainabilityAddress string
	NodesConfigProvider           epochStart.NodesConfigProvider
	UserAccountsDB                state.AccountsAdapter
	EnableEpochsHandler           common.EnableEpochsHandler
	ExecutionOrderHandler         common.TxExecutionOrderHandler
}

BaseRewardsCreatorArgs defines the arguments structure needed to create a base rewards creator

type OwnerAuctionData added in v1.7.1

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

OwnerAuctionData holds necessary auction data for an owner

type RewardsCreatorArgsV2

type RewardsCreatorArgsV2 struct {
	BaseRewardsCreatorArgs
	StakingDataProvider   epochStart.StakingDataProvider
	EconomicsDataProvider epochStart.EpochEconomicsDataProvider
	RewardsHandler        process.RewardsHandler
}

RewardsCreatorArgsV2 holds the data required to create end of epoch rewards

type RewardsCreatorProxyArgs

type RewardsCreatorProxyArgs struct {
	BaseRewardsCreatorArgs
	StakingDataProvider   epochStart.StakingDataProvider
	EconomicsDataProvider epochStart.EpochEconomicsDataProvider
	RewardsHandler        process.RewardsHandler
}

RewardsCreatorProxyArgs holds the proxy arguments

type StakingDataProviderArgs added in v1.7.0

type StakingDataProviderArgs struct {
	EnableEpochsHandler common.EnableEpochsHandler
	SystemVM            vmcommon.VMExecutionHandler
	MinNodePrice        string
}

StakingDataProviderArgs is a struct placeholder for all arguments required to create a NewStakingDataProvider

type TableDisplayHandler added in v1.7.1

type TableDisplayHandler interface {
	DisplayTable(tableHeader []string, lines []*display.LineData, message string)
	IsInterfaceNil() bool
}

TableDisplayHandler should be able to display tables in log

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

func (t TestTrigger) Close() error

Close will close the endless running go routine

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)

ForceEpochStart sets the round at which the new epoch will start

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 returns true if there is no value under the interface

func (TestTrigger) LoadState

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

LoadState loads into trigger the saved state

func (TestTrigger) MetaEpoch

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

func (t TestTrigger) SetCurrentEpochStartRound(round uint64)

SetCurrentEpochStartRound sets the round when the current epoch started

func (*TestTrigger) SetEpoch

func (t *TestTrigger) SetEpoch(epoch uint32)

SetEpoch sets the current epoch for the testTrigger

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

func (t *TestTrigger) SetMinRoundsBetweenEpochs(minRoundsPerEpoch uint64)

SetMinRoundsBetweenEpochs sets the minimum number of round between epochs

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

Jump to

Keyboard shortcuts

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