Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Apr 8, 2024
1 parent 069eff5 commit 4b05c05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ import (
"github.com/evmos/ethermint/app/ante"
"github.com/evmos/ethermint/encoding"
"github.com/evmos/ethermint/ethereum/eip712"
srvconfig "github.com/evmos/ethermint/server/config"
srvflags "github.com/evmos/ethermint/server/flags"
ethermint "github.com/evmos/ethermint/types"
"github.com/evmos/ethermint/x/evm"
Expand Down Expand Up @@ -355,12 +356,15 @@ func NewEthermintApp(
}

executor := cast.ToString(appOpts.Get(srvflags.EVMBlockExecutor))
if executor == "block-stm" {
switch executor {
case srvconfig.BlockExecutorBlockSTM:
sdk.SetAddrCacheEnabled(false)
workers := cast.ToInt(appOpts.Get(srvflags.EVMBlockSTMWorkers))
app.SetTxExecutor(STMTxExecutor(app.GetStoreKeys(), workers))
} else {
case srvconfig.BlockExecutorSequential:
app.SetTxExecutor(DefaultTxExecutor)
default:
panic(fmt.Errorf("unknown EVM block executor: %s", executor))
}

// init params keeper and subspaces
Expand Down
9 changes: 9 additions & 0 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@ const (

// DefaultRosettaDenomToSuggest defines the default denom for fee suggestion
DefaultRosettaDenomToSuggest = "basecro"

BlockExecutorSequential = "sequential"
BlockExecutorBlockSTM = "block-stm"
)

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

evmTracers = []string{"json", "markdown", "struct", "access_list"}

blockExecutors = []string{"sequential", "block-stm"}
)

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

if !strings.StringInSlice(c.BlockExecutor, blockExecutors) {
return fmt.Errorf("invalid block executor type %s, available types: %v", c.BlockExecutor, blockExecutors)
}

return nil
}

Expand Down

0 comments on commit 4b05c05

Please sign in to comment.