Documentation ¶
Index ¶
- Variables
- func NewEventService() event.Service
- func NewGasMeterService() gas.Service
- func NewKVStoreService(address []byte) store.KVStoreService
- func NewMemoryStoreService(address []byte) store.MemoryStoreService
- func NewMsgRouterService(identity transaction.Identity) router.Service
- func NewQueryRouterService() router.Service
- func TypedEventToEvent(tev transaction.Msg) (event.Event, error)
- type BranchService
- type HeaderService
- type MsgRouterBuilder
- func (b *MsgRouterBuilder) HandlerExists(msgType string) bool
- func (b *MsgRouterBuilder) RegisterGlobalPostMsgHandler(handler appmodulev2.PostMsgHandler)
- func (b *MsgRouterBuilder) RegisterGlobalPreMsgHandler(handler appmodulev2.PreMsgHandler)
- func (b *MsgRouterBuilder) RegisterHandler(msgType string, handler appmodulev2.HandlerFunc) error
- func (b *MsgRouterBuilder) RegisterPostMsgHandler(msgType string, handler appmodulev2.PostMsgHandler)
- func (b *MsgRouterBuilder) RegisterPreMsgHandler(msgType string, handler appmodulev2.PreMsgHandler)
- type STF
- func (s STF[T]) DeliverBlock(ctx context.Context, block *server.BlockRequest[T], state store.ReaderMap) (blockResult *server.BlockResponse, newState store.WriterMap, err error)
- func (s STF[T]) DeliverSims(ctx context.Context, block *server.BlockRequest[T], state store.ReaderMap, ...) (blockResult *server.BlockResponse, newState store.WriterMap, err error)
- func (s STF[T]) Query(ctx context.Context, state store.ReaderMap, gasLimit uint64, ...) (transaction.Msg, error)
- func (s STF[T]) Simulate(ctx context.Context, state store.ReaderMap, gasLimit uint64, tx T) (server.TxResult, store.WriterMap)
- func (s STF[T]) ValidateTx(ctx context.Context, state store.ReaderMap, gasLimit uint64, tx T) server.TxResult
Constants ¶
This section is empty.
Variables ¶
var ( // Identity defines STF's bytes identity and it's used by STF to store things in its own state. Identity = []byte("stf") // RuntimeIdentity defines the bytes identity of the runtime. RuntimeIdentity = []byte("runtime") // ConsensusIdentity defines the bytes identity of the consensus. ConsensusIdentity = []byte("consensus") )
var ErrNoHandler = errors.New("no handler")
Functions ¶
func NewEventService ¶
func NewGasMeterService ¶
NewGasMeterService creates a new instance of the gas meter service.
func NewKVStoreService ¶
func NewKVStoreService(address []byte) store.KVStoreService
func NewMemoryStoreService ¶
func NewMemoryStoreService(address []byte) store.MemoryStoreService
func NewMsgRouterService ¶
func NewMsgRouterService(identity transaction.Identity) router.Service
NewMsgRouterService implements router.Service.
func NewQueryRouterService ¶
NewQueryRouterService implements router.Service.
func TypedEventToEvent ¶
func TypedEventToEvent(tev transaction.Msg) (event.Event, error)
TypedEventToEvent takes typed event and converts to Event object
Types ¶
type HeaderService ¶
type HeaderService struct{}
func (HeaderService) HeaderInfo ¶
func (h HeaderService) HeaderInfo(ctx context.Context) header.Info
type MsgRouterBuilder ¶
type MsgRouterBuilder struct {
// contains filtered or unexported fields
}
func NewMsgRouterBuilder ¶
func NewMsgRouterBuilder() *MsgRouterBuilder
NewMsgRouterBuilder is a router that routes messages to their respective handlers.
func (*MsgRouterBuilder) HandlerExists ¶
func (b *MsgRouterBuilder) HandlerExists(msgType string) bool
func (*MsgRouterBuilder) RegisterGlobalPostMsgHandler ¶
func (b *MsgRouterBuilder) RegisterGlobalPostMsgHandler(handler appmodulev2.PostMsgHandler)
func (*MsgRouterBuilder) RegisterGlobalPreMsgHandler ¶
func (b *MsgRouterBuilder) RegisterGlobalPreMsgHandler(handler appmodulev2.PreMsgHandler)
func (*MsgRouterBuilder) RegisterHandler ¶
func (b *MsgRouterBuilder) RegisterHandler(msgType string, handler appmodulev2.HandlerFunc) error
func (*MsgRouterBuilder) RegisterPostMsgHandler ¶
func (b *MsgRouterBuilder) RegisterPostMsgHandler(msgType string, handler appmodulev2.PostMsgHandler)
func (*MsgRouterBuilder) RegisterPreMsgHandler ¶
func (b *MsgRouterBuilder) RegisterPreMsgHandler(msgType string, handler appmodulev2.PreMsgHandler)
type STF ¶
type STF[T transaction.Tx] struct { // contains filtered or unexported fields }
STF is a struct that manages the state transition component of the app.
func New ¶
func New[T transaction.Tx]( logger log.Logger, msgRouterBuilder *MsgRouterBuilder, queryRouterBuilder *MsgRouterBuilder, doPreBlock func(ctx context.Context, txs []T) error, doBeginBlock func(ctx context.Context) error, doEndBlock func(ctx context.Context) error, doTxValidation func(ctx context.Context, tx T) error, doValidatorUpdate func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error), postTxExec func(ctx context.Context, tx T, success bool) error, branch func(store store.ReaderMap) store.WriterMap, ) (*STF[T], error)
New returns a new STF instance.
func (STF[T]) DeliverBlock ¶
func (s STF[T]) DeliverBlock( ctx context.Context, block *server.BlockRequest[T], state store.ReaderMap, ) (blockResult *server.BlockResponse, newState store.WriterMap, err error)
DeliverBlock is our state transition function. It takes a read only view of the state to apply the block to, executes the block and returns the block results and the new state.
func (STF[T]) DeliverSims ¶
func (s STF[T]) DeliverSims( ctx context.Context, block *server.BlockRequest[T], state store.ReaderMap, simsBuilder func(ctx context.Context) iter.Seq[T], ) (blockResult *server.BlockResponse, newState store.WriterMap, err error)
DeliverSims entrypoint to processes sims transactions similar to DeliverBlock.
func (STF[T]) Query ¶
func (s STF[T]) Query( ctx context.Context, state store.ReaderMap, gasLimit uint64, req transaction.Msg, ) (transaction.Msg, error)
Query executes the query on the provided state with the provided gas limits.