Documentation ¶
Index ¶
- Variables
- func ABCIError(err error) abci.Error
- func ABCIResponseQueryFromError(err error) (res abci.ResponseQuery)
- func FormatInvariant(module, name, msg string) string
- func NewRouter() *router
- func SetMinGasPrices(gasPricesStr string) func(*BaseApp)
- func SetPruningOptions(opts store.PruningOptions) func(*BaseApp)
- type AnteHandler
- type BaseApp
- func (app *BaseApp) AppVersion() string
- func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
- func (app *BaseApp) Check(tx Tx) (result Result)
- func (app *BaseApp) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx)
- func (app *BaseApp) Close() error
- func (app *BaseApp) Commit() (res abci.ResponseCommit)
- func (app *BaseApp) Deliver(tx Tx, ctxFns ...ContextFn) (result Result)
- func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx)
- func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBlock)
- func (app *BaseApp) GetCacheMultiStore() store.MultiStore
- func (app *BaseApp) Info(req abci.RequestInfo) (res abci.ResponseInfo)
- func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
- func (app *BaseApp) IsSealed() bool
- func (app *BaseApp) LastBlockHeight() int64
- func (app *BaseApp) LastCommitID() store.CommitID
- func (app *BaseApp) LoadLatestVersion() error
- func (app *BaseApp) LoadVersion(version int64) error
- func (app *BaseApp) Logger() *slog.Logger
- func (app *BaseApp) MountStore(key store.StoreKey, cons store.CommitStoreConstructor)
- func (app *BaseApp) MountStoreWithDB(key store.StoreKey, cons store.CommitStoreConstructor, db dbm.DB)
- func (app *BaseApp) Name() string
- func (app *BaseApp) NewContext(mode RunTxMode, header abci.Header) Context
- func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery)
- func (app *BaseApp) Router() Router
- func (app *BaseApp) Seal()
- func (app *BaseApp) SetAnteHandler(ah AnteHandler)
- func (app *BaseApp) SetAppVersion(v string)
- func (app *BaseApp) SetBeginBlocker(beginBlocker BeginBlocker)
- func (app *BaseApp) SetBeginTxHook(beginTx BeginTxHook)
- func (app *BaseApp) SetCMS(cms store.CommitMultiStore)
- func (app *BaseApp) SetDB(db dbm.DB)
- func (app *BaseApp) SetEndBlocker(endBlocker EndBlocker)
- func (app *BaseApp) SetEndTxHook(endTx EndTxHook)
- func (app *BaseApp) SetInitChainer(initChainer InitChainer)
- func (app *BaseApp) SetName(name string)
- func (app *BaseApp) SetOption(req abci.RequestSetOption) (res abci.ResponseSetOption)
- func (app *BaseApp) Simulate(txBytes []byte, tx Tx) (result Result)
- type BeginBlocker
- type BeginTxHook
- type Coin
- type Coins
- type Context
- func (c Context) BlockGasMeter() store.GasMeter
- func (c Context) BlockHeader() abci.Header
- func (c Context) BlockHeight() int64
- func (c Context) BlockTime() time.Time
- func (c Context) CacheContext() (cc Context, writeCache func())
- func (c Context) ChainID() string
- func (c Context) ConsensusParams() *abci.ConsensusParams
- func (c Context) Context() context.Context
- func (c Context) EventLogger() *EventLogger
- func (c Context) GasMeter() store.GasMeter
- func (c Context) IsCheckTx() bool
- func (c Context) IsZero() bool
- func (c Context) Logger() *slog.Logger
- func (c Context) MinGasPrices() []GasPrice
- func (c Context) Mode() RunTxMode
- func (c Context) MultiStore() store.MultiStore
- func (c Context) Store(key store.StoreKey) store.Store
- func (c Context) TxBytes() []byte
- func (c Context) Value(key interface{}) interface{}
- func (c Context) VoteInfos() []abci.VoteInfo
- func (c Context) WithBlockGasMeter(meter store.GasMeter) Context
- func (c Context) WithBlockHeader(header abci.Header) Context
- func (c Context) WithChainID(chainID string) Context
- func (c Context) WithConsensusParams(params *abci.ConsensusParams) Context
- func (c Context) WithContext(ctx context.Context) Context
- func (c Context) WithEventLogger(em *EventLogger) Context
- func (c Context) WithGasMeter(meter store.GasMeter) Context
- func (c Context) WithLogger(logger *slog.Logger) Context
- func (c Context) WithMinGasPrices(gasPrices []GasPrice) Context
- func (c Context) WithMode(mode RunTxMode) Context
- func (c Context) WithMultiStore(ms store.MultiStore) Context
- func (c Context) WithTxBytes(txBytes []byte) Context
- func (c Context) WithValue(key, value interface{}) Context
- func (c Context) WithVoteInfos(voteInfo []abci.VoteInfo) Context
- type ContextFn
- type EndBlocker
- type EndTxHook
- type Event
- type EventLogger
- type GasPrice
- type Handler
- type InitChainer
- type Invariant
- type InvariantRegistry
- type Invariants
- type Msg
- type Request
- type Result
- type Router
- type RunTxMode
- type Tx
Constants ¶
This section is empty.
Variables ¶
var ( ParseGasPrice = std.ParseGasPrice ParseGasPrices = std.ParseGasPrices )
var Package = amino.RegisterPackage(amino.NewPackage( "github.com/gnolang/gno/tm2/pkg/sdk", "tm", amino.GetCallersDirname(), ). WithDependencies( abci.Package, ). WithTypes( Result{}, ))
Functions ¶
func ABCIResponseQueryFromError ¶
func ABCIResponseQueryFromError(err error) (res abci.ResponseQuery)
func FormatInvariant ¶
FormatInvariant returns a standardized invariant message.
func SetMinGasPrices ¶
SetMinGasPrices returns an option that sets the minimum gas prices on the app.
func SetPruningOptions ¶
func SetPruningOptions(opts store.PruningOptions) func(*BaseApp)
SetPruningOptions sets pruning options on the multistore associated with the app
Types ¶
type AnteHandler ¶
type AnteHandler func(ctx Context, tx Tx, simulate bool) (newCtx Context, result Result, abort bool)
AnteHandler authenticates transactions, before their internal messages are handled.
type BaseApp ¶
type BaseApp struct {
// contains filtered or unexported fields
}
BaseApp reflects the ABCI application implementation.
func NewBaseApp ¶
func NewBaseApp( name string, logger *slog.Logger, db dbm.DB, baseKey store.StoreKey, mainKey store.StoreKey, options ...func(*BaseApp), ) *BaseApp
NewBaseApp returns a reference to an initialized BaseApp. It accepts a variadic number of option functions, which act on the BaseApp to set configuration choices.
NOTE: The db is used to store the version number for now.
func (*BaseApp) AppVersion ¶
AppVersion returns the application's version string.
func (*BaseApp) BeginBlock ¶
func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
BeginBlock implements the ABCI application interface.
func (*BaseApp) CheckTx ¶
func (app *BaseApp) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx)
CheckTx implements the ABCI interface. It runs the "basic checks" to see whether or not a transaction can possibly be executed, first decoding and then the ante handler (which checks signatures/fees/ValidateBasic).
NOTE:CheckTx does not run the actual Msg handler function(s).
func (*BaseApp) Commit ¶
func (app *BaseApp) Commit() (res abci.ResponseCommit)
Commit implements the ABCI interface. It will commit all state that exists in the deliver state's multi-store and includes the resulting commit ID in the returned abci.ResponseCommit. Commit will set the check state based on the latest header and reset the deliver state. Also, if a non-zero halt height is defined in config, Commit will execute a deferred function call to check against that height and gracefully halt if it matches the latest committed height.
func (*BaseApp) DeliverTx ¶
func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx)
DeliverTx implements the ABCI interface.
func (*BaseApp) EndBlock ¶
func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBlock)
EndBlock implements the ABCI interface.
func (*BaseApp) GetCacheMultiStore ¶
func (app *BaseApp) GetCacheMultiStore() store.MultiStore
Returns a read-only (cache) MultiStore. This may be used by keepers for initialization upon restart.
func (*BaseApp) Info ¶
func (app *BaseApp) Info(req abci.RequestInfo) (res abci.ResponseInfo)
Info implements the ABCI interface.
func (*BaseApp) InitChain ¶
func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
InitChain implements the ABCI interface. It runs the initialization logic directly on the CommitMultiStore.
func (*BaseApp) LastBlockHeight ¶
LastBlockHeight returns the last committed block height.
func (*BaseApp) LastCommitID ¶
LastCommitID returns the last CommitID of the multistore.
func (*BaseApp) LoadLatestVersion ¶
LoadLatestVersion loads the latest application version. It will panic if called more than once on a running BaseApp. This, or LoadVersion() MUST be called even after first init.
func (*BaseApp) LoadVersion ¶
LoadVersion loads the BaseApp application version. It will panic if called more than once on a running baseapp. This, or LoadLatestVersion() MUST be called even after first init.
func (*BaseApp) MountStore ¶
func (app *BaseApp) MountStore(key store.StoreKey, cons store.CommitStoreConstructor)
MountStore mounts a store to the provided key in the BaseApp multistore, using the default DB.
func (*BaseApp) MountStoreWithDB ¶
func (app *BaseApp) MountStoreWithDB(key store.StoreKey, cons store.CommitStoreConstructor, db dbm.DB)
MountStoreWithDB mounts a store to the provided key in the BaseApp multistore, using a specified DB.
func (*BaseApp) NewContext ¶
Context with current {check, deliver}State of the app used by tests
func (*BaseApp) Query ¶
func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery)
Query implements the ABCI interface. It delegates to CommitMultiStore if it implements Queryable.
func (*BaseApp) Seal ¶
func (app *BaseApp) Seal()
Seal seals a BaseApp. It prohibits any further modifications to a BaseApp.
func (*BaseApp) SetAnteHandler ¶
func (app *BaseApp) SetAnteHandler(ah AnteHandler)
func (*BaseApp) SetAppVersion ¶
SetAppVersion sets the application's version string.
func (*BaseApp) SetBeginBlocker ¶
func (app *BaseApp) SetBeginBlocker(beginBlocker BeginBlocker)
func (*BaseApp) SetBeginTxHook ¶
func (app *BaseApp) SetBeginTxHook(beginTx BeginTxHook)
func (*BaseApp) SetCMS ¶
func (app *BaseApp) SetCMS(cms store.CommitMultiStore)
func (*BaseApp) SetEndBlocker ¶
func (app *BaseApp) SetEndBlocker(endBlocker EndBlocker)
func (*BaseApp) SetEndTxHook ¶
func (*BaseApp) SetInitChainer ¶
func (app *BaseApp) SetInitChainer(initChainer InitChainer)
func (*BaseApp) SetOption ¶
func (app *BaseApp) SetOption(req abci.RequestSetOption) (res abci.ResponseSetOption)
SetOption implements the ABCI interface.
type BeginBlocker ¶
type BeginBlocker func(ctx Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlocker runs code before the transactions in a block
Note: applications which set create_empty_blocks=false will not have regular block timing and should use e.g. BFT timestamps rather than block height for any periodic BeginBlock logic
type BeginTxHook ¶
BeginTxHook is a BaseApp-specific hook, called to modify the context with any additional application-specific information, before running the messages in a transaction.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is a mostly immutable object contains all information needed to process a request.
It contains a context.Context object inside if you want to use that, but please do not over-use it. We try to keep all data structured and standard additions here would be better just to add to the Context struct
func NewContext ¶
func NewContext(mode RunTxMode, ms store.MultiStore, header abci.Header, logger *slog.Logger) Context
create a new context
func (Context) BlockGasMeter ¶
func (Context) BlockHeader ¶
clone the header before returning
func (Context) BlockHeight ¶
func (Context) CacheContext ¶
CacheContext returns a new Context with the multi-store cached and a new EventLogger . The cached context is written to the context when writeCache is called. XXX remove?
func (Context) ConsensusParams ¶
func (c Context) ConsensusParams() *abci.ConsensusParams
func (Context) EventLogger ¶
func (c Context) EventLogger() *EventLogger
func (Context) MinGasPrices ¶
func (Context) MultiStore ¶
func (c Context) MultiStore() store.MultiStore
func (Context) Value ¶
func (c Context) Value(key interface{}) interface{}
Value is shorthand for:
c.Context().Value(key)
It retrieves a value from the context.Context.
func (Context) WithChainID ¶
func (Context) WithConsensusParams ¶
func (c Context) WithConsensusParams(params *abci.ConsensusParams) Context
func (Context) WithEventLogger ¶
func (c Context) WithEventLogger(em *EventLogger) Context
func (Context) WithMinGasPrices ¶
func (Context) WithMultiStore ¶
func (c Context) WithMultiStore(ms store.MultiStore) Context
func (Context) WithTxBytes ¶
func (Context) WithValue ¶
WithValue is shorthand for:
c.WithContext(context.WithValue(c.Context(), key, value))
It adds a value to the context.Context.
type ContextFn ¶
ContextFn is the custom execution context builder. It can be used to add custom metadata when replaying transactions during InitChainer or in the context of a unit test.
type EndBlocker ¶
type EndBlocker func(ctx Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlocker runs code after the transactions in a block and return updates to the validator set
Note: applications which set create_empty_blocks=false will not have regular block timing and should use e.g. BFT timestamps rather than block height for any periodic EndBlock logic
type EndTxHook ¶
EndTxHook is a BaseApp-specific hook, called after all the messages in a transaction have terminated.
type EventLogger ¶
type EventLogger struct {
// contains filtered or unexported fields
}
EventLogger implements a simple wrapper around a slice of Event objects that can be emitted from.
func NewEventLogger ¶
func NewEventLogger() *EventLogger
func (*EventLogger) EmitEvent ¶
func (em *EventLogger) EmitEvent(event Event)
EmitEvent stores a single Event object.
func (*EventLogger) EmitEvents ¶
func (em *EventLogger) EmitEvents(events []Event)
EmitEvents stores a series of Event objects.
func (*EventLogger) Events ¶
func (em *EventLogger) Events() []Event
type Handler ¶
type Handler interface { // Process defines the core of the state transition function of an application. Process(ctx Context, msg Msg) Result // Query allows the state to be queried. Query(ctx Context, req abci.RequestQuery) abci.ResponseQuery }
A Handler handles processing messages and answering queries for a particular application concern.
type InitChainer ¶
type InitChainer func(ctx Context, req abci.RequestInitChain) abci.ResponseInitChain
InitChainer initializes application state at genesis
type Invariant ¶
An Invariant is a function which tests a particular invariant. The invariant returns a descriptive message about what happened and a boolean indicating whether the invariant has been broken. The simulator will then halt and print the logs.
type InvariantRegistry ¶
expected interface for registering invariants
type Result ¶
type Result struct { abci.ResponseBase GasWanted int64 GasUsed int64 }
Result is the union of ResponseDeliverTx and ResponseCheckTx plus events.