Skip to content

Commit 82d7143

Browse files
committed
patcher
1 parent 9189c2b commit 82d7143

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

app/app.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,14 +810,15 @@ func NewEthermintApp(
810810
app.ScopedTransferKeeper = scopedTransferKeeper
811811

812812
executor := cast.ToString(appOpts.Get(server.FlagBlockSTMExecutor))
813+
app.SetTxResponsePatcher(evmtypes.EvmTxResponsePatcher{})
813814
switch executor {
814815
case config.BlockExecutorBlockSTM:
815816
sdk.SetAddrCacheEnabled(false)
816817
workers := cast.ToInt(appOpts.Get(server.FlagBlockSTMWorkers))
817818
preEstimate := cast.ToBool(appOpts.Get(server.FlagBlockSTMPreEstimate))
818819
app.SetTxExecutor(STMTxExecutor(app.GetStoreKeys(), workers, preEstimate, app.EvmKeeper, txConfig.TxDecoder()))
819820
case "", config.BlockExecutorSequential:
820-
app.SetTxExecutor(DefaultTxExecutor)
821+
app.SetTxExecutor(baseapp.DefaultTxExecutor)
821822
default:
822823
panic(fmt.Errorf("unknown EVM block executor: %s", executor))
823824
}

app/executor.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@ import (
2222
blockstm "github.com/crypto-org-chain/go-block-stm"
2323
)
2424

25-
func DefaultTxExecutor(_ context.Context,
26-
txs [][]byte,
27-
ms storetypes.MultiStore,
28-
deliverTxWithMultiStore func(int, sdk.Tx, storetypes.MultiStore, map[string]any) *abci.ExecTxResult,
29-
) ([]*abci.ExecTxResult, error) {
30-
blockSize := len(txs)
31-
results := make([]*abci.ExecTxResult, blockSize)
32-
for i := 0; i < blockSize; i++ {
33-
results[i] = deliverTxWithMultiStore(i, nil, ms, nil)
34-
}
35-
return evmtypes.PatchTxResponses(results), nil
36-
}
37-
3825
type evmKeeper interface {
3926
GetParams(ctx sdk.Context) evmtypes.Params
4027
}
@@ -62,6 +49,7 @@ func STMTxExecutor(
6249
txs [][]byte,
6350
ms storetypes.MultiStore,
6451
deliverTxWithMultiStore func(int, sdk.Tx, storetypes.MultiStore, map[string]any) *abci.ExecTxResult,
52+
patcher baseapp.TxResponsePatcher,
6553
) ([]*abci.ExecTxResult, error) {
6654
blockSize := len(txs)
6755
if blockSize == 0 {
@@ -115,7 +103,7 @@ func STMTxExecutor(
115103
return nil, err
116104
}
117105

118-
return evmtypes.PatchTxResponses(results), nil
106+
return patcher.Patch(results), nil
119107
}
120108
}
121109

x/evm/types/response.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import (
99
proto "github.com/cosmos/gogoproto/proto"
1010
)
1111

12+
type EvmTxResponsePatcher struct{}
13+
14+
func (p EvmTxResponsePatcher) Patch(input []*abci.ExecTxResult) []*abci.ExecTxResult {
15+
return PatchTxResponses(input)
16+
}
17+
1218
// PatchTxResponses fills the evm tx index and log indexes in the tx result
1319
func PatchTxResponses(input []*abci.ExecTxResult) []*abci.ExecTxResult {
1420
var (

0 commit comments

Comments
 (0)