app

package
v0.1.429-bweng-test-1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 140 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// Prefix of bech32 encoded address
	AccountAddressPrefix = "sei"
	// Application name
	AppName = "sei"

	OptimisticProcessingTimeoutInSeconds = 5
)
View Source
const TestContract = "TEST"

Variables

View Source
var (
	// DefaultNodeHome default home directories 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.NewBasicManager(
		aclmodule.AppModuleBasic{},
		auth.AppModuleBasic{},
		genutil.AppModuleBasic{},
		bank.AppModuleBasic{},
		capability.AppModuleBasic{},
		staking.AppModuleBasic{},
		mint.AppModuleBasic{},
		distr.AppModuleBasic{},
		gov.NewAppModuleBasic(getGovProposalHandlers()...),
		params.AppModuleBasic{},
		crisis.AppModuleBasic{},
		slashing.AppModuleBasic{},
		feegrantmodule.AppModuleBasic{},
		ibc.AppModuleBasic{},
		upgrade.AppModuleBasic{},
		evidence.AppModuleBasic{},
		transfer.AppModuleBasic{},
		vesting.AppModuleBasic{},
		oraclemodule.AppModuleBasic{},
		wasm.AppModuleBasic{},
		dexmodule.AppModuleBasic{},
		epochmodule.AppModuleBasic{},
		tokenfactorymodule.AppModuleBasic{},
		nitromodule.AppModuleBasic{},
	)

	// WasmProposalsEnabled enables all x/wasm proposals when it's value is "true"
	// and EnableSpecificWasmProposals is empty. Otherwise, all x/wasm proposals
	// are disabled.
	WasmProposalsEnabled = "true"

	// EnableSpecificWasmProposals, if set, must be comma-separated list of values
	// that are all a subset of "EnableAllProposals", which takes precedence over
	// WasmProposalsEnabled.
	//
	// See: https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
	EnableSpecificWasmProposals = ""

	// EmptyWasmOpts defines a type alias for a list of wasm options.
	EmptyWasmOpts []wasm.Option

	// Boolean to only emit seid version and git commit metric once per chain initialization
	EmittedSeidVersionMetric = false
	// EmptyAclmOpts defines a type alias for a list of wasm options.
	EmptyACLOpts []aclkeeper.Option
)

Functions

func GetChannelsFromSignalMapping

func GetChannelsFromSignalMapping(signalMapping acltypes.MessageCompletionSignalMapping) sdkacltypes.MessageAccessOpsChannelMapping

Returns a mapping of the accessOperation to the channels

func GetMaccPerms

func GetMaccPerms() map[string][]string

GetMaccPerms returns a 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 MakeEncodingConfig

func MakeEncodingConfig() params.EncodingConfig

MakeEncodingConfig creates an EncodingConfig for testing.

func NewAnteHandlerAndDepGenerator

func NewAnteHandlerAndDepGenerator(options HandlerOptions) (sdk.AnteHandler, sdk.AnteDepGenerator, error)

Types

type App

type App struct {
	*baseapp.BaseApp

	// keepers
	AccessControlKeeper aclkeeper.Keeper
	AccountKeeper       authkeeper.AccountKeeper
	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
	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
	FeeGrantKeeper      feegrantkeeper.Keeper
	WasmKeeper          wasm.Keeper
	OracleKeeper        oraclekeeper.Keeper

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

	DexKeeper dexmodulekeeper.Keeper

	EpochKeeper epochmodulekeeper.Keeper

	TokenFactoryKeeper tokenfactorykeeper.Keeper

	NitroKeeper nitrokeeper.Keeper
	// 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 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,
	enabledProposals []wasm.ProposalType,
	appOpts servertypes.AppOptions,
	wasmOpts []wasm.Option,
	aclOpts []aclkeeper.Option,
	baseAppOptions ...func(*baseapp.BaseApp),
) *App

New returns a reference to an initialized blockchain app

func Setup

func Setup(isCheckTx bool) *App

