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
- Variables
- func ConsensusParams() *types.ConsensusParams
- func GenesisDoc(config *cfg.Config, time time.Time, validators []*types.Validator, ...) *types.GenesisDoc
- func MakeBlockID() types.BlockID
- func MakeBlockIDWithHash(hash []byte) types.BlockID
- func MakeExtendedCommit(ctx context.Context, blockID types.BlockID, height int64, round int32, ...) (*types.ExtendedCommit, error)
- func MakeHeader(t *testing.T, h *types.Header) *types.Header
- func MakeNTxs(height, n int64) []types.Tx
- func MakeVote(ctx context.Context, val types.PrivValidator, chainID string, valIndex int32, ...) (*types.Vote, error)
- func NodeID(t *testing.T, str string) types.NodeID
- func RandomAddress() []byte
- func RandomHash() []byte
- func RandomNodeID(t *testing.T) types.NodeID
- func Validator(ctx context.Context, votingPower int64) (*types.Validator, types.PrivValidator, error)
- func ValidatorSet(ctx context.Context, t *testing.T, numValidators int, votingPower int64) (*types.ValidatorSet, []types.PrivValidator)
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 ConsensusParams ¶
func ConsensusParams() *types.ConsensusParams
ConsensusParams returns a default set of ConsensusParams that are suitable for use in testing
func GenesisDoc ¶
func GenesisDoc( config *cfg.Config, time time.Time, validators []*types.Validator, consensusParams *types.ConsensusParams, ) *types.GenesisDoc
func MakeBlockID ¶
func MakeBlockIDWithHash ¶
func MakeExtendedCommit ¶
func MakeHeader ¶
MakeHeader fills the rest of the contents of the header such that it passes validate basic
func RandomAddress ¶
func RandomAddress() []byte
func RandomHash ¶
func RandomHash() []byte
func RandomNodeID ¶
RandomNodeID returns a randomly generated valid NodeID
func ValidatorSet ¶
func ValidatorSet(ctx context.Context, t *testing.T, numValidators int, votingPower int64) (*types.ValidatorSet, []types.PrivValidator)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.