abci

package
v0.2202.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package abci implements the tendermint ABCI application integration.

Index

Constants

View Source
const (
	// StateKeyGenesisDigest is the state key where the genesis digest
	// aka chain context is stored.
	StateKeyGenesisDigest = "OasisGenesisDigest"

	// LogEventABCIStateSyncComplete is a log event value that signals an ABCI state syncing
	// completed event.
	LogEventABCIStateSyncComplete = "tendermint/abci/state_sync_complete"
)
View Source
const (
	// PruneDefault is the default PruneStrategy.
	PruneDefault = pruneNone

	// LogEventABCIPruneDelete is a log event value that signals an ABCI pruning
	// delete event.
	LogEventABCIPruneDelete = "tendermint/abci/prune"
)

Variables

This section is empty.

Functions

func InitStateStorage

InitStateStorage initializes the internal ABCI state storage.

Types

type ApplicationConfig

type ApplicationConfig struct {
	DataDir         string
	StorageBackend  string
	Pruning         PruneConfig
	HaltEpochHeight beacon.EpochTime
	HaltBlockHeight uint64
	MinGasPrice     uint64

	DisableCheckpointer       bool
	CheckpointerCheckInterval time.Duration

	// OwnTxSigner is the transaction signer identity of the local node.
	OwnTxSigner signature.PublicKey

	// 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
}

ApplicationConfig is the configuration for the consensus application.

type ApplicationServer

type ApplicationServer struct {
	// contains filtered or unexported fields
}

ApplicationServer implements a tendermint 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

EstimateGas calculates the amount of gas required to execute the given transaction.

func (*ApplicationServer) Mux

Mux retrieve the abci Mux (or tendermint application) served by this server.

func (*ApplicationServer) Pruner added in v0.2200.0

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

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(req types.RequestInfo) types.ResponseInfo

func (MockABCIMux) InitChain

func (mux MockABCIMux) InitChain(req types.RequestInitChain) types.ResponseInitChain

func (MockABCIMux) ListSnapshots

func (mux MockABCIMux) ListSnapshots(req 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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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