func SetupTestingAppWithLevelDb

func SetupTestingAppWithLevelDb(isCheckTx bool) (*App, func())

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) BeginBlock

func (app *App) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)

func (*App) BeginBlocker

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

BeginBlocker application updates every begin block

func (*App) BlacklistedAccAddrs

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

func (*App) BuildDependenciesAndRunTxs

func (app *App) BuildDependenciesAndRunTxs(ctx sdk.Context, txs [][]byte) ([]*abci.ExecTxResult, sdk.Context)

func (*App) CacheContext

func (app *App) CacheContext(ctx sdk.Context) (sdk.Context, sdk.CacheMultiStore)

cacheContext returns a new context based off of the provided context with a branched multi-store.

func (*App) CheckTx

func (app *App) CheckTx(ctx context.Context, req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error)

func (*App) ClearOptimisticProcessingInfo

func (app *App) ClearOptimisticProcessingInfo()

func (*App) Commit

func (app *App) Commit(ctx context.Context) (res *abci.ResponseCommit, err error)

func (*App) DeliverTx

func (app *App) DeliverTx(ctx sdk.Context, req abci.RequestDeliverTx) abci.ResponseDeliverTx

func (*App) DeliverTxWithResult

func (app *App) DeliverTxWithResult(ctx sdk.Context, tx []byte) *abci.ExecTxResult

func (*App) EndBlock

func (app *App) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) (res abci.ResponseEndBlock)

func (*App) EndBlocker

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

EndBlocker application updates every end block

func (*App) ExportAppStateAndValidators

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

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

func (*App) FinalizeBlocker

func (app *App) FinalizeBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error)

func (App) GetBaseApp

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

GetBaseApp returns the base app of the application

func (*App) GetKey

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

GetKey returns the KVStoreKey for the provided store key.

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

func (*App) GetMemKey

func (app *App) GetMemKey(storeKey string) *sdk.MemoryStoreKey

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*App) GetOptimisticProcessingInfo

func (app *App) GetOptimisticProcessingInfo() OptimisticProcessingInfo

func (*App) GetSubspace

func (app *App) 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 (*App) GetTKey

func (app *App) GetTKey(storeKey string) *sdk.TransientStoreKey

GetTKey returns the TransientStoreKey for the provided store key.

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

func (*App) InitChainer

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

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) MidBlock

func (app *App) MidBlock(ctx sdk.Context, height int64) []abci.Event

func (*App) MidBlocker

func (app *App) MidBlocker(ctx sdk.Context, height int64) []abci.Event

MidBlocker application updates every mid block

func (*App) ModuleAccountAddrs

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

ModuleAccountAddrs returns all the app's module account addresses.

func (*App) Name

func (app *App) Name() string

AppName returns the name of the App

func (*App) PartitionOracleVoteTxs

func (app *App) PartitionOracleVoteTxs(ctx sdk.Context, txs [][]byte) (oracleVoteTxs, otherTxs [][]byte)

func (*App) PrepareProposalHandler

func (app *App) PrepareProposalHandler(ctx sdk.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error)

func (*App) ProcessBlock

func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequest, lastCommit abci.CommitInfo) ([]abci.Event, []*abci.ExecTxResult, abci.ResponseEndBlock, error)

func (*App) ProcessBlockConcurrent

func (app *App) ProcessBlockConcurrent(
	ctx sdk.Context,
	txs [][]byte,
	completionSignalingMap map[int]acltypes.MessageCompletionSignalMapping,
	blockingSignalsMap map[int]acltypes.MessageCompletionSignalMapping,
	txMsgAccessOpMapping map[int]acltypes.MsgIndexToAccessOpMapping,
) ([]*abci.ExecTxResult, bool)

func (*App) ProcessBlockSynchronous

func (app *App) ProcessBlockSynchronous(ctx sdk.Context, txs [][]byte) []*abci.ExecTxResult

func (*App) ProcessProposalHandler

