app

package
v0.0.0-...-23a414b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 209 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// `Upgrades` defines the upgrade handlers and store loaders for the application.
	// New upgrades should be added to this slice after they are implemented.
	Upgrades = []upgrades.Upgrade{
		v4_1_0.Upgrade,
	}
	Forks = []upgrades.Fork{}
)
View Source
var (
	// DefaultNodeHome default home directories for the application daemon
	DefaultNodeHome string
)

Functions

func BlockedAddresses

func BlockedAddresses() map[string]bool

BlockedAddresses returns all the app's blocked account addresses.

func GetMaccPerms

func GetMaccPerms() map[string][]string

GetMaccPerms returns a copy of the module account permissions

func ModuleAccountAddrs

func ModuleAccountAddrs() map[string]bool

ModuleAccountAddrs returns all the app's module account addresses.

func NewAnteHandler

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

NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, deducts fees from the first signer, and handles in-memory clob messages.

Note that the contract for the forked version of Cosmos SDK is that during `checkTx` the ante handler is responsible for branching and writing the state store. During this time the forked Cosmos SDK has a read lock allowing for parallel state reads but no writes. The `AnteHandler` is responsible for ensuring the linearization of reads and writes by having locks cover each other. This requires any ante decorators that read state that can be mutated during `checkTx` to acquire an appropriate lock. Today that is:

  • account keeper params / consensus params (and all other state) are only read during `checkTx` and only mutated during `deliverTx` thus no additional locking is needed to linearize reads and writes.
  • accounts require the per account lock to be acquired since accounts have have pub keys set or the sequence number incremented to linearize reads and writes.
  • banks / fee state (and all other state) that can be mutated during `checkTx` requires the global lock to be acquired before it is read or written to linearize reads and writes.

During `deliverTx` and simulation the Cosmos SDK is responsible for branching and writing the state store so no additional locking is necessary to linearize state reads and writes. Note that simulation only ever occurs on a past block and not the current `checkState` so there is no opportunity for it to collide with concurrent `checkTx` invocations.

Also note that all the ante decorators that are used return immediately the results of invoking `next` allowing us to significantly reduce the stack by saving and passing forward the context to the next ante decorator. This allows us to have a method that contains the order in which all the ante decorators are invoked including a single place to reason about the locking semantics without needing to look at several ante decorators.

Link to default `AnteHandler` used by cosmos sdk: https://github.com/cosmos/cosmos-sdk/blob/3bb27795742dab2451b232bab02b82566d1a0192/x/auth/ante/ante.go#L25

func RegisterSwaggerAPI

func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router)

RegisterSwaggerAPI registers swagger route with API Server

func SetZerologDatadogErrorTrackingFormat

func SetZerologDatadogErrorTrackingFormat()

SetZerologDatadogErrorTrackingFormat sets custom error formatting for log tag values that are errors for the zerolog library. Converts them to a format that is compatible with datadog error tracking.

Types

type App

type App struct {
	*baseapp.BaseApp

	// keepers
	AccountKeeper    authkeeper.AccountKeeper
	AuthzKeeper      authzkeeper.Keeper
	BankKeeper       bankkeeper.Keeper
	CapabilityKeeper *capabilitykeeper.Keeper
	StakingKeeper    *stakingkeeper.Keeper
	SlashingKeeper   slashingkeeper.Keeper
	DistrKeeper      distrkeeper.Keeper
	GovKeeper        *govkeeper.Keeper
	CrisisKeeper     *crisiskeeper.Keeper
	UpgradeKeeper    *upgradekeeper.Keeper
	ParamsKeeper     paramskeeper.Keeper
	// IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
	IBCKeeper             *ibckeeper.Keeper
	ICAHostKeeper         icahostkeeper.Keeper
	EvidenceKeeper        evidencekeeper.Keeper
	TransferKeeper        ibctransferkeeper.Keeper
	RatelimitKeeper       ratelimitmodulekeeper.Keeper
	FeeGrantKeeper        feegrantkeeper.Keeper
	ConsensusParamsKeeper consensusparamkeeper.Keeper
	GovPlusKeeper         govplusmodulekeeper.Keeper

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

	PricesKeeper pricesmodulekeeper.Keeper

	AssetsKeeper assetsmodulekeeper.Keeper

	BlockTimeKeeper blocktimemodulekeeper.Keeper

	DelayMsgKeeper delaymsgmodulekeeper.Keeper

	FeeTiersKeeper feetiersmodulekeeper.Keeper

	PerpetualsKeeper perpetualsmodulekeeper.Keeper

	StatsKeeper statsmodulekeeper.Keeper

	SubaccountsKeeper subaccountsmodulekeeper.Keeper

	ClobKeeper *clobmodulekeeper.Keeper

	SendingKeeper sendingmodulekeeper.Keeper

	EpochsKeeper epochsmodulekeeper.Keeper

	ModuleManager *module.Manager
	ModuleBasics  module.BasicManager

	IndexerEventManager  indexer_manager.IndexerEventManager
	GrpcStreamingManager streamingtypes.GrpcStreamingManager
	Server               *daemonserver.Server

	PriceFeedClient    *pricefeedclient.Client
	SDAIClient         *sdaiclient.Client
	DeleveragingClient *deleveragingclient.Client

	DaemonHealthMonitor *daemonservertypes.HealthMonitor
	// 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,
	appOpts servertypes.AppOptions,
	baseAppOptions ...func(*baseapp.BaseApp),
) *App

New returns a reference to an initialized blockchain 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

AutoCliOpts returns the autocli options for the app.

func (*App) BeginBlocker

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

BeginBlocker application updates every begin block

func (*App) Close

func (app *App) Close() error

Close invokes an ordered shutdown of routines.

func (*App) DefaultGenesis

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

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

func (*App) DisableHealthMonitorForTesting

func (app *App) DisableHealthMonitorForTesting()

DisableHealthMonitorForTesting disables the health monitor for testing.

func (*App) EndBlocker

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

EndBlocker application updates every end block

func (*App) ExportAppStateAndValidators deprecated

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

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

Deprecated: This is a legacy feature of cosmos that is known to be unstable, so we explicitly do not support its usage.

func (*App) GetBaseApp

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

GetBaseApp returns the base app of the application

func (*App) GetIBCKeeper

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

GetIBCKeeper implements the TestingApp interface used in IBC tests.

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

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

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*App) GetScopedIBCKeeper

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

GetScopedIBCKeeper implements the TestingApp interface used in IBC tests.

func (*App) GetStakingKeeper

func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper

GetStakingKeeper implements the TestingApp interface used in IBC tests.

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) *storetypes.TransientStoreKey

GetTKey returns the TransientStoreKey for the provided store key.

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

func (*App) GetTxConfig

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

GetTxConfig implements the TestingApp interface used in IBC tests.

func (*App) InitChainer

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

InitChainer application update at chain initialization.

func (*App) InitVoteExtensions

func (app *App) InitVoteExtensions(
	logger log.Logger,
	veCodec vecodec.VoteExtensionCodec,
	pricesKeeper pricesmodulekeeper.Keeper,
	perpetualsKeeper *perpetualsmodulekeeper.Keeper,
	clobKeeper *clobmodulekeeper.Keeper,
	rateLimitKeeper *ratelimitmodulekeeper.Keeper,
	sDAIEventManager sdaidaemontypes.SDAIEventManager,
	veApplier *veapplier.VEApplier,
)

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

func (app *App) PreBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error)

PreBlocker application updates before each begin block.

func (*App) Precommitter

func (app *App) Precommitter(ctx sdk.Context)

Precommitter application updates before the commital of a block after all transactions have been delivered.

func (*App) PrepareCheckStater

func (app *App) PrepareCheckStater(ctx sdk.Context, req *abci.RequestCommit)

PrepareCheckStater application updates after commit and before any check state is invoked.

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

func (app *App) RegisterDaemonWithHealthMonitor(
	healthCheckableDaemon daemontypes.HealthCheckable,
	maxDaemonUnhealthyDuration time.Duration,
)

RegisterDaemonWithHealthMonitor registers a daemon service with the update monitor, which will commence monitoring the health of the daemon. If the daemon does not register, the method will panic.

func (*App) RegisterNodeService

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

RegisterNodeService registers the node service.

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 always returns nil.

func (*App) TxConfig

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

TxConfig returns app's TxConfig

type DatadogErrorTrackingObject

type DatadogErrorTrackingObject struct {
	Stack   []map[string]string
	Message string
	Kind    string
}

func (DatadogErrorTrackingObject) MarshalZerologObject

func (obj DatadogErrorTrackingObject) MarshalZerologObject(e *zerolog.Event)

type EncodingConfig

type EncodingConfig struct {
	InterfaceRegistry types.InterfaceRegistry
	Codec             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 GetEncodingConfig

func GetEncodingConfig() EncodingConfig

GetEncodingConfig returns the EncodingConfig.

func MakeTestEncodingConfig

func MakeTestEncodingConfig() EncodingConfig

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.

type HandlerOptions

type HandlerOptions struct {
	ante.HandlerOptions
	Codec        codec.Codec
	AuthStoreKey storetypes.StoreKey
	ClobKeeper   clobtypes.ClobKeeper
	IBCKeeper    ibckeeper.Keeper
}

HandlerOptions are the options required for constructing an SDK AnteHandler. Note: This struct is defined here in order to add `ClobKeeper`. We use struct embedding to include the normal cosmos-sdk `HandlerOptions`.

Jump to

Keyboard shortcuts

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