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(opts ...func(*types.ConsensusParams)) *types.ConsensusParams
- func ExecTxResults(txs types.Txs) []*abci.ExecTxResult
- func MakeBlockID() types.BlockID
- func MakeBlockIDWithHash(hash []byte) types.BlockID
- func MakeCommit(ctx context.Context, blockID types.BlockID, height int64, round int32, ...) (*types.Commit, error)
- func MakeHeader(t *testing.T, h *types.Header) *types.Header
- func MakeNTxs(height, n int64) types.Txs
- func MakeVote(ctx context.Context, val types.PrivValidator, valSet *types.ValidatorSet, ...) (*types.Vote, error)
- func MinimalGenesisDoc() types.GenesisDoc
- func MockValidatorSet() (*types.ValidatorSet, []types.PrivValidator)
- func NodeID(t *testing.T, str string) types.NodeID
- func RandGenesisDoc(numValidators int, consensusParams *types.ConsensusParams) (*types.GenesisDoc, []types.PrivValidator)
- func RandomAddress() []byte
- func RandomHash() []byte
- func RandomNodeID(t *testing.T) types.NodeID
Constants ¶
const (
DefaultTestChainID = "test-chain"
)
Variables ¶
var (
DefaultTestTime = time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)
)
Functions ¶
func ConsensusParams ¶
func ConsensusParams(opts ...func(*types.ConsensusParams)) *types.ConsensusParams
ConsensusParams returns a default set of ConsensusParams that are suitable for use in testing
func ExecTxResults ¶
func ExecTxResults(txs types.Txs) []*abci.ExecTxResult
func MakeBlockID ¶
func MakeBlockIDWithHash ¶
func MakeCommit ¶
func MakeHeader ¶
MakeHeader fills the rest of the contents of the header such that it passes validate basic
func MinimalGenesisDoc ¶
func MinimalGenesisDoc() types.GenesisDoc
MinimalGenesisDoc generates a minimal working genesis doc. It is very similar to Hellar Platform's production environment genesis doc, which assumes that all other settings (like validator set) will be provided by ABCI during initial handshake.
func MockValidatorSet ¶
func MockValidatorSet() (*types.ValidatorSet, []types.PrivValidator)
MockValidatorSet returns static validator set with 2 validators and 2 private keys
func RandGenesisDoc ¶
func RandGenesisDoc(numValidators int, consensusParams *types.ConsensusParams) (*types.GenesisDoc, []types.PrivValidator)
RandGenesisDoc generates a genesis doc with random validator set. NOTE: It's better to use MinimalGensisDoc() which generates genesis doc similar to Hellar Platform production environment.
func RandomAddress ¶
func RandomAddress() []byte
func RandomHash ¶
func RandomHash() []byte
Types ¶
This section is empty.