testseed

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: GPL-3.0 Imports: 19 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 Client added in v1.2.0

type Client struct {
	SeedGen *SeedGenerator
}

func (*Client) AccountsSnapshot added in v1.2.0

func (c *Client) AccountsSnapshot(db *sql.Database, lid types.LayerID) (rst []*types.Account, err error)

func (*Client) CountAtxsByEpoch added in v1.6.1

func (c *Client) CountAtxsByEpoch(db *sql.Database, epoch int64) (int, error)

func (*Client) GetAllRewards added in v1.4.0

func (c *Client) GetAllRewards(db *sql.Database) (rst []*types.Reward, err error)

func (*Client) GetAtxById added in v1.6.1

func (c *Client) GetAtxById(db *sql.Database, id string) (*types.ActivationTx, error)

func (*Client) GetAtxsByEpoch added in v1.5.7

func (c *Client) GetAtxsByEpoch(db *sql.Database, epoch int64, fn func(tx *types.ActivationTx) bool) error

func (*Client) GetAtxsByEpochPaginated added in v1.6.1

func (c *Client) GetAtxsByEpochPaginated(db *sql.Database, epoch, limit, offset int64, fn func(tx *types.ActivationTx) bool) error

func (*Client) GetAtxsReceivedAfter added in v1.5.0

func (c *Client) GetAtxsReceivedAfter(db *sql.Database, ts int64, fn func(tx *types.ActivationTx) bool) error

func (*Client) GetLayer added in v1.2.0

func (c *Client) GetLayer(db *sql.Database, lid types.LayerID, numLayers uint32) (*pb.Layer, error)

func (*Client) GetLayerRewards added in v1.2.0

func (c *Client) GetLayerRewards(db *sql.Database, lid types.LayerID) (rst []*types.Reward, err error)

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