test_helpers

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestDenomination = "nund"
	SimAppChainID    = "simulation-app"

	TestDefaultStorage = 200
	TestMaxStorage     = 300
)

SimAppChainID hardcoded chainID for simulation

Variables

View Source
var (
	DefaultConsensusParams = &abci.ConsensusParams{
		Block: &abci.BlockParams{
			MaxBytes: 200000,
			MaxGas:   2000000,
		},
		Evidence: &tmproto.EvidenceParams{
			MaxAgeNumBlocks: 302400,
			MaxAgeDuration:  504 * time.Hour,
			MaxBytes:        10000,
		},
		Validator: &tmproto.ValidatorParams{
			PubKeyTypes: []string{
				tmtypes.ABCIPubKeyTypeEd25519,
			},
		},
	}
	EncodingConfig = params.EncodingConfig{}
)

DefaultConsensusParams defines the default Tendermint consensus params used in app.App testing.

Functions

func AddTestAddrs

func AddTestAddrs(app *app.App, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func AddTestAddrsIncremental

func AddTestAddrsIncremental(app *app.App, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func GenSignedMockTx added in v1.8.0

func GenSignedMockTx(r *rand.Rand, txConfig client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error)

GenSignedMockTx generates a signed mock transaction.

func GenTx

func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error)

GenTx generates a signed mock transaction.

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString generates a random string given a length, based on a set character set

func GenerateRandomStringWithCharset

func GenerateRandomStringWithCharset(length int, charset string) string

func GenerateRandomTestAccounts

func GenerateRandomTestAccounts(accNum int) []sdk.AccAddress

func GetAppEncodingConfig added in v1.8.0

func GetAppEncodingConfig() params.EncodingConfig

func NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.JSONCodec) app.GenesisState

NewDefaultGenesisState generates the default state for the application.

func RandInBetween

func RandInBetween(min, max int) int

func SetKeeperTestParamsAndDefaultValues

func SetKeeperTestParamsAndDefaultValues(app *app.App, ctx sdk.Context)

func Setup

func Setup(t *testing.T, isCheckTx bool) *app.App

Setup initializes a new app.App. A Nop logger is set in app.App.

func SetupWithGenesisValSet added in v1.8.0

func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.App

SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts that also act as delegators. For simplicity, each validator is bonded with a delegation of one consensus engine unit in the default token of the simapp from first genesis account. A Nop logger is set in SimApp.

func TestAddr

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

Types

type EmptyAppOptions

type EmptyAppOptions struct{}

EmptyAppOptions is a stub implementing AppOptions

func (EmptyAppOptions) Get

func (ao EmptyAppOptions) Get(o string) interface{}

Get implements AppOptions

type GenerateAccountStrategy

type GenerateAccountStrategy func(int) []sdk.AccAddress

Jump to

Keyboard shortcuts

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