Documentation ¶
Index ¶
- Variables
- func AddTestAddrs(app *app.App, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress
- func AddTestAddrsFromPubKeys(app *app.App, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt math.Int)
- func AddTestAddrsIncremental(app *app.App, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress
- func CheckBalance(t *testing.T, app *app.App, addr sdk.AccAddress, balances sdk.Coins)
- func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
- func CreateRandomAccounts(accNum int) []sdk.AccAddress
- func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
- func FundAccount(app *app.App, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins)
- func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, ...) ([]sdk.Tx, error)
- func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
- func Setup(t *testing.T, isCheckTx bool) *app.App
- func SetupTestingApp() (*app.App, app.GenesisState)
- func SetupWithGenesisAccounts(t *testing.T, genAccs []authtypes.GenesisAccount, ...) *app.App
- func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, ...) *app.App
- func SignCheckDeliver(t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, ...) (sdk.GasInfo, *sdk.Result, error)
- func TestAddr(addr string, bech string) (sdk.AccAddress, error)
- type EmptyAppOptions
- type GenerateAccountStrategy
- type KeeperTestHelper
- func (s *KeeperTestHelper) AssertAttributes(event sdk.Event, eventAttributes []sdk.Attribute)
- func (s *KeeperTestHelper) AssertEventEmitted(ctx sdk.Context, eventTypeExpected string, numEventsExpected int)
- func (suite *KeeperTestHelper) CreateDefaultRollapp() string
- func (suite *KeeperTestHelper) CreateDefaultSequencer(ctx sdk.Context, rollappId string) string
- func (suite *KeeperTestHelper) CreateRollappWithName(name string) string
- func (s *KeeperTestHelper) ExtractAttributes(event sdk.Event) map[string]string
- func (s *KeeperTestHelper) FindEvent(events []sdk.Event, name string) sdk.Event
- func (s *KeeperTestHelper) FindLastEventOfType(events []sdk.Event, eventType string) (sdk.Event, bool)
- func (suite *KeeperTestHelper) PostStateUpdate(ctx sdk.Context, rollappId, seqAddr string, startHeight, numOfBlocks uint64) (lastHeight uint64, err error)
- type SetupOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultConsensusParams = &abci.ConsensusParams{ Block: &abci.BlockParams{ MaxBytes: 200000, MaxGas: -1, }, Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, MaxBytes: 10000, }, Validator: &tmproto.ValidatorParams{ PubKeyTypes: []string{ tmtypes.ABCIPubKeyTypeEd25519, }, }, }
DefaultConsensusParams defines the default Tendermint consensus params used in SimApp testing.
var TestChainID = "dymension_100-1"
Functions ¶
func AddTestAddrs ¶
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func AddTestAddrsFromPubKeys ¶
func AddTestAddrsFromPubKeys(app *app.App, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt math.Int)
AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys.
func AddTestAddrsIncremental ¶
func AddTestAddrsIncremental(app *app.App, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress
AddTestAddrsIncremental constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func CheckBalance ¶
CheckBalance checks the balance of an account.
func ConvertAddrsToValAddrs ¶
func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
ConvertAddrsToValAddrs converts the provided addresses to ValAddress.
func CreateRandomAccounts ¶
func CreateRandomAccounts(accNum int) []sdk.AccAddress
CreateRandomAccounts is a strategy used by addTestAddrs() in order to generated addresses in random order.
func CreateTestPubKeys ¶
func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.
func FundAccount ¶
func GenSequenceOfTxs ¶
func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, numToGenerate int, priv ...cryptotypes.PrivKey) ([]sdk.Tx, error)
GenSequenceOfTxs generates a set of signed transactions of messages, such that they differ only by having the sequence numbers incremented between every transaction.
func NewPubKeyFromHex ¶
func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
NewPubKeyFromHex returns a PubKey from a hex string.
func SetupTestingApp ¶
func SetupTestingApp() (*app.App, app.GenesisState)
func SetupWithGenesisAccounts ¶
func SetupWithGenesisAccounts(t *testing.T, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.App
SetupWithGenesisAccounts initializes a new SimApp with the provided genesis accounts and possible balances.
func SetupWithGenesisValSet ¶
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 SignCheckDeliver ¶
func SignCheckDeliver( t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg, chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error)
SignCheckDeliver checks a generated signed transaction and simulates a block commitment with the given transaction. A test assertion is made using the parameter 'expPass' against the result. A corresponding result is returned.
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
type KeeperTestHelper ¶
func (*KeeperTestHelper) AssertAttributes ¶
func (s *KeeperTestHelper) AssertAttributes(event sdk.Event, eventAttributes []sdk.Attribute)
func (*KeeperTestHelper) AssertEventEmitted ¶
func (s *KeeperTestHelper) AssertEventEmitted(ctx sdk.Context, eventTypeExpected string, numEventsExpected int)
AssertEventEmitted asserts that ctx's event manager has emitted the given number of events of the given type.
func (*KeeperTestHelper) CreateDefaultRollapp ¶
func (suite *KeeperTestHelper) CreateDefaultRollapp() string
func (*KeeperTestHelper) CreateDefaultSequencer ¶
func (suite *KeeperTestHelper) CreateDefaultSequencer(ctx sdk.Context, rollappId string) string
func (*KeeperTestHelper) CreateRollappWithName ¶
func (suite *KeeperTestHelper) CreateRollappWithName(name string) string
func (*KeeperTestHelper) ExtractAttributes ¶
func (s *KeeperTestHelper) ExtractAttributes(event sdk.Event) map[string]string
func (*KeeperTestHelper) FindLastEventOfType ¶
func (s *KeeperTestHelper) FindLastEventOfType(events []sdk.Event, eventType string) (sdk.Event, bool)
FindLastEventOfType returns the last event of the given type.
func (*KeeperTestHelper) PostStateUpdate ¶
type SetupOptions ¶
type SetupOptions struct { Logger log.Logger DB *dbm.MemDB InvCheckPeriod uint HomePath string SkipUpgradeHeights map[int64]bool EncConfig params.EncodingConfig AppOpts types.AppOptions }
SetupOptions defines arguments that are passed into `Simapp` constructor.