Documentation ¶
Index ¶
- func CheckBalance(t *testing.T, app *App, addr sdk.AccAddress, exp sdk.Coins)
- func CheckGenTx(t *testing.T, app *baseapp.BaseApp, msgs []sdk.Msg, accNums []uint64, ...) sdk.Result
- func CreateGenAccounts(numAccs int, genCoins sdk.Coins) (genAccs []auth.Account, addrs []sdk.AccAddress, pubKeys []crypto.PubKey, ...)
- func GenSequenceOfTxs(msgs []sdk.Msg, accnums []uint64, initSeqNums []uint64, numToGenerate int, ...) []auth.StdTx
- func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) auth.StdTx
- func GeneratePrivKeyAddressPairs(n int) (keys []crypto.PrivKey, addrs []sdk.AccAddress)
- func GeneratePrivKeyAddressPairsFromRand(rand *rand.Rand, n int) (keys []crypto.PrivKey, addrs []sdk.AccAddress)
- func GeneratePrivKeys(n int) (keys []crypto.PrivKey)
- func GetAllAccounts(mapper auth.AccountKeeper, ctx sdk.Context) []auth.Account
- func RandFromBigInterval(r *rand.Rand, intervals []BigInterval) sdk.Int
- func RandomSetGenesis(r *rand.Rand, app *App, addrs []sdk.AccAddress, denoms []string)
- func SetGenesis(app *App, accs []auth.Account)
- func SignCheckDeliver(t *testing.T, app *baseapp.BaseApp, msgs []sdk.Msg, accNums []uint64, ...) sdk.Result
- type App
- type BigInterval
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckBalance ¶
CheckBalance checks the balance of an account.
func CheckGenTx ¶
func CheckGenTx( t *testing.T, app *baseapp.BaseApp, msgs []sdk.Msg, accNums []uint64, seq []uint64, expPass bool, priv ...crypto.PrivKey, ) sdk.Result
CheckGenTx checks a generated signed transaction. The result of the check is compared against the parameter 'expPass'. A test assertion is made using the parameter 'expPass' against the result. A corresponding result is returned.
func CreateGenAccounts ¶
func CreateGenAccounts(numAccs int, genCoins sdk.Coins) (genAccs []auth.Account, addrs []sdk.AccAddress, pubKeys []crypto.PubKey, privKeys []crypto.PrivKey)
CreateGenAccounts generates genesis accounts loaded with coins, and returns their addresses, pubkeys, and privkeys.
func GenSequenceOfTxs ¶
func GenSequenceOfTxs(msgs []sdk.Msg, accnums []uint64, initSeqNums []uint64, numToGenerate int, priv ...crypto.PrivKey) []auth.StdTx
GenSequenceOfTxs generates a set of signed transactions of messages, such that they differ only by having the sequence numbers incremented between every transaction.
func GeneratePrivKeyAddressPairs ¶
func GeneratePrivKeyAddressPairs(n int) (keys []crypto.PrivKey, addrs []sdk.AccAddress)
GeneratePrivKeyAddressPairs generates a total of n private key, address pairs.
func GeneratePrivKeyAddressPairsFromRand ¶
func GeneratePrivKeyAddressPairsFromRand(rand *rand.Rand, n int) (keys []crypto.PrivKey, addrs []sdk.AccAddress)
GeneratePrivKeyAddressPairsFromRand generates a total of n private key, address pairs using the provided randomness source.
func GeneratePrivKeys ¶
GeneratePrivKeys generates a total n Ed25519 private keys.
func GetAllAccounts ¶
GetAllAccounts returns all accounts in the AccountKeeper.
func RandFromBigInterval ¶
func RandFromBigInterval(r *rand.Rand, intervals []BigInterval) sdk.Int
RandFromBigInterval chooses an interval uniformly from the provided list of BigIntervals, and then chooses an element from an interval uniformly at random.
func RandomSetGenesis ¶
RandomSetGenesis set genesis accounts with random coin values using the provided addresses and coin denominations.
func SetGenesis ¶
SetGenesis sets the mock app genesis accounts.
func SignCheckDeliver ¶
func SignCheckDeliver( t *testing.T, app *baseapp.BaseApp, msgs []sdk.Msg, accNums []uint64, seq []uint64, expSimPass, expPass bool, priv ...crypto.PrivKey, ) sdk.Result
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 App ¶
type App struct { *bam.BaseApp Cdc *codec.Codec // Cdc is public since the codec is passed into the module anyways KeyMain *sdk.KVStoreKey KeyAccount *sdk.KVStoreKey KeyFee *sdk.KVStoreKey KeyStake *sdk.KVStoreKey TkeyStake *sdk.TransientStoreKey KeyParams *sdk.KVStoreKey TkeyParams *sdk.TransientStoreKey KeyUpgrade *sdk.KVStoreKey KeyGuardian *sdk.KVStoreKey KeyStorage *sdk.KVStoreKey KeyCode *sdk.KVStoreKey // TODO: Abstract this out from not needing to be auth specifically AccountKeeper auth.AccountKeeper BankKeeper bank.Keeper FeeKeeper auth.FeeCollectionKeeper ParamsKeeper params.Keeper GenesisAccounts []auth.Account TotalCoinsSupply sdk.Coins }
const (
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address bech32PrefixAccAddr = "faa" // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key bech32PrefixAccPub = "fap" // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address bech32PrefixValAddr = "fva" // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key bech32PrefixValPub = "fvp" // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address bech32PrefixConsAddr = "fca" // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key bech32PrefixConsPub = "fcp"
)
var (
HtdfCt = types.NewDefaultCoinType(stakeTypes.StakeTokenName)
)
App extends an ABCI application, but with most of its parameters exported. They are exported for convenience in creating helper functions, as object capabilities aren't needed for testing.
func NewApp ¶
func NewApp() *App
NewApp partially constructs a new app on the memstore for module and genesis testing.
func (*App) CompleteSetup ¶
CompleteSetup completes the application setup after the routes have been registered.
func (*App) InitChainer ¶
func (app *App) InitChainer(ctx sdk.Context, _ abci.RequestInitChain) abci.ResponseInitChain
InitChainer performs custom logic for initialization.
type BigInterval ¶
type BigInterval struct {
// contains filtered or unexported fields
}
BigInterval is a representation of the interval [lo, hi), where lo and hi are both of type sdk.Int