diff --git a/baseapp/txexecutor.go b/baseapp/txexecutor.go index 64263ee08a8c..22f98d6cfb45 100644 --- a/baseapp/txexecutor.go +++ b/baseapp/txexecutor.go @@ -87,65 +87,9 @@ func DefaultTxExecutor(_ context.Context, return nil, nil } -func DefaultSTMTxExecutor( - stores []types.StoreKey, - workers int, - txDecoder sdk.TxDecoder, -) TxExecutor { - index := make(map[types.StoreKey]int, len(stores)) - for i, k := range stores { - index[k] = i - } - return func( - ctx context.Context, - txs [][]byte, - ms types.MultiStore, - deliverTxWithMultiStore func(int, sdk.Tx, types.MultiStore, map[string]any) *abci.ExecTxResult, - patcher TxResponsePatcher, - ) ([]*abci.ExecTxResult, error) { - blockSize := len(txs) - if blockSize == 0 { - return nil, nil - } - results := make([]*abci.ExecTxResult, blockSize) - incarnationCache := make([]atomic.Pointer[map[string]any], blockSize) - for i := 0; i < blockSize; i++ { - m := make(map[string]any) - incarnationCache[i].Store(&m) - } - - if err := blockstm.ExecuteBlock( - ctx, - blockSize, - index, - stmMultiStoreWrapper{ms}, - workers, - func(txn blockstm.TxnIndex, ms blockstm.MultiStore) { - var cache map[string]any - // only one of the concurrent incarnations gets the cache if there are any, otherwise execute without - // cache, concurrent incarnations should be rare. - v := incarnationCache[txn].Swap(nil) - if v != nil { - cache = *v - } - results[txn] = deliverTxWithMultiStore(int(txn), nil, msWrapper{ms}, cache) - - if v != nil { - incarnationCache[txn].Store(v) - } - }, - ); err != nil { - return nil, err - } - - return patcher.Patch(results), nil - } -} - func STMTxExecutor( stores []types.StoreKey, workers int, - estimate bool, txDecoder sdk.TxDecoder, preEstimates func(txs [][]byte, workers int, txDecoder sdk.TxDecoder, ms types.MultiStore) ([]sdk.Tx, []blockstm.MultiLocations), ) TxExecutor { @@ -175,7 +119,7 @@ func STMTxExecutor( estimates []blockstm.MultiLocations memTxs []sdk.Tx ) - if estimate { + if preEstimates != nil { // pre-estimation memTxs, estimates = preEstimates(txs, workers, txDecoder, ms) } diff --git a/server/config/config.go b/server/config/config.go index 4d21aca4a114..0218a74affe5 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -307,7 +307,7 @@ func (c Config) ValidateBasic() error { "cannot enable state sync snapshots with '%s' pruning setting", pruningtypes.PruningOptionEverything, ) } - var blockExecutors = []string{BlockExecutorSequential, BlockExecutorBlockSTM} + blockExecutors := []string{BlockExecutorSequential, BlockExecutorBlockSTM} if c.BlockSTM.Executor != "" && !strings.StringInSlice(c.BlockSTM.Executor, blockExecutors) { return fmt.Errorf("invalid block executor type %s, available types: %v", c.BlockSTM.Executor, blockExecutors) }