Documentation ¶
Overview ¶
Package abci implements the CometBFT ABCI application integration.
Index ¶
- Constants
- func InitStateStorage(cfg *ApplicationConfig) (storage.LocalBackend, storage.NodeDB, *storage.Root, error)
- type ApplicationConfig
- type ApplicationServer
- func (a *ApplicationServer) Cleanup()
- func (a *ApplicationServer) EstimateGas(caller signature.PublicKey, tx *transaction.Transaction) (transaction.Gas, error)
- func (a *ApplicationServer) Mux() types.Application
- func (a *ApplicationServer) Pruner() api.StatePruner
- func (a *ApplicationServer) Quit() <-chan struct{}
- func (a *ApplicationServer) Register(app api.Application) error
- func (a *ApplicationServer) RegisterHaltHook(hook consensus.HaltHook)
- func (a *ApplicationServer) SetEpochtime(epochTime beacon.Backend) error
- func (a *ApplicationServer) SetTransactionAuthHandler(handler api.TransactionAuthHandler) error
- func (a *ApplicationServer) Start() error
- func (a *ApplicationServer) State() api.ApplicationQueryState
- func (a *ApplicationServer) Stop()
- func (a *ApplicationServer) TransactionAuthHandler() api.TransactionAuthHandler
- func (a *ApplicationServer) WatchInvalidatedTx(txHash hash.Hash) (<-chan error, pubsub.ClosableSubscription, error)
- type MockABCIMux
- func (mux MockABCIMux) ApplySnapshotChunk(req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk
- func (mux MockABCIMux) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
- func (mux MockABCIMux) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
- func (mux MockABCIMux) Commit() types.ResponseCommit
- func (mux MockABCIMux) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
- func (mux MockABCIMux) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
- func (mux MockABCIMux) EstimateGas(caller signature.PublicKey, tx *transaction.Transaction) (transaction.Gas, error)
- func (mux MockABCIMux) Info(types.RequestInfo) types.ResponseInfo
- func (mux MockABCIMux) InitChain(req types.RequestInitChain) types.ResponseInitChain
- func (mux MockABCIMux) ListSnapshots(types.RequestListSnapshots) types.ResponseListSnapshots
- func (mux MockABCIMux) LoadSnapshotChunk(req types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk
- func (mux *MockABCIMux) MockClose()
- func (mux *MockABCIMux) MockRegisterApp(app api.Application) error
- func (mux *MockABCIMux) MockSetEpochtime(epochTime beacon.Backend)
- func (mux *MockABCIMux) MockSetTransactionAuthHandler(handler api.TransactionAuthHandler)
- func (mux MockABCIMux) OfferSnapshot(req types.RequestOfferSnapshot) types.ResponseOfferSnapshot
- func (mux MockABCIMux) PrepareProposal(req types.RequestPrepareProposal) types.ResponsePrepareProposal
- func (mux MockABCIMux) ProcessProposal(req types.RequestProcessProposal) (resp types.ResponseProcessProposal)
- type PruneConfig
- type PruneStrategy
- type StatePruner
Constants ¶
const ( // LogEventABCIPruneDelete is a log event value that signals an ABCI pruning // delete event. LogEventABCIPruneDelete = "cometbft/abci/prune" )
const ( // LogEventABCIStateSyncComplete is a log event value that signals an ABCI state syncing // completed event. LogEventABCIStateSyncComplete = "cometbft/abci/state_sync_complete" )
Variables ¶
This section is empty.
Functions ¶
func InitStateStorage ¶
func InitStateStorage(cfg *ApplicationConfig) (storage.LocalBackend, storage.NodeDB, *storage.Root, error)
InitStateStorage initializes the internal ABCI state storage.
Types ¶
type ApplicationConfig ¶
type ApplicationConfig struct { DataDir string StorageBackend string Pruning PruneConfig HaltEpoch beacon.EpochTime HaltHeight uint64 MinGasPrice uint64 DisableCheckpointer bool CheckpointerCheckInterval time.Duration // Identity is the local node identity. Identity *identity.Identity // MemoryOnlyStorage forces in-memory storage to be used for the state storage. MemoryOnlyStorage bool // ReadOnlyStorage forces read-only access for the state storage. ReadOnlyStorage bool // InitialHeight is the height of the initial block. InitialHeight uint64 // ChainContext is the chain context for the network. ChainContext string }
ApplicationConfig is the configuration for the consensus application.
type ApplicationServer ¶
type ApplicationServer struct {
// contains filtered or unexported fields
}
ApplicationServer implements a CometBFT ABCI application + socket server, that multiplexes multiple Oasis-specific "applications".
func NewApplicationServer ¶
func NewApplicationServer(ctx context.Context, upgrader upgrade.Backend, cfg *ApplicationConfig) (*ApplicationServer, error)
NewApplicationServer returns a new ApplicationServer, using the provided directory to persist state.
func (*ApplicationServer) Cleanup ¶
func (a *ApplicationServer) Cleanup()
Cleanup cleans up the state of an ApplicationServer instance.
func (*ApplicationServer) EstimateGas ¶
func (a *ApplicationServer) EstimateGas(caller signature.PublicKey, tx *transaction.Transaction) (transaction.Gas, error)
EstimateGas calculates the amount of gas required to execute the given transaction.
func (*ApplicationServer) Mux ¶
func (a *ApplicationServer) Mux() types.Application
Mux retrieve the abci Mux (or CometBFT application) served by this server.
func (*ApplicationServer) Pruner ¶
func (a *ApplicationServer) Pruner() api.StatePruner
Pruner returns the state pruner.
func (*ApplicationServer) Quit ¶
func (a *ApplicationServer) Quit() <-chan struct{}
Quit returns a channel which is closed when the ApplicationServer is stopped.
func (*ApplicationServer) Register ¶
func (a *ApplicationServer) Register(app api.Application) error
Register registers an Oasis application with the ABCI multiplexer.
All registration must be done before Start is called. ABCI operations that act on every single app (InitChain, BeginBlock, EndBlock) will be called in name lexicographic order. Checks that applications named in deps are already registered.
func (*ApplicationServer) RegisterHaltHook ¶
func (a *ApplicationServer) RegisterHaltHook(hook consensus.HaltHook)
RegisterHaltHook registers a function to be called when the consensus Halt epoch height is reached.
func (*ApplicationServer) SetEpochtime ¶
func (a *ApplicationServer) SetEpochtime(epochTime beacon.Backend) error
SetEpochtime sets the mux epochtime.
Epochtime must be set before the multiplexer can be used.
func (*ApplicationServer) SetTransactionAuthHandler ¶
func (a *ApplicationServer) SetTransactionAuthHandler(handler api.TransactionAuthHandler) error
SetTransactionAuthHandler configures the transaction auth handler for the ABCI multiplexer.
func (*ApplicationServer) Start ¶
func (a *ApplicationServer) Start() error
Start starts the ApplicationServer.
func (*ApplicationServer) State ¶
func (a *ApplicationServer) State() api.ApplicationQueryState
State returns the application state.
func (*ApplicationServer) Stop ¶
func (a *ApplicationServer) Stop()
Stop stops the ApplicationServer.
func (*ApplicationServer) TransactionAuthHandler ¶
func (a *ApplicationServer) TransactionAuthHandler() api.TransactionAuthHandler
TransactionAuthHandler returns the configured handler for authenticating transactions.
func (*ApplicationServer) WatchInvalidatedTx ¶
func (a *ApplicationServer) WatchInvalidatedTx(txHash hash.Hash) (<-chan error, pubsub.ClosableSubscription, error)
WatchInvalidatedTx adds a watcher for when/if the transaction with given hash becomes invalid due to a failed re-check.
type MockABCIMux ¶
type MockABCIMux struct {
// contains filtered or unexported fields
}
MockABCIMux exports some of the muxer's internal methods for testing use.
func NewMockMux ¶
func NewMockMux(ctx context.Context, upgrader upgrade.Backend, cfg *ApplicationConfig) (*MockABCIMux, error)
NewMockMux creates a new ABCI mux suitable for testing.
func (MockABCIMux) ApplySnapshotChunk ¶
func (mux MockABCIMux) ApplySnapshotChunk(req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk
func (MockABCIMux) BeginBlock ¶
func (mux MockABCIMux) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
func (MockABCIMux) CheckTx ¶
func (mux MockABCIMux) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
func (MockABCIMux) Commit ¶
func (mux MockABCIMux) Commit() types.ResponseCommit
func (MockABCIMux) DeliverTx ¶
func (mux MockABCIMux) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
func (MockABCIMux) EndBlock ¶
func (mux MockABCIMux) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
func (MockABCIMux) EstimateGas ¶
func (mux MockABCIMux) EstimateGas(caller signature.PublicKey, tx *transaction.Transaction) (transaction.Gas, error)
func (MockABCIMux) Info ¶
func (mux MockABCIMux) Info(types.RequestInfo) types.ResponseInfo
func (MockABCIMux) InitChain ¶
func (mux MockABCIMux) InitChain(req types.RequestInitChain) types.ResponseInitChain
func (MockABCIMux) ListSnapshots ¶
func (mux MockABCIMux) ListSnapshots(types.RequestListSnapshots) types.ResponseListSnapshots
func (MockABCIMux) LoadSnapshotChunk ¶
func (mux MockABCIMux) LoadSnapshotChunk(req types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk
func (*MockABCIMux) MockClose ¶
func (mux *MockABCIMux) MockClose()
MockClose cleans up the muxer's state; it must be called once the muxer is no longer needed.
func (*MockABCIMux) MockRegisterApp ¶
func (mux *MockABCIMux) MockRegisterApp(app api.Application) error
MockRegisterApp is used to register apps with this muxer during testing.
func (*MockABCIMux) MockSetEpochtime ¶
func (mux *MockABCIMux) MockSetEpochtime(epochTime beacon.Backend)
MockSetEpochtime sets the timesource used by this muxer when testing.
func (*MockABCIMux) MockSetTransactionAuthHandler ¶
func (mux *MockABCIMux) MockSetTransactionAuthHandler(handler api.TransactionAuthHandler)
MockSetTransactionAuthHandler sets the transaction auth hander used by this muxer when testing.
func (MockABCIMux) OfferSnapshot ¶
func (mux MockABCIMux) OfferSnapshot(req types.RequestOfferSnapshot) types.ResponseOfferSnapshot
func (MockABCIMux) PrepareProposal ¶
func (mux MockABCIMux) PrepareProposal(req types.RequestPrepareProposal) types.ResponsePrepareProposal
func (MockABCIMux) ProcessProposal ¶
func (mux MockABCIMux) ProcessProposal(req types.RequestProcessProposal) (resp types.ResponseProcessProposal)
type PruneConfig ¶
type PruneConfig struct { // Strategy is the PruneStrategy used. Strategy PruneStrategy // NumKept is the number of versions retained when applicable. NumKept uint64 // PruneInterval configures the pruning interval. PruneInterval time.Duration }
PruneConfig is the pruning strategy and related configuration.
type PruneStrategy ¶
type PruneStrategy int
PruneStrategy is the strategy to use when pruning the ABCI mux state.
const ( // PruneNone retains all versions. PruneNone PruneStrategy = iota // PruneKeepN retains the last N latest versions. PruneKeepN )
func (*PruneStrategy) FromString ¶
func (s *PruneStrategy) FromString(str string) error
func (PruneStrategy) String ¶
func (s PruneStrategy) String() string
type StatePruner ¶
type StatePruner interface { api.StatePruner // Prune purges unneeded versions from the ABCI mux node database, // given the latest version, based on the underlying strategy. // // This method is NOT safe for concurrent use. Prune(ctx context.Context, latestVersion uint64) error // GetLastRetainedVersion returns the earliest version below which all // versions can be discarded from block history. Zero indicates that // no versions can be discarded. // // This method can be called concurrently with Prune. GetLastRetainedVersion() uint64 }
StatePruner is a concrete ABCI mux state pruner implementation.