Documentation ¶
Index ¶
- Constants
- Variables
- func CreateRandomValidatorSet() (*cmttypes.ValidatorSet, error)
- func EventsFromContext(ctx context.Context) []event.Event
- func GasMeterFactory(ctx context.Context) func() gas.Meter
- func GasMeterFromContext(ctx context.Context) gas.Meter
- func GetAttribute(e event.Event, key string) (event.Attribute, bool)
- func GetAttributes(e []event.Event, key string) ([]event.Attribute, bool)
- func HeaderInfoFromContext(ctx context.Context) header.Info
- func NewGenesisTxCodec(txConfigOptions tx.ConfigOptions) *genesisTxCodec
- func SetCometInfo(ctx context.Context, c comet.Info) context.Context
- func SetGasMeter(ctx context.Context, meter gas.Meter) context.Context
- func SetHeaderInfo(ctx context.Context, h header.Info) context.Context
- type App
- func (a *App) CheckBalance(t *testing.T, ctx context.Context, addr sdk.AccAddress, expected sdk.Coins, ...)
- func (a *App) Close() error
- func (a *App) Commit(state corestore.WriterMap) ([]byte, error)
- func (a *App) Deliver(t *testing.T, ctx context.Context, txs []stateMachineTx) (*server.BlockResponse, corestore.WriterMap)
- func (a App) LastBlockHeight() uint64
- func (app *App) RunMsg(t *testing.T, ctx context.Context, handler handler, option ...Option) (resp transaction.Msg, err error)
- func (a *App) SignCheckDeliver(t *testing.T, ctx context.Context, msgs []sdk.Msg, chainID string, ...) server.TxResult
- func (a *App) StateLatestContext(tb testing.TB) context.Context
- type BranchService
- type GasService
- type GenesisAccount
- type HeaderService
- type Option
- type RouterService
- type RunMsgConfig
- type StartupConfig
Constants ¶
const ( Genesis_COMMIT = iota Genesis_NOCOMMIT Genesis_SKIP )
const DefaultGenTxGas = 10000000
Variables ¶
var DefaultConsensusParams = &cmtproto.ConsensusParams{ Version: &cmtproto.VersionParams{ App: 1, }, Block: &cmtproto.BlockParams{ MaxBytes: 200000, MaxGas: 100_000_000, }, Evidence: &cmtproto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, MaxBytes: 10000, }, Validator: &cmtproto.ValidatorParams{ PubKeyTypes: []string{ cmttypes.ABCIPubKeyTypeEd25519, cmttypes.ABCIPubKeyTypeSecp256k1, }, }, }
DefaultConsensusParams defines the default CometBFT consensus params used in SimApp testing.
var ErrInvalidMsgType = fmt.Errorf("invalid message type")
Functions ¶
func CreateRandomValidatorSet ¶
func CreateRandomValidatorSet() (*cmttypes.ValidatorSet, error)
CreateRandomValidatorSet creates a validator set with one random validator
func NewGenesisTxCodec ¶
func NewGenesisTxCodec(txConfigOptions tx.ConfigOptions) *genesisTxCodec
Types ¶
type App ¶
type App struct { *runtime.App[stateMachineTx] Store store.RootStore // contains filtered or unexported fields }
App is a wrapper around runtime.App that provides additional testing utilities.
func NewApp ¶
func NewApp( appConfig depinject.Config, startupConfig StartupConfig, extraOutputs ...interface{}, ) (*App, error)
NewApp initializes a new runtime.App. A Nop logger is set in runtime.App. appConfig defines the application configuration (f.e. app_config.go). extraOutputs defines the extra outputs to be assigned by the dependency injector (depinject).
func (*App) CheckBalance ¶
func (a *App) CheckBalance( t *testing.T, ctx context.Context, addr sdk.AccAddress, expected sdk.Coins, keeper bankkeeper.Keeper, )
CheckBalance checks the balance of the given address.
func (*App) Deliver ¶
func (a *App) Deliver( t *testing.T, ctx context.Context, txs []stateMachineTx, ) (*server.BlockResponse, corestore.WriterMap)
Deliver delivers a block with the given transactions and returns the resulting state.
func (App) LastBlockHeight ¶
func (*App) RunMsg ¶
func (app *App) RunMsg(t *testing.T, ctx context.Context, handler handler, option ...Option) (resp transaction.Msg, err error)
RunMsg runs the handler for a transaction message. It required the context to have the integration context. a new state is committed if the option WithAutomaticCommit is set in options.
func (*App) SignCheckDeliver ¶
func (a *App) SignCheckDeliver( t *testing.T, ctx context.Context, msgs []sdk.Msg, chainID string, accNums, accSeqs []uint64, privateKeys []cryptotypes.PrivKey, txErrString string, ) server.TxResult
SignCheckDeliver signs and checks the given messages and delivers them.
type BranchService ¶
type BranchService struct{}
custom branch service for integration tests
type GasService ¶
type GasService struct{}
type GenesisAccount ¶
type GenesisAccount struct { authtypes.GenesisAccount Coins sdk.Coins }
type HeaderService ¶
type HeaderService struct{}
func (*HeaderService) HeaderInfo ¶
func (h *HeaderService) HeaderInfo(ctx context.Context) header.Info
type Option ¶
type Option func(*RunMsgConfig)
Option is a function that can be used to configure the integration app.
func WithAutomaticCommit ¶
func WithAutomaticCommit() Option
WithAutomaticCommit enables automatic commit. This means that the integration app will automatically commit the state after each msg.
type RouterService ¶
type RouterService struct {
// contains filtered or unexported fields
}
custom router service for integration tests
func NewRouterService ¶
func NewRouterService() *RouterService
func (RouterService) CanInvoke ¶
func (rs RouterService) CanInvoke(ctx context.Context, typeUrl string) error
func (RouterService) Invoke ¶
func (rs RouterService) Invoke(ctx context.Context, req transaction.Msg) (transaction.Msg, error)
func (*RouterService) RegisterHandler ¶
func (rs *RouterService) RegisterHandler(handler routerHandler, typeUrl string)
type RunMsgConfig ¶
type RunMsgConfig struct {
Commit bool
}
RunMsgConfig defines the run message configuration.
type StartupConfig ¶
type StartupConfig struct { // ValidatorSet defines a custom validator set to be validating the app. ValidatorSet func() (*cmttypes.ValidatorSet, error) // AppOption defines the additional operations that will be run in the app builder phase. AppOption runtime.AppBuilderOption[stateMachineTx] // GenesisBehavior defines the behavior of the app at genesis. GenesisBehavior int // GenesisAccounts defines the genesis accounts to be used in the app. GenesisAccounts []GenesisAccount // HomeDir defines the home directory of the app where config and data will be stored. HomeDir string // BranchService defines the custom branch service to be used in the app. BranchService corebranch.Service // RouterServiceBuilder defines the custom builder // for msg router and query router service to be used in the app. RouterServiceBuilder runtime.RouterServiceBuilder // HeaderService defines the custom header service to be used in the app. HeaderService header.Service GasService gas.Service }
StartupConfig defines the startup configuration of a new test app.
func DefaultStartUpConfig ¶
func DefaultStartUpConfig(tb testing.TB) StartupConfig