make MaxTxGasWanted configurable (#1004)

This commit is contained in:
yihuang
2022-03-21 10:01:21 +01:00
committed by GitHub
parent 93a57bc330
commit 8bcdb2c0e5
9 changed files with 28 additions and 9 deletions
+8 -2
View File
@@ -28,6 +28,8 @@ const (
// DefaultEVMTracer is the default vm.Tracer type
DefaultEVMTracer = ""
DefaultMaxTxGasWanted = 500000
DefaultGasCap uint64 = 25000000
DefaultFilterCap int32 = 200
@@ -64,6 +66,8 @@ type EVMConfig struct {
// Tracer defines vm.Tracer type that the EVM will use if the node is run in
// trace mode. Default: 'json'.
Tracer string `mapstructure:"tracer"`
// MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode.
MaxTxGasWanted uint64 `mapstructure:"max-tx-gas-wanted"`
}
// JSONRPCConfig defines configuration for the EVM RPC server.
@@ -152,7 +156,8 @@ func DefaultConfig() *Config {
// DefaultEVMConfig returns the default EVM configuration
func DefaultEVMConfig() *EVMConfig {
return &EVMConfig{
Tracer: DefaultEVMTracer,
Tracer: DefaultEVMTracer,
MaxTxGasWanted: DefaultMaxTxGasWanted,
}
}
@@ -277,7 +282,8 @@ func GetConfig(v *viper.Viper) Config {
return Config{
Config: cfg,
EVM: EVMConfig{
Tracer: v.GetString("evm.tracer"),
Tracer: v.GetString("evm.tracer"),
MaxTxGasWanted: v.GetUint64("evm.max-tx-gas-wanted"),
},
JSONRPC: JSONRPCConfig{
Enable: v.GetBool("json-rpc.enable"),
+3
View File
@@ -13,6 +13,9 @@ const DefaultConfigTemplate = `
# Valid types are: json|struct|access_list|markdown
tracer = "{{ .EVM.Tracer }}"
# MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode.
max-tx-gas-wanted = {{ .EVM.MaxTxGasWanted }}
###############################################################################
### JSON RPC Configuration ###
###############################################################################
+2 -1
View File
@@ -48,7 +48,8 @@ const (
// EVM flags
const (
EVMTracer = "evm.tracer"
EVMTracer = "evm.tracer"
EVMMaxTxGasWanted = "evm.max-tx-gas-wanted"
)
// TLS flags
+1
View File
@@ -166,6 +166,7 @@ which accepts a path for the resulting pprof file.
cmd.Flags().Int32(srvflags.JSONRPCBlockRangeCap, config.DefaultBlockRangeCap, "Sets the max block range allowed for `eth_getLogs` query")
cmd.Flags().String(srvflags.EVMTracer, config.DefaultEVMTracer, "the EVM tracer type to collect execution traces from the EVM transaction execution (json|struct|access_list|markdown)")
cmd.Flags().Uint64(srvflags.EVMMaxTxGasWanted, config.DefaultMaxTxGasWanted, "the gas wanted for each eth tx returned in ante handler in check tx mode")
cmd.Flags().String(srvflags.TLSCertPath, "", "the cert.pem file path for the server TLS configuration")
cmd.Flags().String(srvflags.TLSKeyPath, "", "the key.pem file path for the server TLS configuration")