simapp

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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)

	// TestOVMPublicKeys represents test public keys needed for ovm
	TestOVMPublicKeys []ed25519.PublicKey

	// TestOVMPrivateKeys represents test private keys needed for ovm
	TestOVMPrivateKeys []ed25519.PrivateKey
)
View Source
var DefaultConsensusParams = &tmproto.ConsensusParams{
	Block: &tmproto.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

View Source
var GenesisModuleAccountsBalances = map[string]int64{}

GenesisModuleAccountsBalances holds the test genesis module accounts balance map.

View Source
var PKs = createTestPubKeys(500)

PKs is a slice of public keys for test

Functions

func CreateJwtTicket added in v0.0.8

func CreateJwtTicket(claim jwt.MapClaims) (string, error)

func GenerateOvmPublicKeys added in v0.0.6

func GenerateOvmPublicKeys(n int) (pubKeys []string)

func NewStakingHelper

func NewStakingHelper(t *testing.T, ctx sdk.Context, k stakingKeeper.Keeper) *stakingtestutil.Helper

NewStakingHelper creates staking Handler wrapper for tests

func RandomString added in v0.0.8

func RandomString(length int) string

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

func WriteKeyringFile added in v1.4.5

func WriteKeyringFile(name string, dir string, contents []byte) error

Types

type Options added in v0.0.5

type Options struct {
	CreateGenesisValidators bool
}

Options defines options related to simapp initialization

type TestApp

type TestApp struct {
	app.SgeApp
}

TestApp is used as a container of the sge app

func GetTestObjects

func GetTestObjects() (*TestApp, sdk.Context, error)

GetTestObjects gets the test objects and ingredients for testing phase start with default options

func GetTestObjectsWithOptions

func GetTestObjectsWithOptions(options Options) (*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 Options,
	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       sdkmath.Int
}

TestValidator is simapp validator type for testing

Jump to

Keyboard shortcuts

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