app

package
v0.0.0-...-5d8d101 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: Apache-2.0 Imports: 138 Imported by: 0

Documentation

Index

Constants

View Source
const Experimental = false

Experimental is a flag which determines expermiental features. It's set via build flag.

Variables

View Source
var (

	// DefaultNodeHome defines the default home directory for the application
	// daemon.
	DefaultNodeHome string

	// ModuleBasics defines the module BasicManager is in charge of setting up basic,
	// non-dependant module elements, such as codec registration
	// and genesis verification.
	ModuleBasics module.BasicManager
)
View Source
var (
	WasmProposalsEnabled        = "false"
	EnableSpecificWasmProposals = ""
	EmptyWasmOpts               []wasm.Option
)
View Source
var DefaultConsensusParams = &abci.ConsensusParams{
	Block: &abci.BlockParams{
		MaxBytes: 200000,
		MaxGas:   2000000,
	},
	Evidence: &tmproto.EvidenceParams{
		MaxAgeNumBlocks: 302400,
		MaxAgeDuration:  504 * time.Hour,
		MaxBytes:        10000,
	},
	Validator: &tmproto.ValidatorParams{
		PubKeyTypes: []string{
			tmtypes.ABCIPubKeyTypeEd25519,
		},
	},
}

DefaultConsensusParams defines the default Tendermint consensus params used in KatanaApp testing.

Functions

func AddTestAddrsIncremental

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

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

func GenTxValidator

func GenTxValidator(msgs []sdk.Msg) error

func GenesisStateWithValSet

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

GenesisStateWithValSet returns a new genesis state with the validator set

func GetMaccPerms

func GetMaccPerms() map[string][]string

GetMaccPerms returns a deep copy of the module account permissions.

func GetWasmEnabledProposals

func GetWasmEnabledProposals() []wasm.ProposalType

GetWasmEnabledProposals parses the WasmProposalsEnabled and EnableSpecificWasmProposals values to produce a list of enabled proposals to pass into the application.

func IntegrationTestNetworkConfig

func IntegrationTestNetworkConfig() network.Config

IntegrationTestNetworkConfig returns a networking configuration used for integration tests using the SDK's in-process network test suite.

func MakeEncodingConfig

func MakeEncodingConfig() params.EncodingConfig

MakeEncodingConfig returns the application's encoding configuration with all types and interfaces registered.

func TestAddr

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

Types

type BankModule

type BankModule struct {
	bank.AppModuleBasic
}

BankModule defines a custom wrapper around the x/bank module's AppModuleBasic implementation to provide custom default genesis state.

func (BankModule) DefaultGenesis

func (BankModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns custom Katana x/bank module genesis state.

type CosmosApp

type CosmosApp interface {
	// The assigned name of the app.
	Name() string

	// The application legacy Amino codec.
	//
	// NOTE: This should be sealed before being returned.
	LegacyAmino() *codec.LegacyAmino

	// Application updates every begin block.
	BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

	// Application updates every end block.
	EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

	// Application update at chain (i.e app) initialization.
	InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain

	// Loads the app at a given height.
	LoadHeight(height int64) error

	// Exports the state of the application for a genesis file.
	ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string) (types.ExportedApp, error)

	// All the registered module account addresses.
	ModuleAccountAddrs() map[string]bool
}

CosmosApp defines the common methods for a Cosmos SDK-based application-specific blockchain.

type CrisisModule

type CrisisModule struct {
	crisis.AppModuleBasic
}

CrisisModule defines a custom wrapper around the x/crisis module's AppModuleBasic implementation to provide custom default genesis state.

func (CrisisModule) DefaultGenesis