func (app *App) ProcessProposalHandler(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error)

func (*App) ProcessTxConcurrent

func (app *App) ProcessTxConcurrent(
	ctx sdk.Context,
	txIndex int,
	txBytes []byte,
	wg *sync.WaitGroup,
	resultChan chan<- ChannelResult,
	txCompletionSignalingMap acltypes.MessageCompletionSignalMapping,
	txBlockingSignalsMap acltypes.MessageCompletionSignalMapping,
	txMsgAccessOpMapping acltypes.MsgIndexToAccessOpMapping,
)

func (*App) ProcessTxs

func (app *App) ProcessTxs(
	ctx sdk.Context,
	txs [][]byte,
	dependencyDag *acltypes.Dag,
	processBlockConcurrentFunction ProcessBlockConcurrentFunction,
) ([]*abci.ExecTxResult, sdk.Context)

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) 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) RegisterUpgradeHandlers

func (app App) RegisterUpgradeHandlers()

func (*App) SetStoreUpgradeHandlers

func (app *App) SetStoreUpgradeHandlers()

Add (or remove) keepers when they are introduced / removed in different versions

func (*App) SimulationManager

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

SimulationManager implements the SimulationApp interface

type BlockProcessRequest

type BlockProcessRequest interface {
	GetHash() []byte
	GetTxs() [][]byte
	GetByzantineValidators() []abci.Misbehavior
	GetHeight() int64
	GetTime() time.Time
}

type ChannelResult

type ChannelResult struct {
	// contains filtered or unexported fields
}

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 HandlerOptions

type HandlerOptions struct {
	ante.HandlerOptions

	IBCKeeper           *ibckeeper.Keeper
	WasmConfig          *wasmtypes.WasmConfig
	WasmKeeper          *wasm.Keeper
	OracleKeeper        *oraclekeeper.Keeper
	DexKeeper           *dexkeeper.Keeper
	NitroKeeper         *nitrokeeper.Keeper
	AccessControlKeeper *aclkeeper.Keeper
	TXCounterStoreKey   sdk.StoreKey

	TracingInfo *tracing.Info
}

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

type OptimisticProcessingInfo

type OptimisticProcessingInfo struct {
	Height     int64
	Hash       []byte
	Aborted    bool
	Completion chan struct{}
	// result fields
	Events       []abci.Event
	TxRes        []*abci.ExecTxResult
	EndBlockResp abci.ResponseEndBlock
}

type ProcessBlockConcurrentFunction

type ProcessBlockConcurrentFunction func(
	ctx sdk.Context,
	txs [][]byte,
	completionSignalingMap map[int]acltypes.MessageCompletionSignalMapping,
	blockingSignalsMap map[int]acltypes.MessageCompletionSignalMapping,
	txMsgAccessOpMapping map[int]acltypes.MsgIndexToAccessOpMapping,
) ([]*abci.ExecTxResult, bool)

type TestTx

type TestTx struct {
	// contains filtered or unexported fields
}

func NewTestTx

func NewTestTx(msgs []sdk.Msg) TestTx

func (TestTx) GetMsgs

func (t TestTx) GetMsgs() []sdk.Msg

func (TestTx) ValidateBasic

func (t TestTx) ValidateBasic() error

type TestWrapper

type TestWrapper struct {
	suite.Suite

	App *App
	Ctx sdk.Context
}

func NewTestWrapper

func NewTestWrapper(t *testing.T, tm time.Time, valPub crptotypes.PubKey) *TestWrapper

func (*TestWrapper) BeginBlock

func (s *TestWrapper) BeginBlock()

func (*TestWrapper) EndBlock

func (s *TestWrapper) EndBlock()

func (*TestWrapper) FundAcc

func (s *TestWrapper) FundAcc(acc sdk.AccAddress, amounts sdk.Coins)

Directories

Path Synopsis
Package params defines the simulation parameters in the simapp.
Package params defines the simulation parameters in the simapp.

Jump to

Keyboard shortcuts

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