Skip to content

Commit 2f44dde

Browse files
author
HuangYi
committed
cleanup
1 parent 069eff5 commit 2f44dde

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

app/app.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ import (
132132
"github.com/evmos/ethermint/app/ante"
133133
"github.com/evmos/ethermint/encoding"
134134
"github.com/evmos/ethermint/ethereum/eip712"
135+
srvconfig "github.com/evmos/ethermint/server/config"
135136
srvflags "github.com/evmos/ethermint/server/flags"
136137
ethermint "github.com/evmos/ethermint/types"
137138
"github.com/evmos/ethermint/x/evm"
@@ -355,12 +356,15 @@ func NewEthermintApp(
355356
}
356357

357358
executor := cast.ToString(appOpts.Get(srvflags.EVMBlockExecutor))
358-
if executor == "block-stm" {
359+
switch executor {
360+
case srvconfig.BlockExecutorBlockSTM:
359361
sdk.SetAddrCacheEnabled(false)
360362
workers := cast.ToInt(appOpts.Get(srvflags.EVMBlockSTMWorkers))
361363
app.SetTxExecutor(STMTxExecutor(app.GetStoreKeys(), workers))
362-
} else {
364+
case srvconfig.BlockExecutorSequential:
363365
app.SetTxExecutor(DefaultTxExecutor)
366+
default:
367+
panic(fmt.Errorf("unknown EVM block executor: %s", executor))
364368
}
365369

366370
// init params keeper and subspaces

server/config/config.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,18 @@ const (
9797

9898
// DefaultRosettaDenomToSuggest defines the default denom for fee suggestion
9999
DefaultRosettaDenomToSuggest = "basecro"
100+
101+
BlockExecutorSequential = "sequential"
102+
BlockExecutorBlockSTM = "block-stm"
100103
)
101104

102105
var (
103106
// DefaultRosettaGasPrices defines the default list of prices to suggest
104107
DefaultRosettaGasPrices = sdk.NewDecCoins(sdk.NewDecCoin(DefaultRosettaDenomToSuggest, sdkmath.NewInt(4_000_000)))
105108

106109
evmTracers = []string{"json", "markdown", "struct", "access_list"}
110+
111+
blockExecutors = []string{"sequential", "block-stm"}
107112
)
108113

109114
// Config defines the server's top level configuration. It includes the default app config
@@ -252,6 +257,10 @@ func (c EVMConfig) Validate() error {
252257
return fmt.Errorf("invalid tracer type %s, available types: %v", c.Tracer, evmTracers)
253258
}
254259

260+
if !strings.StringInSlice(c.BlockExecutor, blockExecutors) {
261+
return fmt.Errorf("invalid block executor type %s, available types: %v", c.BlockExecutor, blockExecutors)
262+
}
263+
255264
return nil
256265
}
257266

0 commit comments

Comments
 (0)