test

package
v0.34.22 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package factory provides generation code for common structs in Tendermint. It is used primarily for the testing of internal components such as statesync, consensus, blocksync etc..

Index

Constants

View Source
const (
	DefaultTestChainID = "test-chain"
)

Variables

View Source
var (
	DefaultTestTime = time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)
)

Functions

func GenesisDoc

func GenesisDoc(
	time time.Time,
	validators []*types.Validator,
	consensusParams *types.ConsensusParams,
	chainID string,
) *types.GenesisDoc

func MakeBlock

func MakeBlock(state sm.State) *types.Block

func MakeBlockID

func MakeBlockID() types.BlockID

func MakeBlockIDWithHash

func MakeBlockIDWithHash(hash []byte) types.BlockID

func MakeBlocks

func MakeBlocks(n int, state sm.State, privVals []types.PrivValidator) ([]*types.Block, error)

func MakeCommit

func MakeCommit(blockID types.BlockID, height int64, round int32, valSet *types.ValidatorSet, privVals []types.PrivValidator, chainID string, now time.Time) (*types.Commit, error)

func MakeCommitFromVoteSet

func MakeCommitFromVoteSet(blockID types.BlockID, voteSet *types.VoteSet, validators []types.PrivValidator, now time.Time) (*types.Commit, error)

func MakeHeader

func MakeHeader(t *testing.T, h *types.Header) *types.Header

MakeHeader fills the rest of the contents of the header such that it passes validate basic

func MakeNTxs

func MakeNTxs(height, n int64) []types.Tx

func MakeVote

func MakeVote(
	val types.PrivValidator,
	chainID string,
	valIndex int32,
	height int64,
	round int32,
	step int,
	blockID types.BlockID,
	time time.Time,
) (*types.Vote, error)

func MakeVoteSet

func MakeVoteSet(lastState sm.State, round int32) *types.VoteSet

func RandomAddress

func RandomAddress() []byte

func RandomHash

func RandomHash() []byte

func ResetTestRoot

func ResetTestRoot(testName string) *config.Config

func ResetTestRootWithChainID

func ResetTestRootWithChainID(testName string, chainID string) *config.Config

func Validator

func Validator(ctx context.Context, votingPower int64) (*types.Validator, types.PrivValidator, error)

func ValidatorSet

func ValidatorSet(ctx context.Context, t *testing.T, numValidators int, votingPower int64) (*types.ValidatorSet, []types.PrivValidator)

Types

This section is empty.

Jump to

Keyboard shortcuts

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