simapp

package
v8.0.0-...-4827cf2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 144 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AccountAddressPrefix       = "feath"
	AccountPubKeyPrefix        = "feathpub"
	ValidatorAddressPrefix     = "feathvaloper"
	ValidatorPubKeyPrefix      = "feathvaloperpub"
	ConsensusNodeAddressPrefix = "feathvalcons"
	ConsensusNodePubKeyPrefix  = "feathvalconspub"
	BondDenom                  = "featherstake"
	AppName                    = "feather-core"
)

DO NOT change the names of these variables! TODO: to prevent other users from changing these variables, we could probably just publish our own package like https://pkg.go.dev/github.com/cosmos/cosmos-sdk/version

Functions

func AddTestAddrsIncremental

func AddTestAddrsIncremental(app *App, ctx sdk.Context, accNum int, accAmt sdkmath.Int) []sdk.AccAddress

AddTestAddrsIncremental constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func BlockedAddresses

func BlockedAddresses() map[string]bool

BlockedAddresses returns all the app's blocked account addresses.

func GenesisStateWithValSet

func GenesisStateWithValSet(
	codec codec.Codec,
	genesisState map[string]json.RawMessage,
	valSet *cmttypes.ValidatorSet,
	genAccs []authtypes.GenesisAccount,
	balances ...banktypes.Balance,
) (map[string]json.RawMessage, error)

GenesisStateWithValSet returns a new genesis state with the validator set copied from simtestutil with delegation not added to supply

func GetMaccPerms

func GetMaccPerms() map[string][]string

GetMaccPerms returns a copy of the module account permissions

NOTE: This is solely to be used for testing purposes.

func GetWasmOpts

func GetWasmOpts(app *App, appOpts servertypes.AppOptions) []wasm.Option

GetWasmOpts build wasm options

func NewAnteHandler

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)

NewAnteHandler constructor

func NewTestNetworkFixture

func NewTestNetworkFixture() network.TestFixture

NewTestNetworkFixture returns a new App AppConstructor for network simulation tests

func SignAndDeliverWithoutCommit

func SignAndDeliverWithoutCommit(t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, msgs []sdk.Msg, fees sdk.Coins, chainID string, accNums, accSeqs []uint64, blockTime time.Time, priv ...cryptotypes.PrivKey) (*abci.ResponseFinalizeBlock, error)

SignAndDeliverWithoutCommit signs and delivers a transaction. No commit

Types

type App

type App struct {
	*baseapp.BaseApp

	// keepers
	AccountKeeper         authkeeper.AccountKeeper // TODO: Do we even need to store this state?
	AuthzKeeper           authzkeeper.Keeper
	BankKeeper            bankkeeper.Keeper
	CapabilityKeeper      *capabilitykeeper.Keeper
	StakingKeeper         *stakingkeeper.Keeper
	SlashingKeeper        slashingkeeper.Keeper
	MintKeeper            mintkeeper.Keeper
	DistrKeeper           distrkeeper.Keeper
	GovKeeper             govkeeper.Keeper
	CrisisKeeper          *crisiskeeper.Keeper
	UpgradeKeeper         *upgradekeeper.Keeper
	NftKeeper             nftkeeper.Keeper
	ParamsKeeper          paramskeeper.Keeper
	IBCKeeper             *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
	EvidenceKeeper        evidencekeeper.Keeper
	TransferKeeper        ibctransferkeeper.Keeper
	ICAHostKeeper         icahostkeeper.Keeper
	FeeGrantKeeper        feegrantkeeper.Keeper
	GroupKeeper           groupkeeper.Keeper
	WasmKeeper            wasm.Keeper
	ConsensusParamsKeeper consensuskeeper.Keeper
	CircuitKeeper         circuitkeeper.Keeper
	IBCFeeKeeper          ibcfeekeeper.Keeper
	ContractKeeper        wasmtypes.ContractOpsKeeper

	// IBC hooks
	IBCHooksKeeper ibchookskeeper.Keeper

	// ModuleManager is the module manager
	ModuleManager      *module.Manager
	BasicModuleManager module.BasicManager

	ScopedIBCKeeper           capabilitykeeper.ScopedKeeper
	ScopedICAHostKeeper       capabilitykeeper.ScopedKeeper
	ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
	ScopedTransferKeeper      capabilitykeeper.ScopedKeeper
	ScopedIBCFeeKeeper        capabilitykeeper.ScopedKeeper
	ScopedWasmKeeper          capabilitykeeper.ScopedKeeper
	// contains filtered or unexported fields
}

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 NewAppWithCustomOptions

func NewAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *App

NewAppWithCustomOptions initializes a new App with custom options.

func NewSimApp

func NewSimApp(
	logger log.Logger,
	db dbm.DB,
	traceStore io.Writer,
	loadLatest bool,
	appOpts servertypes.AppOptions,
	baseAppOptions ...func(*baseapp.BaseApp),
) *App

