Documentation ¶
Index ¶
- Constants
- Variables
- func AddTestAddrs(myApp *app.App, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
- func AddTestAddrsFromPubKeys(myApp *app.App, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int)
- func AddTestAddrsIncremental(myApp *app.App, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
- func CheckBalance(t *testing.T, myApp *app.App, addr sdk.AccAddress, balances sdk.Coins)
- func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
- func CreateMultiEthKey(count int) []*ecdsa.PrivateKey
- func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
- func DefGenesisState(cdc codec.Codec) app.GenesisState
- func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, ...) ([]sdk.Tx, error)
- func GenTx(r *rand.Rand, gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, ...) (sdk.Tx, error)
- func GenerateAddress() common.Address
- func GenerateEthAddress() common.Address
- func GenerateEthKey() *ecdsa.PrivateKey
- func GenerateGenesisValidator(validatorNum int, initCoins sdk.Coins) (valSet *tmtypes.ValidatorSet, genAccs authtypes.GenesisAccounts, ...)
- func NewEthPrivKey() cryptotypes.PrivKey
- func NewMnemonic() string
- func NewPriKey() cryptotypes.PrivKey
- func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
- func NewSigner(sk cryptotypes.PrivKey) keyring.Signer
- func PrivKeyFromMnemonic(mnemonic string, algo hd.PubKeyType, account, index uint32) (cryptotypes.PrivKey, error)
- func Setup(isCheckTx bool, isShowLog bool) *app.App
- func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.App
- func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, ...) *app.App
- func SignCheckDeliver(t *testing.T, txCfg client.TxConfig, app *baseapp.BaseApp, ...) (sdk.GasInfo, *sdk.Result, error)
- func TestAddr(addr string, bech string) (sdk.AccAddress, error)
- type EmptyAppOptions
- type GenerateAccountStrategy
- type Signer
Constants ¶
const (
SimAppChainID = "sim-app"
)
SimAppChainID hardcoded chainID for simulation
Variables ¶
var DefaultConsensusParams = &abci.ConsensusParams{ Block: &abci.BlockParams{ MaxBytes: 1048576, MaxGas: -1, }, Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: 1000000, MaxAgeDuration: 504 * time.Hour, MaxBytes: 100000, }, Validator: &tmproto.ValidatorParams{ PubKeyTypes: []string{ tmtypes.ABCIPubKeyTypeEd25519, }, }, }
DefaultConsensusParams defines the default Tendermint consensus params used in GaiaApp testing.
Functions ¶
func AddTestAddrs ¶
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func AddTestAddrsFromPubKeys ¶
func AddTestAddrsFromPubKeys(myApp *app.App, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int)
AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys.
func AddTestAddrsIncremental ¶
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 CreateMultiEthKey ¶
func CreateMultiEthKey(count int) []*ecdsa.PrivateKey
func CreateTestPubKeys ¶
func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.
func DefGenesisState ¶
func DefGenesisState(cdc codec.Codec) app.GenesisState
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 GenTx ¶ added in v2.3.0
func GenTx(r *rand.Rand, gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error)
GenTx generates a signed mock transaction.
func GenerateAddress ¶
GenerateAddress generates an Ethereum address.
func GenerateEthAddress ¶
func GenerateEthKey ¶
func GenerateEthKey() *ecdsa.PrivateKey
func GenerateGenesisValidator ¶
func GenerateGenesisValidator(validatorNum int, initCoins sdk.Coins) (valSet *tmtypes.ValidatorSet, genAccs authtypes.GenesisAccounts, balances []banktypes.Balance)
func NewEthPrivKey ¶
func NewEthPrivKey() cryptotypes.PrivKey
NewEthPrivKey generates an Ethereum address and its corresponding private key.
func NewMnemonic ¶
func NewMnemonic() string
func NewPriKey ¶
func NewPriKey() cryptotypes.PrivKey
NewPriKey generates cosmos-sdk accAddress private key.
func NewPubKeyFromHex ¶
func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
NewPubKeyFromHex returns a PubKey from a hex string.
func PrivKeyFromMnemonic ¶
func PrivKeyFromMnemonic(mnemonic string, algo hd.PubKeyType, account, index uint32) (cryptotypes.PrivKey, error)
func SetupWithGenesisAccounts ¶
func SetupWithGenesisAccounts(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 (10^6) 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 *baseapp.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{}
func (EmptyAppOptions) Get ¶
func (EmptyAppOptions) Get(string) interface{}
type GenerateAccountStrategy ¶
type GenerateAccountStrategy func(int) []sdk.AccAddress
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer defines a type that is used on testing for signing MsgEthereumTx
func (Signer) SignByAddress ¶
SignByAddress sign byte messages with a user key providing the address.