Documentation ¶
Overview ¶
Package api implements the API between Oasis ABCI application and Oasis core.
Index ¶
- Constants
- Variables
- func CometBFTChainID(chainContext string) string
- func EventTypeForApp(eventApp string) string
- func GetCometBFTGenesisDocument(provider genesis.Provider) (*cmttypes.GenesisDoc, error)
- func IsUnavailableStateError(err error) bool
- func NewBlock(blk *cmttypes.Block) *consensus.Block
- func NodeToP2PAddr(n *node.Node) (*cmtp2p.NetAddress, error)
- func PublicKeyToValidatorUpdate(id signature.PublicKey, power int64) types.ValidatorUpdate
- func QueryForApp(eventApp string) cmtpubsub.Query
- func UnavailableStateError(err error) error
- type Application
- type ApplicationQueryState
- type ApplicationState
- type Backend
- type BaseServiceClient
- type BlockContext
- type BlockContextKey
- type BlockInfo
- type BlockMeta
- type Context
- func (c *Context) AppState() ApplicationState
- func (c *Context) BlockContext() *BlockContext
- func (c *Context) BlockHeight() int64
- func (c *Context) CallDepth() int
- func (c *Context) CallerAddress() staking.Address
- func (c *Context) Close()
- func (c *Context) Commit() *Context
- func (c *Context) Data() interface{}
- func (c *Context) DecodeEvent(index int, ev events.TypedAttribute) error
- func (c *Context) EmitData(data interface{})
- func (c *Context) EmitEvent(bld *EventBuilder)
- func (c *Context) Gas() GasAccountant
- func (c *Context) GetEvents() []types.Event
- func (c *Context) GetPriority() int64
- func (c *Context) HasEvent(app string, kind events.TypedAttribute) bool
- func (c *Context) InitialHeight() int64
- func (c *Context) IsCheckOnly() bool
- func (c *Context) IsInitChain() bool
- func (c *Context) IsMessageExecution() bool
- func (c *Context) IsSimulation() bool
- func (c *Context) LastStateRootHash() []byte
- func (c *Context) Logger() *logging.Logger
- func (c *Context) Mode() ContextMode
- func (c *Context) NewChild() *Context
- func (c *Context) NewTransaction() *Context
- func (c *Context) Now() time.Time
- func (c *Context) ProvableEvents() []events.Provable
- func (c *Context) SetGasAccountant(ga GasAccountant)
- func (c *Context) SetPriority(p int64)
- func (c *Context) SetTxSigner(txSigner signature.PublicKey)
- func (c *Context) State() mkvs.KeyValueTree
- func (c *Context) TxSigner() signature.PublicKey
- func (c *Context) WithCallerAddress(callerAddress staking.Address) *Context
- func (c *Context) WithMessageExecution() *Context
- func (c *Context) WithSimulation() *Context
- type ContextMode
- type EventBuilder
- type ExecutorCommitmentNotifier
- type Extension
- type GasAccountant
- type GenesisProvider
- type ImmutableState
- type MessageDispatcher
- type MessageSubscriber
- type MockApplicationState
- type MockApplicationStateConfig
- type NoopMessageDispatcher
- type ServiceClient
- type ServiceDescriptor
- type ServiceEvent
- type StatePruneHandler
- type StatePruner
- type SubcallInfo
- type TogglableApplication
- type TogglableMessageSubscriber
- type TransactionAuthHandler
Constants ¶
const BackendName = "tendermint"
BackendName is the consensus backend name. If changing this, also change the BACKEND_NAME constant in the Rust part at: runtime/src/consensus/tendermint/mod.rs.
const ( // LogEventPeerExchangeDisabled is a log event that indicates that // CometBFT's peer exchange has been disabled. LogEventPeerExchangeDisabled = "cometbft/peer_exchange_disabled" )
Variables ¶
var ( // MessageStateSyncCompleted is the message kind for when the node successfully performs a state // sync. The message itself is nil. MessageStateSyncCompleted = messageKind(0) // MessageExecuteSubcall is the message kind for requesting subcall execution. The message is // handled by the multiplexer and should be an instance of SubcallInfo. MessageExecuteSubcall = messageKind(1) )
var ( // ErrGasOverflow is the error returned if the gas counter would // overflow. ErrGasOverflow = errors.New("gas overflow") // ErrOutOfGas is the error returned if the caller is out of gas. ErrOutOfGas = errors.New("out of gas") )
var ErrNoState = errors.New("cometbft: no state available (app not registered?)")
ErrNoState is the error returned when state is nil.
var ErrNoSubscribers = errors.New("no subscribers to given message kind")
ErrNoSubscribers is the error returned when publishing a message that noone is subscribed to.
Functions ¶
func CometBFTChainID ¶
CometBFTChainID returns the CometBFT chain ID computed from chain context.
func EventTypeForApp ¶
EventTypeForApp generates the ABCI event type for events belonging to the specified App.
func GetCometBFTGenesisDocument ¶
func GetCometBFTGenesisDocument(provider genesis.Provider) (*cmttypes.GenesisDoc, error)
GetCometBFTGenesisDocument returns the CometBFT genesis document corresponding to the Oasis genesis document specified by the given genesis provider.
func IsUnavailableStateError ¶
IsUnavailableStateError returns true if any error in err's chain is an unavailable state error.
func NodeToP2PAddr ¶
func NodeToP2PAddr(n *node.Node) (*cmtp2p.NetAddress, error)
NodeToP2PAddr converts an Oasis node descriptor to a CometBFT p2p address book entry.
func PublicKeyToValidatorUpdate ¶
func PublicKeyToValidatorUpdate(id signature.PublicKey, power int64) types.ValidatorUpdate
PublicKeyToValidatorUpdate converts an Oasis node public key to a CometBFT validator update.
func QueryForApp ¶
QueryForApp generates a cmtquery.Query for events belonging to the specified App.
func UnavailableStateError ¶
UnavailableStateError wraps an error in an unavailable state error.
Types ¶
type Application ¶
type Application interface { MessageSubscriber // Name returns the name of the Application. Name() string // ID returns the unique identifier of the application. ID() uint8 // Methods returns the list of supported methods. Methods() []transaction.MethodName // Blessed returns true iff the Application should be considered // "blessed", and able to alter the validation set and handle the // access control related standard ABCI queries. // // Only one Application instance may be Blessed per multiplexer // instance. Blessed() bool // Dependencies returns the names of applications that the application // depends on. Dependencies() []string // QueryFactory returns an application-specific query factory that // can be used to construct new queries at specific block heights. QueryFactory() interface{} // OnRegister is the function that is called when the Application // is registered with the multiplexer instance. OnRegister(ApplicationState, MessageDispatcher) // OnCleanup is the function that is called when the ApplicationServer // has been halted. OnCleanup() // ExecuteTx executes a transaction. ExecuteTx(*Context, *transaction.Transaction) error // InitChain initializes the blockchain with validators and other // info from CometBFT. // // Note: Errors are irrecoverable and will result in a panic. InitChain(*Context, cmtabcitypes.RequestInitChain, *genesis.Document) error // BeginBlock signals the beginning of a block. // // Note: Errors are irrecoverable and will result in a panic. BeginBlock(*Context) error // EndBlock signals the end of a block, returning changes to the // validator set. // // Note: Errors are irrecoverable and will result in a panic. EndBlock(*Context) (cmtabcitypes.ResponseEndBlock, error) }
Application is the interface implemented by multiplexed Oasis-specific ABCI applications.
type ApplicationQueryState ¶
type ApplicationQueryState interface { // Storage returns the storage backend. Storage() storage.LocalBackend // Checkpointer returns the checkpointer associated with the application state. // // This may be nil in case checkpoints are disabled. Checkpointer() checkpoint.Checkpointer // BlockHeight returns the last committed block height. BlockHeight() int64 // GetEpoch returns epoch at block height. GetEpoch(ctx context.Context, blockHeight int64) (beacon.EpochTime, error) // LastRetainedVersion returns the earliest retained version the ABCI // state. LastRetainedVersion() (int64, error) }
ApplicationQueryState is minimum methods required to service ApplicationState queries.
type ApplicationState ¶
type ApplicationState interface { ApplicationQueryState // InitialHeight returns the initial height. InitialHeight() int64 // StateRootHash returns the last committed block hash. StateRootHash() []byte // ConsensusParameters returns the consensus parameters for the consensus backend itself. // // These always reflect the active parameters for the current block. ConsensusParameters() *consensusGenesis.Parameters // BlockContext returns the current block context which can be used // to store intermediate per-block results. // // This method must only be called from BeginBlock/DeliverTx/EndBlock // and calls from anywhere else will cause races. BlockContext() *BlockContext // GetBaseEpoch returns the base epoch. GetBaseEpoch() (beacon.EpochTime, error) // GetCurrentEpoch returns the epoch at the current block height. GetCurrentEpoch(ctx context.Context) (beacon.EpochTime, error) // EpochChanged returns true iff the current epoch has changed since the // last block. As a matter of convenience, the current epoch is returned. EpochChanged(ctx *Context) (bool, beacon.EpochTime) // LocalMinGasPrice returns the configured local minimum gas price. LocalMinGasPrice() *quantity.Quantity // OwnTxSigner returns the transaction signer identity of the local node. OwnTxSigner() signature.PublicKey // OwnTxSignerAddress returns the transaction signer's staking address of the local node. OwnTxSignerAddress() staking.Address // Upgrader returns the upgrade backend if available. Upgrader() upgrade.Backend // NewContext creates a new application processing context. NewContext(mode ContextMode) *Context }
ApplicationState is the overall past, present and future state of all multiplexed applications.
type Backend ¶
type Backend interface { consensus.Backend // RegisterApplication registers an ABCI multiplexer application // with this service instance and check that its dependencies are // registered. RegisterApplication(Application) error // SetTransactionAuthHandler configures the transaction fee handler for the // ABCI multiplexer. SetTransactionAuthHandler(TransactionAuthHandler) error // GetBlock returns the CometBFT block at the specified height. GetCometBFTBlock(ctx context.Context, height int64) (*cmttypes.Block, error) // GetBlockResults returns the ABCI results from processing a block // at a specific height. GetBlockResults(ctx context.Context, height int64) (*cmtrpctypes.ResultBlockResults, error) // WatchCometBFTBlocks returns a stream of CometBFT blocks as they are // returned via the `EventDataNewBlock` query. WatchCometBFTBlocks() (<-chan *cmttypes.Block, *pubsub.Subscription, error) // GetLastRetainedVersion returns the earliest retained version the ABCI // state. GetLastRetainedVersion(ctx context.Context) (int64, error) // Pruner returns the state pruner. Pruner() StatePruner }
Backend is a CometBFT consensus backend.
type BaseServiceClient ¶
type BaseServiceClient struct{}
BaseServiceClient is a default ServiceClient implementation that provides noop implementations of all the delivery methods. Implementations should override them as needed.
func (*BaseServiceClient) DeliverBlock ¶
func (bsc *BaseServiceClient) DeliverBlock(context.Context, int64) error
DeliverBlock implements ServiceClient.
func (*BaseServiceClient) DeliverCommand ¶
func (bsc *BaseServiceClient) DeliverCommand(context.Context, int64, interface{}) error
DeliverCommand implements ServiceClient.
type BlockContext ¶
type BlockContext struct { BlockInfo // contains filtered or unexported fields }
BlockContext can be used to store arbitrary key/value pairs for state that is needed while processing a block.
When a block is committed, this context is automatically reset.
func NewBlockContext ¶
func NewBlockContext(blockInfo BlockInfo) *BlockContext
NewBlockContext creates a new block context.
func (*BlockContext) Get ¶
func (bc *BlockContext) Get(key BlockContextKey) interface{}
Get returns the value stored under the given key (if any). If no value currently exists, the NewDefault method is called on the key to produce a default value and that value is stored.
func (*BlockContext) Set ¶
func (bc *BlockContext) Set(key BlockContextKey, value interface{})
Set overwrites the value stored under the given key.
type BlockContextKey ¶
type BlockContextKey interface {
// NewDefault returns a new default value for the given key.
NewDefault() interface{}
}
BlockContextKey is an interface for a block context key.
type BlockInfo ¶
type BlockInfo struct { Time time.Time ProposerAddress []byte LastCommitInfo types.CommitInfo ValidatorMisbehavior []types.Misbehavior GasAccountant GasAccountant SystemTransactions []*transaction.Transaction ProvableEvents []events.Provable }
BlockInfo contains information about a block which is always present in block context.
type BlockMeta ¶
type BlockMeta struct { // Header is the CometBFT block header. Header *cmttypes.Header `json:"header"` // LastCommit is the CometBFT last commit info. LastCommit *cmttypes.Commit `json:"last_commit"` }
BlockMeta is the CometBFT-specific per-block metadata that is exposed via the consensus API.
type Context ¶
Context is the context of processing a transaction/block.
func FromCtx ¶
FromCtx extracts an ABCI context from a context.Context if one has been set. Otherwise it returns nil.
func NewContext ¶
func NewContext( ctx context.Context, mode ContextMode, currentTime time.Time, gasAccountant GasAccountant, appState ApplicationState, state mkvs.KeyValueTree, blockHeight int64, blockCtx *BlockContext, initialHeight int64, ) *Context
NewContext creates a new context.
func (*Context) AppState ¶
func (c *Context) AppState() ApplicationState
AppState returns the application state.
Accessing application state in simulation mode is not allowed and will result in a panic.
func (*Context) BlockContext ¶
func (c *Context) BlockContext() *BlockContext
BlockContext returns the current block context.
In case there is no current block (e.g., because the current context is not an execution context), this will return nil.
func (*Context) BlockHeight ¶
BlockHeight returns the current block height.
func (*Context) CallerAddress ¶
CallerAddress returns the authenticated address representing the caller.
func (*Context) Close ¶
func (c *Context) Close()
Close releases all resources associated with this context.
After calling this method, the context should no longer be used.
func (*Context) Commit ¶
Commit commits state updates and emitted events in this transaction child context previously created via NewTransaction. Returns the parent context.
If this is not a transaction child context, the method has no effect.
func (*Context) Data ¶
func (c *Context) Data() interface{}
Data returns the data to be serialized with this output.
func (*Context) DecodeEvent ¶
func (c *Context) DecodeEvent(index int, ev events.TypedAttribute) error
DecodeEvent decodes the given raw event as a specific typed event.
func (*Context) EmitData ¶
func (c *Context) EmitData(data interface{})
EmitData emits data to be serialized as transaction output.
Note: The use of this has mostly been replaced with EmitEvent, please think really carefully if you want to use this.
func (*Context) EmitEvent ¶
func (c *Context) EmitEvent(bld *EventBuilder)
EmitEvent emits an ABCI event for the current transaction/block. Note: If the event has no attributes, this routine will do nothing.
func (*Context) GetPriority ¶
GetPriority returns the current priority. Higher number means higher priority.
func (*Context) HasEvent ¶
func (c *Context) HasEvent(app string, kind events.TypedAttribute) bool
HasEvent checks if a specific event has been emitted.
func (*Context) InitialHeight ¶
InitialHeight returns the initial height.
func (*Context) IsCheckOnly ¶
IsCheckOnly returns true if this is a CheckTx context.
func (*Context) IsInitChain ¶
IsInitChain returns true if this ia an init chain context.
func (*Context) IsMessageExecution ¶
IsMessageExecution returns true if this is a message execution context.
func (*Context) IsSimulation ¶
IsSimulation returns true if this is a simulation-only context.
func (*Context) LastStateRootHash ¶
LastStateRootHash returns the last state root hash.
func (*Context) NewChild ¶
NewChild creates a new child context that shares state with the current context.
If you want isolated state and events use NewTransaction instad.
func (*Context) NewTransaction ¶
NewTransaction creates a new transaction child context.
This automatically starts a new state checkpoint and the context must be explicitly committed by calling Commit otherwise both state and events will be reverted.
NOTE: This does NOT isolate anything other than state and events.
func (*Context) ProvableEvents ¶
ProvableEvents returns the emitted provable events.
func (*Context) SetGasAccountant ¶
func (c *Context) SetGasAccountant(ga GasAccountant)
SetGasAccountant configures the gas accountant on the context.
func (*Context) SetPriority ¶
SetPriority sets the current priority. Higher number means higher priority.
func (*Context) SetTxSigner ¶
SetTxSigner sets the authenticated transaction signer.
This must only be done after verifying the transaction signature.
In case the method is called on a non-transaction context, this method will panic.
func (*Context) State ¶
func (c *Context) State() mkvs.KeyValueTree
State returns the state tree associated with this context.
func (*Context) TxSigner ¶
TxSigner returns the authenticated transaction signer.
In case the method is called on a non-transaction context, this method will panic.
func (*Context) WithCallerAddress ¶
WithCallerAddress creates a child context and sets a specific tx address.
func (*Context) WithMessageExecution ¶
WithMessageExecution creates a child context and sets the message execution flag.
func (*Context) WithSimulation ¶
WithSimulation creates a child context in simulation mode.
Note that state is unchanged -- if you want to prevent propagation of state updates, start a checkpoint manually.
type ContextMode ¶
type ContextMode uint
ContextMode is a context mode.
const ( // ContextInvalid is invalid context and should never be used. ContextInvalid ContextMode = iota // ContextInitChain is InitChain context. ContextInitChain // ContextCheckTx is CheckTx context. ContextCheckTx // ContextDeliverTx is DeliverTx context. ContextDeliverTx // ContextSimulateTx is SimulateTx context. ContextSimulateTx // ContextBeginBlock is BeginBlock context. ContextBeginBlock // ContextEndBlock is EndBlock context. ContextEndBlock )
func (ContextMode) String ¶
func (m ContextMode) String() string
String returns a string representation of the context mode.
type EventBuilder ¶
type EventBuilder struct {
// contains filtered or unexported fields
}
EventBuilder is a helper for constructing ABCI events.
func NewEventBuilder ¶
func NewEventBuilder(app string) *EventBuilder
NewEventBuilder returns a new EventBuilder for the given ABCI app.
func (*EventBuilder) Dirty ¶
func (bld *EventBuilder) Dirty() bool
Dirty returns true iff the EventBuilder has attributes.
func (*EventBuilder) Event ¶
func (bld *EventBuilder) Event() types.Event
Event returns the event from the EventBuilder.
func (*EventBuilder) Provable ¶
func (bld *EventBuilder) Provable() []events.Provable
Provable returns a list of events that are provable.
func (*EventBuilder) TypedAttribute ¶
func (bld *EventBuilder) TypedAttribute(value events.TypedAttribute) *EventBuilder
TypedAttribute appends a typed attribute to the event.
type ExecutorCommitmentNotifier ¶ added in v0.2300.4
type ExecutorCommitmentNotifier interface { // DeliverExecutorCommitment delivers an executor commitment observed // in the consensus layer P2P network. DeliverExecutorCommitment(runtimeID common.Namespace, ec *commitment.ExecutorCommitment) }
ExecutorCommitmentNotifier is an executor commitment notifier interface.
type Extension ¶ added in v0.2400.0
type Extension interface { // Methods returns the list of supported methods. Methods() []transaction.MethodName // OnRegister is the function that is called when the Application // is registered with the multiplexer instance. OnRegister(ApplicationState, MessageDispatcher) // ExecuteTx executes a transaction. ExecuteTx(*Context, *transaction.Transaction) error // InitChain initializes the blockchain with validators and other // info from CometBFT. // // Note: Errors are irrecoverable and will result in a panic. InitChain(*Context, cmtabcitypes.RequestInitChain, *genesis.Document) error // BeginBlock signals the beginning of a block. // // Note: Errors are irrecoverable and will result in a panic. BeginBlock(*Context) error // EndBlock signals the end of a block. // // Note: Errors are irrecoverable and will result in a panic. EndBlock(*Context) error }
Extension is the interface implemented by application-specific extensions.
type GasAccountant ¶
type GasAccountant interface { // UseGas attempts the use the given amount of gas. If the limit is // reached this method will return ErrOutOfGas. // // The actual amount defined by the costs map will be multiplied by // the given multiplier which must be a positive value. UseGas(multiplier int, op transaction.Op, costs transaction.Costs) error // GasWanted returns the amount of gas wanted. GasWanted() transaction.Gas // GasUsed returns the amount of gas used so far. GasUsed() transaction.Gas }
GasAccountant is a gas accountant interface.
func NewCompositeGasAccountant ¶
func NewCompositeGasAccountant(accts ...GasAccountant) GasAccountant
NewCompositeGasAccountant creates a gas accountant that is composed of multiple gas accountants. Any gas used is dispatched to all accountants and if any returns an error, the error is propagated.
The first accountant is used for GasWanted reporting.
func NewGasAccountant ¶
func NewGasAccountant(maxUsedGas transaction.Gas) GasAccountant
NewGasAccountant creates a basic gas accountant.
The gas accountant is not safe for concurrent use.
func NewNopGasAccountant ¶
func NewNopGasAccountant() GasAccountant
NewNopGasAccountant creates a no-op gas accountant that doesn't do any accounting.
type GenesisProvider ¶
type GenesisProvider interface {
GetCometBFTGenesisDocument() (*cmttypes.GenesisDoc, error)
}
GenesisProvider is a CometBFT specific genesis document provider.
type ImmutableState ¶
type ImmutableState struct {
mkvs.ImmutableKeyValueTree
}
ImmutableState is an immutable state wrapper.
func NewImmutableState ¶
func NewImmutableState(ctx context.Context, state ApplicationQueryState, version int64) (*ImmutableState, error)
NewImmutableState creates a new immutable state wrapper.
func (*ImmutableState) CheckContextMode ¶
func (s *ImmutableState) CheckContextMode(ctx context.Context, allowedModes []ContextMode) error
CheckContextMode checks if the passed context is an ABCI context and is using one of the explicitly allowed modes.
func (*ImmutableState) Close ¶
func (s *ImmutableState) Close()
Close releases the resources associated with the immutable state wrapper.
After calling this method, the immutable state wrapper should not be used anymore.
type MessageDispatcher ¶
type MessageDispatcher interface { // Subscribe subscribes a given message subscriber to messages of a specific kind. Subscribe(kind interface{}, ms MessageSubscriber) // Publish publishes a message of a given kind by dispatching to all subscribers. // Subscribers can return a result, but at most one subscriber should return a // non-nil result to any published message. Panics in case more than one subscriber // returns a non-nil result. // // In case there are no subscribers ErrNoSubscribers is returned. Publish(ctx *Context, kind, msg interface{}) (interface{}, error) }
MessageDispatcher is a message dispatcher interface.
type MessageSubscriber ¶
type MessageSubscriber interface { // ExecuteMessage executes a given message. ExecuteMessage(ctx *Context, kind, msg interface{}) (interface{}, error) }
MessageSubscriber is a message subscriber interface.
type MockApplicationState ¶
type MockApplicationState interface { ApplicationState // UpdateMockApplicationStateConfig updates the mock application config. UpdateMockApplicationStateConfig(cfg *MockApplicationStateConfig) }
MockApplicationState is the mock application state interface.
func NewMockApplicationState ¶
func NewMockApplicationState(cfg *MockApplicationStateConfig) MockApplicationState
NewMockApplicationState creates a new mock application state for testing.
type MockApplicationStateConfig ¶
type MockApplicationStateConfig struct { BlockHeight int64 StateRootHash []byte BaseEpoch beacon.EpochTime CurrentEpoch beacon.EpochTime EpochChanged bool MaxBlockGas transaction.Gas MinGasPrice *quantity.Quantity OwnTxSigner signature.PublicKey Genesis *genesis.Document }
MockApplicationStateConfig is the configuration for the mock application state.
type NoopMessageDispatcher ¶
type NoopMessageDispatcher struct{}
NoopMessageDispatcher is a no-op message dispatcher that performs no dispatch.
func (*NoopMessageDispatcher) Publish ¶
func (nd *NoopMessageDispatcher) Publish(*Context, interface{}, interface{}) (interface{}, error)
Publish implements MessageDispatcher.
func (*NoopMessageDispatcher) Subscribe ¶
func (nd *NoopMessageDispatcher) Subscribe(interface{}, MessageSubscriber)
Subscribe implements MessageDispatcher.
type ServiceClient ¶
type ServiceClient interface { // ServiceDescriptor returns the consensus service descriptor. ServiceDescriptor() ServiceDescriptor // DeliverBlock delivers a new block. // // Execution of this method will block delivery of further events. DeliverBlock(ctx context.Context, height int64) error // DeliverEvent delivers an event emitted by the consensus service. DeliverEvent(ctx context.Context, height int64, tx cmttypes.Tx, ev *types.Event) error // DeliverCommand delivers a command emitted via the command channel. DeliverCommand(ctx context.Context, height int64, cmd interface{}) error }
ServiceClient is a consensus service client.
type ServiceDescriptor ¶
type ServiceDescriptor interface { // Name returns the name of this service. Name() string // EventType returns the event type associated with the consensus service. EventType() string // Queries returns a channel that emits queries that need to be subscribed to. Queries() <-chan cmtpubsub.Query // Commands returns a channel that emits commands for the service client. Commands() <-chan interface{} }
ServiceDescriptor is a CometBFT consensus service descriptor.
func NewServiceDescriptor ¶
func NewServiceDescriptor(name, eventType string, queryCh <-chan cmtpubsub.Query, cmdCh <-chan interface{}) ServiceDescriptor
NewServiceDescriptor creates a new consensus service descriptor.
func NewStaticServiceDescriptor ¶
func NewStaticServiceDescriptor(name, eventType string, queries []cmtpubsub.Query) ServiceDescriptor
NewStaticServiceDescriptor creates a new static consensus service descriptor.
type ServiceEvent ¶
type ServiceEvent struct { Block *cmttypes.EventDataNewBlockHeader `json:"block,omitempty"` Tx *cmttypes.EventDataTx `json:"tx,omitempty"` }
ServiceEvent is a CometBFT-specific consensus.ServiceEvent.
type StatePruneHandler ¶
type StatePruneHandler interface { // Prune is called before the specified version is pruned. // // If an error is returned, pruning is aborted and the version is // not pruned from history. // // Note that this can be called for the same version multiple // times (e.g., if one of the handlers fails but others succeed // and pruning is later retried). Prune(version uint64) error }
StatePruneHandler is a handler that is called when versions are pruned from history.
type StatePruner ¶
type StatePruner interface { // RegisterHandler registers a prune handler. RegisterHandler(handler StatePruneHandler) }
StatePruner is a concrete ABCI mux state pruner implementation.
type SubcallInfo ¶ added in v0.2400.0
type SubcallInfo struct { // Caller is the address of the caller. Caller staking.Address // Method is the name of the method that should be invoked. Method transaction.MethodName // Body is the subcall body. Body cbor.RawMessage }
SubcallInfo is the information about a subcall that should be executed.
type TogglableApplication ¶ added in v0.2400.0
type TogglableApplication interface { // Enabled checks whether the application is enabled. Enabled(*Context) (bool, error) }
TogglableApplication is an application that can be disabled.
type TogglableMessageSubscriber ¶ added in v0.2400.0
type TogglableMessageSubscriber interface { // Enabled checks whether the message subscriber is enabled. Enabled(ctx *Context) (bool, error) }
TogglableMessageSubscriber is a message subscriber that can be disabled.
type TransactionAuthHandler ¶
type TransactionAuthHandler interface { consensus.TransactionAuthHandler // AuthenticateTx authenticates the given transaction by making sure // that the nonce is correct and deducts any fees as specified. // // It may reject the transaction in case of incorrect nonces, insufficient // balance to pay fees or (only during CheckTx) if the gas price is too // low. // // The context may be modified to configure a gas accountant. AuthenticateTx(ctx *Context, tx *transaction.Transaction) error // PostExecuteTx is called after the transaction has been executed. It is // only called in case the execution did not produce an error. PostExecuteTx(ctx *Context, tx *transaction.Transaction) error }
TransactionAuthHandler is the interface for ABCI applications that handle authenticating transactions (checking nonces and fees).