func (CrisisModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns custom Katana x/crisis module genesis state.

type EmptyAppOptions

type EmptyAppOptions struct{}

func (EmptyAppOptions) Get

func (EmptyAppOptions) Get(string) interface{}

type GenerateAccountStrategy

type GenerateAccountStrategy func(int) []sdk.AccAddress

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 NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState

NewDefaultGenesisState generates the default state for the application.

type GovModule

type GovModule struct {
	gov.AppModuleBasic
}

GovModule defines a custom wrapper around the x/gov module's AppModuleBasic implementation to provide custom default genesis state.

func (GovModule) DefaultGenesis

func (GovModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns custom Katana x/gov module genesis state.

type KatanaApp

type KatanaApp struct {
	*baseapp.BaseApp

	// keepers
	AccountKeeper    authkeeper.AccountKeeper
	BankKeeper       bankkeeper.BaseKeeper
	CapabilityKeeper *capabilitykeeper.Keeper
	StakingKeeper    *stakingkeeper.Keeper
	SlashingKeeper   slashingkeeper.Keeper
	MintKeeper       mintkeeper.Keeper
	DistrKeeper      distrkeeper.Keeper
	GovKeeper        govkeeper.Keeper
	CrisisKeeper     crisiskeeper.Keeper
	UpgradeKeeper    upgradekeeper.Keeper
	ParamsKeeper     paramskeeper.Keeper
	AuthzKeeper      authzkeeper.Keeper
	EvidenceKeeper   evidencekeeper.Keeper
	FeeGrantKeeper   feegrantkeeper.Keeper
	GroupKeeper      groupkeeper.Keeper
	NFTKeeper        nftkeeper.Keeper
	WasmKeeper       wasm.Keeper

	UIBCTransferKeeper uibctransferkeeper.Keeper
	IBCKeeper          *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
	GravityKeeper      gravitykeeper.Keeper
	LeverageKeeper     leveragekeeper.Keeper
	OracleKeeper       oraclekeeper.Keeper

	// make scoped keepers public for testing purposes
	ScopedIBCKeeper      capabilitykeeper.ScopedKeeper
	ScopedTransferKeeper capabilitykeeper.ScopedKeeper
	ScopedWasmKeeper     capabilitykeeper.ScopedKeeper

	// simulation manager to create state
	StateSimulationManager *module.SimulationManager
	// contains filtered or unexported fields
}

KatanaApp defines the ABCI application for the Katana network as an extension of the Cosmos SDK's BaseApp.

func New

func New(
	logger log.Logger,
	db dbm.DB,
	traceStore io.Writer,
	loadLatest bool,
	skipUpgradeHeights map[int64]bool,
	homePath string,
	invCheckPeriod uint,
	encodingConfig appparams.EncodingConfig,
	appOpts servertypes.AppOptions,
	wasmEnabledProposals []wasm.ProposalType,
	wasmOpts []wasm.Option,
	baseAppOptions ...func(*baseapp.BaseApp),
) *KatanaApp

func Setup

func Setup(t *testing.T) *KatanaApp

func SetupWithGenesisValSet

func SetupWithGenesisValSet(
	t *testing.T,
	valSet *tmtypes.ValidatorSet,
	genAccs []authtypes.GenesisAccount,
	balances ...banktypes.Balance,
) *KatanaApp

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 simapp from first genesis account. A Nop logger is set in app.

func (*KatanaApp) AppCodec

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

AppCodec returns Katana's 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 (*KatanaApp) BeginBlocker

func (app *KatanaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

BeginBlocker implements Katana's BeginBlock ABCI method.

func (*KatanaApp) EndBlocker

func (app *KatanaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

EndBlocker implements Katana's EndBlock ABCI method.

func (*KatanaApp) ExportAppStateAndValidators

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

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

func (*KatanaApp) GetBaseApp

func (app *KatanaApp) GetBaseApp() *baseapp.BaseApp

GetBaseApp is used solely for testing purposes.

func (*KatanaApp) GetIBCKeeper

func (app *KatanaApp) GetIBCKeeper() *ibckeeper.Keeper

GetIBCKeeper is used solely for testing purposes.

func (*KatanaApp) GetKey

func (app *KatanaApp) 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 (*KatanaApp) GetMemKey

func (app *KatanaApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*KatanaApp) GetScopedIBCKeeper

func (app *KatanaApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper

GetScopedIBCKeeper is used solely for testing purposes.

func (*KatanaApp) GetStakingKeeper

func (app *KatanaApp) GetStakingKeeper() ibctesting.StakingKeeper

GetStakingKeeper is used solely for testing purposes.

func (*KatanaApp) GetSubspace

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

GetSubspace returns a param subspace for a given module name.

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

func (*KatanaApp) GetTKey

func (app *KatanaApp) GetTKey(storeKey string) *storetypes.TransientStoreKey

GetTKey returns the TransientStoreKey for the provided store key.

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

func (*KatanaApp) GetTxConfig

func (app *KatanaApp) GetTxConfig() client.TxConfig

GetTxConfig is used solely for testing purposes.

func (*KatanaApp) InitChainer

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

InitChainer implements Katana's InitChain ABCI method.

func (*KatanaApp) InterfaceRegistry

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

InterfaceRegistry returns Katana's InterfaceRegistry.

func (*KatanaApp) LegacyAmino

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

LegacyAmino returns Katana'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 (*KatanaApp) LoadHeight

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

LoadHeight loads a particular height via Katana's BaseApp.

func (*KatanaApp) ModuleAccountAddrs

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

ModuleAccountAddrs returns all of Katana's module account addresses.

func (*KatanaApp) Name

func (app *KatanaApp) Name() string

Name returns the name of the App

func (*KatanaApp) RegisterAPIRoutes

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

RegisterAPIRoutes registers all application module routes with the provided

API server.

func (*KatanaApp) RegisterNodeService

func (app *KatanaApp) RegisterNodeService(clientCtx client.Context)

func (*KatanaApp) RegisterTendermintService

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

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*KatanaApp) RegisterTxService

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

RegisterTxService implements the Application.RegisterTxService method.

func (KatanaApp) RegisterUpgradeHandlers

func (app KatanaApp) RegisterUpgradeHandlers(bool)

RegisterUpgradeHandlersregisters upgrade handlers. It takes a boolean parameter to enable or disable experimental features.

func (*KatanaApp) SimulationManager

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

SimulationManager returns the application's SimulationManager.

type MintModule

type MintModule struct {
	mint.AppModuleBasic
}

MintModule defines a custom wrapper around the x/mint module's AppModuleBasic implementation to provide custom default genesis state.

func (MintModule) DefaultGenesis

func (MintModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns custom Katana x/mint module genesis state.

type SlashingModule

type SlashingModule struct {
	slashing.AppModuleBasic
}

SlashingModule defines a custom wrapper around the x/slashing module's AppModuleBasic implementation to provide custom default genesis state.

func (SlashingModule) DefaultGenesis

func (SlashingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns custom Katana x/slashing module genesis state.

type StakingModule

type StakingModule struct {
	staking.AppModuleBasic
}

StakingModule defines a custom wrapper around the x/staking module's AppModuleBasic implementation to provide custom default genesis state.

func (StakingModule) DefaultGenesis

func (StakingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns custom Katana x/staking module genesis state.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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