Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBalances(t *testing.T, ctx sdk.Context, bankKeeper bankkeeper.WrappedBankKeeper, ...)
- func CheckErrorf(t *testing.T, err error, errType error, msg string, a ...interface{})
- func CreateTestingAppFn(t testing.TB) func() (ibctesting.TestingApp, map[string]json.RawMessage)
- func GenSignedMockTx(r *rand.Rand, txConfig client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, ...) (sdk.Tx, error)
- func GenerateDataSources(homePath string) []oracletypes.DataSource
- func GenerateOracleScripts(homePath string) []oracletypes.OracleScript
- func GenesisStateWithValSet(app *band.BandApp, dir string) band.GenesisState
- func MustGetBalances(ctx sdk.Context, bankKeeper bankkeeper.WrappedBankKeeper, ...) sdk.Coins
- func ParseTime(t int64) time.Time
- func SetupWithCustomHome(isCheckTx bool, dir string) *band.BandApp
- func SetupWithCustomHomeAndChainId(isCheckTx bool, dir, chainID string) *band.BandApp
- func SignCheckDeliver(t *testing.T, txCfg client.TxConfig, app *baseapp.BaseApp, header types.Header, ...) (sdk.GasInfo, *sdk.Result, []types2.Event, error)
- type Account
- type GasMeterWrapper
- type GasRecord
Constants ¶
const ( ChainID string = "BANDCHAIN" Port1 = "port-1" Port2 = "port-2" Channel1 = "channel-1" Channel2 = "channel-2" TestDefaultPrepareGas uint64 = 40000 TestDefaultExecuteGas uint64 = 300000 DefaultGenTxGas = 1000000 )
Variables ¶
var ( Owner Account Treasury Account FeePayer Account Alice Account Bob Account Carol Account MissedValidator Account Validators []Account DataSources []oracletypes.DataSource OracleScripts []oracletypes.OracleScript OwasmVM *owasm.Vm )
var ( EmptyCoins = sdk.Coins(nil) Coins1uband = sdk.NewCoins(sdk.NewInt64Coin("uband", 1)) Coins10uband = sdk.NewCoins(sdk.NewInt64Coin("uband", 10)) Coins11uband = sdk.NewCoins(sdk.NewInt64Coin("uband", 11)) Coins1000000uband = sdk.NewCoins(sdk.NewInt64Coin("uband", 1000000)) Coins99999999uband = sdk.NewCoins(sdk.NewInt64Coin("uband", 99999999)) Coins100000000uband = sdk.NewCoins(sdk.NewInt64Coin("uband", 100000000)) BadCoins = []sdk.Coin{{Denom: "uband", Amount: math.NewInt(-1)}} )
var DefaultConsensusParams = &cmtproto.ConsensusParams{ Block: &cmtproto.BlockParams{ MaxBytes: 3000000, MaxGas: -1, }, Evidence: &cmtproto.EvidenceParams{ MaxAgeNumBlocks: 100000, MaxAgeDuration: 48 * time.Hour, MaxBytes: 1048576, }, Validator: &cmtproto.ValidatorParams{ PubKeyTypes: []string{ cmttypes.ABCIPubKeyTypeSecp256k1, }, }, }
DefaultConsensusParams defines the default Tendermint consensus params used in TestingApp.
Functions ¶
func CheckBalances ¶
func CheckBalances( t *testing.T, ctx sdk.Context, bankKeeper bankkeeper.WrappedBankKeeper, address sdk.AccAddress, expected sdk.Coins, )
func CheckErrorf ¶
CheckErrorf checks whether - error type is wrapped inside the given error - error match given message string combined with error type
func CreateTestingAppFn ¶
func CreateTestingAppFn(t testing.TB) func() (ibctesting.TestingApp, map[string]json.RawMessage)
func GenSignedMockTx ¶
func GenSignedMockTx( r *rand.Rand, txConfig client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey, ) (sdk.Tx, error)
GenSignedMockTx generates a signed mock transaction.
func GenerateDataSources ¶
func GenerateDataSources(homePath string) []oracletypes.DataSource
GenerateDataSources generates a set of data sources for the BandApp.
func GenerateOracleScripts ¶
func GenerateOracleScripts(homePath string) []oracletypes.OracleScript
GenerateOracleScripts generates a set of oracle scripts for the BandApp.
func GenesisStateWithValSet ¶
func GenesisStateWithValSet(app *band.BandApp, dir string) band.GenesisState
func MustGetBalances ¶
func MustGetBalances(ctx sdk.Context, bankKeeper bankkeeper.WrappedBankKeeper, address sdk.AccAddress) sdk.Coins
func SetupWithCustomHome ¶
SetupWithCustomHome initializes a new BandApp with a custom home directory
func SignCheckDeliver ¶
func SignCheckDeliver( t *testing.T, txCfg client.TxConfig, app *baseapp.BaseApp, header types.Header, msgs []sdk.Msg, chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, []types2.Event, 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 Account ¶
type Account struct { PrivKey cryptotypes.PrivKey PubKey cryptotypes.PubKey Address sdk.AccAddress ValAddress sdk.ValAddress }
Account is a data structure to store key of test account.
func CreateArbitraryAccount ¶
CreateArbitraryAccount generates a random Account using a provided random number generator.
type GasMeterWrapper ¶
type GasMeterWrapper struct { storetypes.GasMeter GasRecords []GasRecord }
GasMeterWrapper wrap gas meter for testing purpose
func NewGasMeterWrapper ¶
func NewGasMeterWrapper(meter storetypes.GasMeter) *GasMeterWrapper
NewGasMeterWrapper to wrap gas meters for testing purposes
func (*GasMeterWrapper) ConsumeGas ¶
func (m *GasMeterWrapper) ConsumeGas(amount storetypes.Gas, descriptor string)
func (*GasMeterWrapper) CountDescriptor ¶
func (m *GasMeterWrapper) CountDescriptor(descriptor string) int
func (*GasMeterWrapper) CountRecord ¶
func (m *GasMeterWrapper) CountRecord(amount storetypes.Gas, descriptor string) int
type GasRecord ¶
type GasRecord struct { Gas storetypes.Gas Descriptor string }