Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Dec 11, 2024
1 parent 1526ab9 commit 1271519
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 27 deletions.
9 changes: 6 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,9 @@ func NewEthermintApp(
preEstimate := cast.ToBool(appOpts.Get(server.FlagBlockSTMPreEstimate))
txDecoder := txConfig.TxDecoder()
stores := app.GetStoreKeys()
app.SetTxExecutor(baseapp.STMTxExecutor(stores, workers, preEstimate, txDecoder,
func(txs [][]byte, workers int, txDecoder sdk.TxDecoder, ms storetypes.MultiStore) ([]sdk.Tx, []blockstm.MultiLocations) {
var preEstimateFn func(txs [][]byte, workers int, txDecoder sdk.TxDecoder, ms storetypes.MultiStore) ([]sdk.Tx, []blockstm.MultiLocations)
if preEstimate {
preEstimateFn = func(txs [][]byte, workers int, txDecoder sdk.TxDecoder, ms storetypes.MultiStore) ([]sdk.Tx, []blockstm.MultiLocations) {
var authStore, bankStore int
index := make(map[storetypes.StoreKey]int, len(stores))
for i, k := range stores {
Expand All @@ -835,7 +836,9 @@ func NewEthermintApp(
}
evmDenom := app.EvmKeeper.GetParams(sdk.NewContext(ms, cmtproto.Header{}, false, log.NewNopLogger())).EvmDenom
return preEstimates(txs, workers, authStore, bankStore, evmDenom, txDecoder)

Check warning on line 838 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L837-L838

Added lines #L837 - L838 were not covered by tests
}))
}
}
app.SetTxExecutor(baseapp.STMTxExecutor(stores, workers, txDecoder, preEstimateFn))

Check warning on line 841 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L841

Added line #L841 was not covered by tests
case "", config.BlockExecutorSequential:
app.SetTxExecutor(baseapp.DefaultTxExecutor)
default:
Expand Down
5 changes: 0 additions & 5 deletions app/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@ import (
"cosmossdk.io/collections"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"

sdk "github.com/cosmos/cosmos-sdk/types"

blockstm "github.com/crypto-org-chain/go-block-stm"
)

type evmKeeper interface {
GetParams(ctx sdk.Context) evmtypes.Params
}

// preEstimates returns a static estimation of the written keys for each transaction.
// NOTE: make sure it sync with the latest sdk logic when sdk upgrade.
func preEstimates(txs [][]byte, workers, authStore, bankStore int, evmDenom string, txDecoder sdk.TxDecoder) ([]sdk.Tx, []blockstm.MultiLocations) {
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ require (

replace (
// release/v0.50.x
cosmossdk.io/store => github.com/mmsqe/cosmos-sdk/store v0.0.0-20241211071648-a1364555c691
cosmossdk.io/x/tx => github.com/mmsqe/cosmos-sdk/x/tx v0.0.0-20241211071648-a1364555c691
github.com/cosmos/cosmos-sdk => github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20241211071648-a1364555c691
cosmossdk.io/store => github.com/mmsqe/cosmos-sdk/store v0.0.0-20241211125221-bdd2a717b727
cosmossdk.io/x/tx => github.com/mmsqe/cosmos-sdk/x/tx v0.0.0-20241211125221-bdd2a717b727
github.com/cosmos/cosmos-sdk => github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20241211125221-bdd2a717b727
)

replace (
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -867,12 +867,12 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20241211071648-a1364555c691 h1:dsHxkRgPYkpvULAmatJuZestt/AR6g3B9MMnlgJfbG0=
github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20241211071648-a1364555c691/go.mod h1:u+LHV+8Y4uVyVbAGNxWjLYuP3vYXVqTJCk0dx3uC0pM=
github.com/mmsqe/cosmos-sdk/store v0.0.0-20241211071648-a1364555c691 h1:b2RwVoB5zHr+GqrPGiVe3mVxFwEaOPwUIVIxb8DAL+w=
github.com/mmsqe/cosmos-sdk/store v0.0.0-20241211071648-a1364555c691/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
github.com/mmsqe/cosmos-sdk/x/tx v0.0.0-20241211071648-a1364555c691 h1:iMghgVFWtj/BgTluwUcN9sHXxnbPsktiWVM5Wl8ImWk=
github.com/mmsqe/cosmos-sdk/x/tx v0.0.0-20241211071648-a1364555c691/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20241211125221-bdd2a717b727 h1:udBg1BHe3JqWzaSVCKv5cFz1E6CzBbH/b+MZ7P6qHqc=
github.com/mmsqe/cosmos-sdk v0.46.0-beta2.0.20241211125221-bdd2a717b727/go.mod h1:bkUh1YaLvBd4WAYd8iE0xwpHecaqH8A7vg6v/YCj0yo=
github.com/mmsqe/cosmos-sdk/store v0.0.0-20241211125221-bdd2a717b727 h1:tBO96f5iFZkDQ9iaCQDOo1LqkaPnK3qkWu5YPf2HCH0=
github.com/mmsqe/cosmos-sdk/store v0.0.0-20241211125221-bdd2a717b727/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
github.com/mmsqe/cosmos-sdk/x/tx v0.0.0-20241211125221-bdd2a717b727 h1:44ZCPtIljY5TX30Zrllv8zADd5Mie0l0/UQPIaoLXrQ=
github.com/mmsqe/cosmos-sdk/x/tx v0.0.0-20241211125221-bdd2a717b727/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
Expand Down
10 changes: 5 additions & 5 deletions gomod2nix.toml

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions x/evm/types/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ import (

type EvmTxResponsePatcher struct{}

// Patch fills the evm tx index and log indexes in the tx result
func (p EvmTxResponsePatcher) Patch(input []*abci.ExecTxResult) []*abci.ExecTxResult {

Check warning on line 15 in x/evm/types/response.go

View check run for this annotation

Codecov / codecov/patch

x/evm/types/response.go#L15

Added line #L15 was not covered by tests
return PatchTxResponses(input)
}

// PatchTxResponses fills the evm tx index and log indexes in the tx result
func PatchTxResponses(input []*abci.ExecTxResult) []*abci.ExecTxResult {
var (
txIndex uint64
logIndex uint64
Expand Down

0 comments on commit 1271519

Please sign in to comment.