NewSimApp returns a reference to an initialized blockchain app

func Setup

func Setup(t *testing.T, opts ...wasmkeeper.Option) (*App, sdk.Context, *authtypes.BaseAccount)

Setup initializes a new App. A Nop logger is set in App.

func SetupWithEmptyStore

func SetupWithEmptyStore(tb testing.TB) *App

SetupWithEmptyStore set up a wasmd app instance with empty DB

func SetupWithGenesisValSet

func SetupWithGenesisValSet(
	t *testing.T,
	valSet *cmttypes.ValidatorSet,
	genAccs []authtypes.GenesisAccount,
	chainID string,
	opts []wasmkeeper.Option,
	balances ...banktypes.Balance,
) *App

SetupWithGenesisValSet initializes a new App 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 App from first genesis account. A Nop logger is set in App.

func (*App) AppCodec

func (app *App) AppCodec() codec.Codec

AppCodec returns an app codec.

NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.

func (*App) AutoCliOpts

func (app *App) AutoCliOpts() autocli.AppOptions

func (*App) BeginBlocker

func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)

BeginBlocker application updates every begin block

func (*App) DefaultGenesis

func (app *App) DefaultGenesis() map[string]json.RawMessage

DefaultGenesis returns a default genesis from the registered AppModuleBasic's.

func (*App) EndBlocker

func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error)

EndBlocker application updates every end block

func (*App) ExportAppStateAndValidators

func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error)

ExportAppStateAndValidators exports the state of the application for a genesis file.

func (*App) GetKey

func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey

GetKey returns the KVStoreKey for the provided store key.

NOTE: This is solely to be used for testing purposes.

func (*App) GetSubspace

func (app *App) GetSubspace(moduleName string) paramstypes.Subspace

func (*App) InitChainer

func (app *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)

InitChainer application update at chain initialization

func (*App) InterfaceRegistry

func (app *App) InterfaceRegistry() types.InterfaceRegistry

InterfaceRegistry returns an InterfaceRegistry

func (*App) LegacyAmino

func (app *App) LegacyAmino() *codec.LegacyAmino

LegacyAmino returns SimApp's amino codec.

NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.

func (*App) LoadHeight

func (app *App) LoadHeight(height int64) error

LoadHeight loads a particular height

func (*App) ModuleAccountAddrs

func (app *App) ModuleAccountAddrs() map[string]bool

func (*App) Name

func (app *App) Name() string

Name returns the name of the App

func (*App) RegisterAPIRoutes

func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)

RegisterAPIRoutes registers all application module routes with the provided API server.

func (*App) RegisterNodeService

func (app *App) RegisterNodeService(clientCtx client.Context, cfg config.Config)

func (*App) RegisterTendermintService

func (app *App) RegisterTendermintService(clientCtx client.Context)

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*App) RegisterTxService

func (app *App) RegisterTxService(clientCtx client.Context)

RegisterTxService implements the Application.RegisterTxService method.

func (*App) SimulationManager

func (app *App) SimulationManager() *module.SimulationManager

SimulationManager implements the SimulationApp interface

func (*App) TxConfig

func (app *App) TxConfig() client.TxConfig

TxConfig returns a TxConfig

type EncodingConfig

type EncodingConfig struct {
	InterfaceRegistry types.InterfaceRegistry
	Marshaler         codec.Codec
	TxConfig          client.TxConfig
	Amino             *codec.LegacyAmino
}

EncodingConfig specifies the concrete encoding types to use for a given app. This is provided for compatibility between protobuf and amino implementations.

func MakeEncodingConfig

func MakeEncodingConfig() EncodingConfig

MakeEncodingConfig creates an EncodingConfig for testing

type GenesisState

type GenesisState map[string]json.RawMessage

The genesis state of the blockchain is represented here as a map of raw json messages key'd by a identifier string. The identifier is used to determine which module genesis information belongs to so it may be appropriately routed during init chain. Within this application default genesis information is retrieved from the ModuleBasicManager which populates json from each BasicModule object provided to it during init.

func GenesisStateWithSingleValidator

func GenesisStateWithSingleValidator(t *testing.T, app *App) GenesisState

GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts that also act as delegators.

func NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState

NewDefaultGenesisState generates the default state for the application.

type HandlerOptions

type HandlerOptions struct {
	ante.HandlerOptions

	IBCKeeper             *keeper.Keeper
	WasmConfig            *wasmTypes.WasmConfig
	WasmKeeper            *wasmkeeper.Keeper
	TXCounterStoreService corestoretypes.KVStoreService
	CircuitKeeper         *circuitkeeper.Keeper
}

HandlerOptions extend the SDK's AnteHandler options by requiring the IBC channel keeper.

type SetupOptions

type SetupOptions struct {
	Logger   log.Logger
	DB       *dbm.MemDB
	AppOpts  servertypes.AppOptions
	WasmOpts []wasmkeeper.Option
}

SetupOptions defines arguments that are passed into `App` constructor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL