Documentation ¶
Index ¶
- Variables
- func BlockedAddresses() map[string]bool
- func GetMaccPerms() map[string][]string
- func ModuleAccountAddrs() map[string]bool
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router)
- func SetZerologDatadogErrorTrackingFormat()
- type App
- func (app *App) AppCodec() codec.Codec
- func (app *App) AutoCliOpts() autocli.AppOptions
- func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
- func (app *App) Close() error
- func (app *App) DefaultGenesis() map[string]json.RawMessage
- func (app *App) DisableHealthMonitorForTesting()
- func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error)
- func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error)deprecated
- func (app *App) GetBaseApp() *baseapp.BaseApp
- func (app *App) GetIBCKeeper() *ibckeeper.Keeper
- func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey
- func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
- func (app *App) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
- func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper
- func (app *App) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *App) GetTKey(storeKey string) *storetypes.TransientStoreKey
- func (app *App) GetTxConfig() client.TxConfig
- func (app *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
- func (app *App) InitVoteExtensions(logger log.Logger, veCodec vecodec.VoteExtensionCodec, ...)
- func (app *App) InterfaceRegistry() types.InterfaceRegistry
- func (app *App) LegacyAmino() *codec.LegacyAmino
- func (app *App) LoadHeight(height int64) error
- func (app *App) PreBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error)
- func (app *App) Precommitter(ctx sdk.Context)
- func (app *App) PrepareCheckStater(ctx sdk.Context, req *abci.RequestCommit)
- func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *App) RegisterDaemonWithHealthMonitor(healthCheckableDaemon daemontypes.HealthCheckable, ...)
- func (app *App) RegisterNodeService(clientCtx client.Context, cfg config.Config)
- func (app *App) RegisterTendermintService(clientCtx client.Context)
- func (app *App) RegisterTxService(clientCtx client.Context)
- func (app *App) SimulationManager() *module.SimulationManager
- func (app *App) TxConfig() client.TxConfig
- type DatadogErrorTrackingObject
- type EncodingConfig
- type GenesisState
- type HandlerOptions
Constants ¶
This section is empty.
Variables ¶
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{} )
var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string )
Functions ¶
func BlockedAddresses ¶
BlockedAddresses returns all the app's blocked account addresses.
func GetMaccPerms ¶
GetMaccPerms returns a copy of the module account permissions
func ModuleAccountAddrs ¶
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 ¶
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 ¶
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 ¶
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) DisableHealthMonitorForTesting ¶
func (app *App) DisableHealthMonitorForTesting()
DisableHealthMonitorForTesting disables the health monitor for testing.
func (*App) EndBlocker ¶
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 ¶
GetBaseApp returns the base app of the application
func (*App) GetIBCKeeper ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
RegisterNodeService registers the node service.
func (*App) RegisterTendermintService ¶
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*App) RegisterTxService ¶
RegisterTxService implements the Application.RegisterTxService method.
func (*App) SimulationManager ¶
func (app *App) SimulationManager() *module.SimulationManager
SimulationManager always returns nil.
type DatadogErrorTrackingObject ¶
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`.