Skip to content

Commit

Permalink
pre-estimate config
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Sep 11, 2024
1 parent 37f962b commit 996719b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,8 @@ func NewEthermintApp(
case srvconfig.BlockExecutorBlockSTM:
sdk.SetAddrCacheEnabled(false)
workers := cast.ToInt(appOpts.Get(srvflags.EVMBlockSTMWorkers))
app.SetTxExecutor(STMTxExecutor(app.GetStoreKeys(), workers, true, app.EvmKeeper, txConfig.TxDecoder()))
preEstimate := cast.ToBool(appOpts.Get(srvflags.EVMBlockSTMPreEstimate))
app.SetTxExecutor(STMTxExecutor(app.GetStoreKeys(), workers, preEstimate, app.EvmKeeper, txConfig.TxDecoder()))
case "", srvconfig.BlockExecutorSequential:
app.SetTxExecutor(DefaultTxExecutor)
default:
Expand Down
11 changes: 7 additions & 4 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ type EVMConfig struct {
BlockExecutor string `mapstructure:"block-executor"`
// BlockSTMWorkers is the number of workers for block-stm execution, `0` means using all available CPUs.
BlockSTMWorkers int `mapstructure:"block-stm-workers"`
// BlockSTMPreEstimate is the flag to enable pre-estimation for block-stm execution.
BlockSTMPreEstimate bool `mapstructure:"block-stm-pre-estimate"`
}

// JSONRPCConfig defines configuration for the EVM RPC server.
Expand Down Expand Up @@ -407,10 +409,11 @@ func GetConfig(v *viper.Viper) (Config, error) {
return Config{
Config: cfg,
EVM: EVMConfig{
Tracer: v.GetString("evm.tracer"),
MaxTxGasWanted: v.GetUint64("evm.max-tx-gas-wanted"),
BlockExecutor: v.GetString("evm.block-executor"),
BlockSTMWorkers: v.GetInt("evm.block-stm-workers"),
Tracer: v.GetString("evm.tracer"),
MaxTxGasWanted: v.GetUint64("evm.max-tx-gas-wanted"),
BlockExecutor: v.GetString("evm.block-executor"),
BlockSTMWorkers: v.GetInt("evm.block-stm-workers"),
BlockSTMPreEstimate: v.GetBool("evm.block-stm-pre-estimate"),
},
JSONRPC: JSONRPCConfig{
Enable: v.GetBool("json-rpc.enable"),
Expand Down
2 changes: 2 additions & 0 deletions server/config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ max-tx-gas-wanted = {{ .EVM.MaxTxGasWanted }}
block-executor = "{{ .EVM.BlockExecutor }}"
# BlockSTMWorkers is the number of workers for block-stm execution, 0 means using all available CPUs.
block-stm-workers = {{ .EVM.BlockSTMWorkers }}
# BlockSTMPreEstimate is the flag to enable pre-estimation for block-stm execution.
block-stm-pre-estimate = {{ .EVM.BlockSTMPreEstimate }}
###############################################################################
### JSON RPC Configuration ###
Expand Down
9 changes: 5 additions & 4 deletions server/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ const (

// EVM flags
const (
EVMTracer = "evm.tracer"
EVMMaxTxGasWanted = "evm.max-tx-gas-wanted"
EVMBlockExecutor = "evm.block-executor"
EVMBlockSTMWorkers = "evm.block-stm-workers"
EVMTracer = "evm.tracer"
EVMMaxTxGasWanted = "evm.max-tx-gas-wanted"
EVMBlockExecutor = "evm.block-executor"
EVMBlockSTMWorkers = "evm.block-stm-workers"
EVMBlockSTMPreEstimate = "evm.block-stm-pre-estimate"
)

// TLS flags
Expand Down

0 comments on commit 996719b

Please sign in to comment.