handlers

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppManager

type AppManager[T transaction.Tx] interface {
	ValidateTx(ctx context.Context, tx T) (server.TxResult, error)
	Query(ctx context.Context, version uint64, request transaction.Msg) (response transaction.Msg, err error)
}

type CheckTxHandler

type CheckTxHandler[T transaction.Tx] func(func(ctx context.Context, tx T) (server.TxResult, error)) (*abci.CheckTxResponse, error)

CheckTxHandler is a function type that handles the execution of a transaction.

type DefaultProposalHandler

type DefaultProposalHandler[T transaction.Tx] struct {
	// contains filtered or unexported fields
}

func NewDefaultProposalHandler

func NewDefaultProposalHandler[T transaction.Tx](mp mempool.Mempool[T]) *DefaultProposalHandler[T]

func (*DefaultProposalHandler[T]) PrepareHandler

func (h *DefaultProposalHandler[T]) PrepareHandler() PrepareHandler[T]

func (*DefaultProposalHandler[T]) ProcessHandler

func (h *DefaultProposalHandler[T]) ProcessHandler() ProcessHandler[T]

type ExtendVoteHandler

ExtendVoteHandler is a function type that handles the extension of a vote. It takes a context, a store reader map, and a request to extend a vote. It returns a response to extend the vote and an error if any.

func NoOpExtendVote

func NoOpExtendVote() ExtendVoteHandler

NoOpExtendVote defines a no-op ExtendVote handler. It will always return an empty byte slice as the vote extension.

type PrepareHandler

type PrepareHandler[T transaction.Tx] func(ctx context.Context, app AppManager[T], cdc transaction.Codec[T], req *abci.PrepareProposalRequest, chainID string) ([]T, error)

PrepareHandler passes in the list of Txs that are being proposed. The app can then do stateful operations over the list of proposed transactions. It can return a modified list of txs to include in the proposal.

func NoOpPrepareProposal

func NoOpPrepareProposal[T transaction.Tx]() PrepareHandler[T]

NoOpPrepareProposal defines a no-op PrepareProposal handler. It will always return the transactions sent by the client's request.

type ProcessHandler

type ProcessHandler[T transaction.Tx] func(ctx context.Context, app AppManager[T], cdc transaction.Codec[T], req *abci.ProcessProposalRequest, chainID string) error

ProcessHandler is a function that takes a list of transactions and returns a boolean and an error. If the verification of a transaction fails, the boolean is false and the error is non-nil.

func NoOpProcessProposal

func NoOpProcessProposal[T transaction.Tx]() ProcessHandler[T]

NoOpProcessProposal defines a no-op ProcessProposal Handler. It will always return ACCEPT.

type TxSelector

type TxSelector[T transaction.Tx] interface {
	// SelectedTxs should return a copy of the selected transactions.
	SelectedTxs(ctx context.Context) []T

	// Clear should clear the TxSelector, nulling out all relevant fields.
	Clear()

	// SelectTxForProposal should attempt to select a transaction for inclusion in
	// a proposal based on inclusion criteria defined by the TxSelector. It must
	// return <true> if the caller should halt the transaction selection loop
	// (typically over a mempool) or <false> otherwise.
	SelectTxForProposal(ctx context.Context, maxTxBytes, maxBlockGas uint64, tx T) bool
}

TxSelector defines a helper type that assists in selecting transactions during mempool transaction selection in PrepareProposal. It keeps track of the total number of bytes and total gas of the selected transactions. It also keeps track of the selected transactions themselves.

func NewDefaultTxSelector

func NewDefaultTxSelector[T transaction.Tx]() TxSelector[T]

type VerifyVoteExtensionHandler

VerifyVoteExtensionHandler is a function type that handles the verification of a vote extension request. It takes a context, a store reader map, and a request to verify a vote extension. It returns a response to verify the vote extension and an error if any.

func NoOpVerifyVoteExtensionHandler

func NoOpVerifyVoteExtensionHandler() VerifyVoteExtensionHandler

NoOpVerifyVoteExtensionHandler defines a no-op VerifyVoteExtension handler. It will always return an ACCEPT status with no error.

Jump to

Keyboard shortcuts

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