diff --git a/baseapp/abci.go b/baseapp/abci.go index e52dd2359..f8d21bcd5 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -234,9 +234,23 @@ func (app *BaseApp) CheckTx(ctx context.Context, req *abci.RequestCheckTx) (*abc }, nil } +// DeliverTxBatch executes multiple txs +// TODO: support occ logic with scheduling +func (app *BaseApp) DeliverTxBatch(ctx sdk.Context, req sdk.DeliverTxBatchRequest) (res sdk.DeliverTxBatchResponse) { + // TODO: replace with actual scheduler logic + // This is stubbed so that it does something sensible + responses := make([]*sdk.DeliverTxResult, 0, len(req.TxEntries)) + for _, tx := range req.TxEntries { + responses = append(responses, &sdk.DeliverTxResult{ + Response: app.DeliverTx(ctx, tx.Request), + }) + } + return sdk.DeliverTxBatchResponse{Results: responses} +} + // DeliverTx implements the ABCI interface and executes a tx in DeliverTx mode. // State only gets persisted if all messages are valid and get executed successfully. -// Otherwise, the ResponseDeliverTx will contain releveant error information. +// Otherwise, the ResponseDeliverTx will contain relevant error information. // Regardless of tx execution outcome, the ResponseDeliverTx will contain relevant // gas execution context. // TODO: (occ) this is the function called from sei-chain to perform execution of a transaction. diff --git a/types/tx_batch.go b/types/tx_batch.go new file mode 100644 index 000000000..a54742fae --- /dev/null +++ b/types/tx_batch.go @@ -0,0 +1,27 @@ +package types + +import abci "github.com/tendermint/tendermint/abci/types" + +// DeliverTxEntry represents an individual transaction's request within a batch. +// This can be extended to include tx-level tracing or metadata +type DeliverTxEntry struct { + Request abci.RequestDeliverTx +} + +// DeliverTxBatchRequest represents a request object for a batch of transactions. +// This can be extended to include request-level tracing or metadata +type DeliverTxBatchRequest struct { + TxEntries []*DeliverTxEntry +} + +// DeliverTxResult represents an individual transaction's response within a batch. +// This can be extended to include tx-level tracing or metadata +type DeliverTxResult struct { + Response abci.ResponseDeliverTx +} + +// DeliverTxBatchResponse represents a response object for a batch of transactions. +// This can be extended to include response-level tracing or metadata +type DeliverTxBatchResponse struct { + Results []*DeliverTxResult +}