Documentation ¶
Index ¶
- Variables
- func AddTestAddrsIncremental(tApp *TestApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
- func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
- func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
- func FundModuleAccount(app *TestApp, ctx sdk.Context, recipientMod string, coins sdk.Coins) error
- func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
- func NewStakingHelper(t *testing.T, ctx sdk.Context, k stakingKeeper.Keeper) *teststaking.Helper
- func SetAccountCoins(ctx *sdk.Context, k bankkeeper.Keeper, addr sdk.AccAddress, amount int64) error
- func SetModuleAccountCoins(ctx *sdk.Context, k bankkeeper.Keeper, moduleName string, amount int64) error
- func TestAddr(addr string, bech string) (sdk.AccAddress, error)
- type SimappOptions
- type TestApp
- type TestUser
- type TestValidator
Constants ¶
This section is empty.
Variables ¶
var ( // TestParamUsers represents the map of simapp users TestParamUsers = make(map[string]TestUser) // TestParamValidatorAddresses represents the map of test validators TestParamValidatorAddresses = make(map[string]TestValidator) )
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, }, }, }
DefaultConsensusParams parameters for tendermint consensus
var ( // PKs is a slice of public keys for test PKs = CreateTestPubKeys(500) )
var (
// TestDVMPublicKey represents test public keys needed for dvm
// TestDVMPrivateKey represents test private keys needed for dvm
TestDVMPublicKey, TestDVMPrivateKey, _ = ed25519.GenerateKey(rand.Reader)
)
nolint
Functions ¶
func AddTestAddrsIncremental ¶
func AddTestAddrsIncremental(tApp *TestApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
AddTestAddrsIncremental constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func ConvertAddrsToValAddrs ¶
func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
ConvertAddrsToValAddrs converts the provided addresses to ValAddress.
func CreateTestPubKeys ¶
func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.
func FundModuleAccount ¶
FundModuleAccount is a utility function that funds a module account by minting and sending the coins to the address. This should be used for testing purposes only!
func NewPubKeyFromHex ¶
func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
NewPubKeyFromHex returns a PubKey from a hex string.
func NewStakingHelper ¶
func NewStakingHelper(t *testing.T, ctx sdk.Context, k stakingKeeper.Keeper) *teststaking.Helper
NewStakingHelper creates staking Handler wrapper for tests
func SetAccountCoins ¶
func SetAccountCoins(ctx *sdk.Context, k bankkeeper.Keeper, addr sdk.AccAddress, amount int64) error
SetAccountCoins sets the balance of accounts for testing
func SetModuleAccountCoins ¶
func SetModuleAccountCoins(ctx *sdk.Context, k bankkeeper.Keeper, moduleName string, amount int64) error
SetModuleAccountCoins sets the balance of accounts for testing
Types ¶
type SimappOptions ¶
type SimappOptions struct {
CreateGenesisValidators bool
}
SimappOptions defines options related to simapp initialization
type TestApp ¶
TestApp is used as a container of the sgex app
func GetTestObjects ¶
GetTestObjects gets the test objects and ingredients for testing phase start with default options
func GetTestObjectsWithOptions ¶
func GetTestObjectsWithOptions(options SimappOptions) (*TestApp, sdk.Context, error)
GetTestObjectsWithOptions gets the test objects and ingredients for testing phase start with custom options
func SetupWithGenesisAccounts ¶
func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, options SimappOptions, balances ...banktypes.Balance) *TestApp
SetupWithGenesisAccounts sets up the genesis accounts for testing
type TestUser ¶
type TestUser struct { PrvKey secp256k1.PrivKey Address sdk.AccAddress Balance int64 }
TestUser is simapp user type for testing
type TestValidator ¶
type TestValidator struct { PubKey types.PubKey Address sdk.ValAddress ConsAddress sdk.ConsAddress Power sdk.Int }
TestValidator is simapp validator type for testing