testseed

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountContainer

type AccountContainer struct {
	Account      model.Account
	Signer       *signing.EdSigner
	Transactions map[string]*model.Transaction
	Rewards      map[string]*model.Reward
	// contains filtered or unexported fields
}

AccountContainer is a container for accounts with transactions and rewards belongs to generated account.

type BlockContainer

type BlockContainer struct {
	Block        *model.Block
	Transactions []*model.Transaction
	SmesherID    string
}

BlockContainer container for block and related transactions.

type LayerContainer

type LayerContainer struct {
	Layer       model.Layer
	Blocks      []*BlockContainer
	Activations map[string]*model.Activation
	Smeshers    map[string]*model.Smesher
}

LayerContainer container for layer and related blocks, activations and smeshers.

type SeedEpoch

type SeedEpoch struct {
	Epoch              model.Epoch
	Layers             []*LayerContainer
	Transactions       map[string]*model.Transaction
	Rewards            map[string]*model.Reward
	Blocks             map[string]*model.Block
	Smeshers           map[string]*model.Smesher
	SmeshersCommitment map[string]int64
	Activations        map[string]*model.Activation
}

SeedEpoch generated epoch for tests.

type SeedEpochs

type SeedEpochs []*SeedEpoch

SeedEpochs wrapper over generated slice of epochs.

func (SeedEpochs) GetActivations

func (s SeedEpochs) GetActivations() map[string]*model.Activation

GetActivations extract all activations from epochs.

func (SeedEpochs) GetLayers

func (s SeedEpochs) GetLayers() []model.Layer

GetLayers extract all layers from epochs.

func (SeedEpochs) GetRewards

func (s SeedEpochs) GetRewards() map[string]*model.Reward

GetRewards extract all rewards from epochs.

func (SeedEpochs) GetTransactions

func (s SeedEpochs) GetTransactions() map[string]*model.Transaction

GetTransactions extract all transactions from epochs.

type SeedGenerator

type SeedGenerator struct {
	Epochs         SeedEpochs
	Accounts       map[string]AccountContainer
	Activations    map[string]*model.Activation
	Blocks         map[string]*model.Block
	Apps           map[string]model.App
	Layers         map[uint32]*model.Layer
	Rewards        map[string]*model.Reward
	Transactions   map[string]*model.Transaction
	Smeshers       map[string]*model.Smesher
	FirstLayerTime time.Time
	// contains filtered or unexported fields
}

SeedGenerator helper for generate epochs.

func NewSeedGenerator

func NewSeedGenerator(seed *TestServerSeed) *SeedGenerator

NewSeedGenerator create object which allow fill database for tests.

func (*SeedGenerator) GenerateEpoches

func (s *SeedGenerator) GenerateEpoches(count int) error

GenerateEpoches generate epochs for test.

func (*SeedGenerator) GetLastLayer

func (s *SeedGenerator) GetLastLayer() (curLayer, latestLayer, verifiedLayer uint32)

GetLastLayer return last generated layer.

func (*SeedGenerator) SaveEpoches

func (s *SeedGenerator) SaveEpoches(ctx context.Context, db *storage.Storage) error

SaveEpoches write generated data directly to db.

type TestServerSeed

type TestServerSeed struct {
	GenesisID               []byte
	EpochNumLayers          uint32
	LayersDuration          uint64
	MaxTransactionPerSecond uint64
	GenesisTime             uint64

	BitsPerLabel  uint32
	LabelsPerUnit uint64
	MinNumUnits   uint32
	MaxNumUnits   uint32
}

TestServerSeed test network config for tests.

func GetServerSeed

func GetServerSeed() *TestServerSeed

GetServerSeed generate test network config.

func (*TestServerSeed) GetPostUnitsSize

func (t *TestServerSeed) GetPostUnitsSize() uint64

GetPostUnitsSize calcluates size of post units.

Jump to

Keyboard shortcuts

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