aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Buchwald <[email protected]>2020-10-20 12:20:49 -0400
committerAaron Buchwald <[email protected]>2020-10-20 12:20:49 -0400
commitcccb47666b2bccce378a9a56824061ea3a9a95fa (patch)
tree36822cea4b16638e6a246af209ccdf77b3eb2088
parent77681f0af89a2c22ed24b4a7edb1f7b3d3a6c442 (diff)
Add RPC GasCap and TxFeeCap to CLI config
-rw-r--r--plugin/evm/config.go4
-rw-r--r--plugin/evm/vm.go4
-rw-r--r--plugin/params.go3
3 files changed, 9 insertions, 2 deletions
diff --git a/plugin/evm/config.go b/plugin/evm/config.go
index 909992a..4669807 100644
--- a/plugin/evm/config.go
+++ b/plugin/evm/config.go
@@ -7,6 +7,10 @@ type CommandLineConfig struct {
Web3APIEnabled bool `json:"web3APIEnabled"`
CorethAdminAPIEnabled bool `json:"corethAdminAPIEnabled"`
+ // Coreth API Gas/Price Caps
+ RPCGasCap uint64 `json:"rpcGasCap"`
+ RPCTxFeeCap float64 `json:"rpcTxFeeCap"`
+
// Eth APIs
EthAPIEnabled bool `json:"ethAPIEnabled"`
PersonalAPIEnabled bool `json:"personalAPIEnabled"`
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index a6370e1..c429bca 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -261,8 +261,8 @@ func (vm *VM) Initialize(
// Set minimum price for mining and default gas price oracle value to the min
// gas price to prevent so transactions and blocks all use the correct fees
config.Miner.GasPrice = params.MinGasPrice
- config.RPCGasCap = 2500000000 // 25000000 x 100
- config.RPCTxFeeCap = 100 // 100 AVAX
+ config.RPCGasCap = vm.CLIConfig.RPCGasCap
+ config.RPCTxFeeCap = vm.CLIConfig.RPCTxFeeCap
config.GPO.Default = params.MinGasPrice
config.TxPool.PriceLimit = params.MinGasPrice.Uint64()
config.TxPool.NoLocals = true
diff --git a/plugin/params.go b/plugin/params.go
index 9881551..1810295 100644
--- a/plugin/params.go
+++ b/plugin/params.go
@@ -32,7 +32,10 @@ func init() {
if *config == "default" {
cliConfig.EthAPIEnabled = true
cliConfig.TxPoolAPIEnabled = true
+ cliConfig.RPCGasCap = 2500000000 // 25000000 x 100
+ cliConfig.RPCTxFeeCap = 100 // 100 AVAX
} else {
+ // TODO only overwrite values that were explicitly set
errs.Add(json.Unmarshal([]byte(*config), &cliConfig))
}
}