helpers

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SimAppChainID = "gstake-app"
)

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,
		},
	},
}

Functions

func AddTestAddrs

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

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

func AddTestAddrsFromPubKeys

func AddTestAddrsFromPubKeys(app *app.PstakeApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt math.Int)

AddTestAddrsFromPubKeys adds the addresses into the App providing only the public keys.

func AddTestAddrsIncremental

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

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

func CheckBalance

func CheckBalance(t *testing.T, app *app.PstakeApp, addr sdk.AccAddress, balances sdk.Coins)

CheckBalance checks the balance of an account.

func ConvertAddrsToValAddrs

func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress

ConvertAddrsToValAddrs converts the provided addresses to ValAddress.

func CreateTestApp

func CreateTestApp(t *testing.T) (*codec.LegacyAmino, app.PstakeApp, sdk.Context)

func CreateTestPubKeys

func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey

CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.

func InitAccountWithCoins

func InitAccountWithCoins(app *app.PstakeApp, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins)

func NewAppConstructor

func NewAppConstructor(encodingCfg appparams.EncodingConfig, db *dbm.MemDB) network.AppConstructor

NewAppConstructor returns a new network AppConstructor.

func NewConfig

func NewConfig(dbm *dbm.MemDB) network.Config

NewConfig returns config that defines the necessary testing requirements used to bootstrap and start an in-process local testing network.

func NewPubKeyFromHex

func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)

NewPubKeyFromHex returns a PubKey from a hex string.

func PP

func PP(data interface{})

func ParseTime

func ParseTime(s string) time.Time

ParseTime parses and returns time.Time in time.RFC3339 format.

func Setup

func Setup(t *testing.T, isCheckTx bool, invCheckPeriod uint) *app.PstakeApp

Setup initializes a new SimApp. A Nop logger is set in SimApp.

func SetupTestingApp

func SetupTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage)

SetupTestingApp initializes the IBC-go testing application

func SetupWithGenesisValSet

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

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{}

func (EmptyAppOptions) Get

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

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