testutil

package
v0.0.0-...-25a7e6a Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultBatchSize is the default batch size for testing
	DefaultBatchSize = 5
	// BlockVersion is the default block version for testing
	BlockVersion = 1
	// AppVersion is the default app version for testing
	AppVersion = 2
)

Variables

This section is empty.

Functions

func GenerateBatch

func GenerateBatch(startHeight uint64, endHeight uint64, proposerKey crypto.PrivKey) (*types.Batch, error)

GenerateBatch generates a batch out of random blocks

func GenerateBlocks

func GenerateBlocks(startHeight uint64, num uint64, proposerKey crypto.PrivKey) ([]*types.Block, error)

GenerateBlocks generates random blocks.

func GenerateCommits

func GenerateCommits(blocks []*types.Block, proposerKey crypto.PrivKey) ([]*types.Commit, error)

GenerateCommits generates commits based on passed blocks.

func GenerateGenesis

func GenerateGenesis(initialHeight int64) *tmtypes.GenesisDoc

GenerateGenesis generates a genesis for testing.

func GenerateRandomValidatorSet

func GenerateRandomValidatorSet() *tmtypes.ValidatorSet

GenerateRandomValidatorSet generates random validator sets

func GenerateState

func GenerateState(initialHeight int64, lastBlockHeight int64) types.State

GenerateState generates an initial state for testing.

func GetABCIProxyAppMock

func GetABCIProxyAppMock(logger log.Logger) proxy.AppConns

GetABCIProxyAppMock returns a dummy abci proxy app mock for testing

func GetAppMock

func GetAppMock(excludeMethods ...ABCIMethod) *mocks.Application

GetAppMock returns a dummy abci app mock for testing

Types

type ABCIMethod

type ABCIMethod string

ABCIMethod is a string representing an ABCI method

const (
	// InitChain is the string representation of the InitChain ABCI method
	InitChain ABCIMethod = "InitChain"
	// CheckTx is the string representation of the CheckTx ABCI method
	CheckTx ABCIMethod = "CheckTx"
	// BeginBlock is the string representation of the BeginBlockMethod ABCI method
	BeginBlock ABCIMethod = "BeginBlock"
	// DeliverTx is the string representation of the DeliverTx ABCI method
	DeliverTx ABCIMethod = "DeliverTx"
	// EndBlock is the string representation of the EndBlock ABCI method
	EndBlock ABCIMethod = "EndBlock"
	// Commit is the string representation of the Commit ABCI method
	Commit ABCIMethod = "Commit"
	// Info is the string representation of the Info ABCI method
	Info ABCIMethod = "Info"
)

Jump to

Keyboard shortcuts

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