From 6da65c2173e6da457423d67e958ce153c5598a17 Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Tue, 20 Oct 2020 11:57:31 -0400 Subject: Add CLI config to coreth plugin --- plugin/params.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 plugin/params.go (limited to 'plugin/params.go') diff --git a/plugin/params.go b/plugin/params.go new file mode 100644 index 0000000..403424c --- /dev/null +++ b/plugin/params.go @@ -0,0 +1,30 @@ +package main + +import ( + "encoding/json" + "flag" + + "github.com/ava-labs/avalanchego/utils/wrappers" + "github.com/ava-labs/coreth/plugin/evm" +) + +const ( + name = "coreth" +) + +var ( + cliConfig evm.CommandLineConfig + errs wrappers.Errs +) + +func init() { + errs := wrappers.Errs{} + fs := flag.NewFlagSet(name, flag.ContinueOnError) + + config := fs.String("coreth-config", "default", "Pass in CLI Config to set runtime attributes for Coreth") + if *config == "default" { + cliConfig.EthAPIEnabled = true + } else { + errs.Add(json.Unmarshal([]byte(*config), &cliConfig)) + } +} -- cgit v1.2.3 From 77681f0af89a2c22ed24b4a7edb1f7b3d3a6c442 Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Tue, 20 Oct 2020 12:06:08 -0400 Subject: Set txpool API to be enabled by default --- plugin/params.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugin/params.go') diff --git a/plugin/params.go b/plugin/params.go index 403424c..9881551 100644 --- a/plugin/params.go +++ b/plugin/params.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" "flag" + "os" "github.com/ava-labs/avalanchego/utils/wrappers" "github.com/ava-labs/coreth/plugin/evm" @@ -22,8 +23,15 @@ func init() { fs := flag.NewFlagSet(name, flag.ContinueOnError) config := fs.String("coreth-config", "default", "Pass in CLI Config to set runtime attributes for Coreth") + + if err := fs.Parse(os.Args[1:]); err != nil { + errs.Add(err) + return + } + if *config == "default" { cliConfig.EthAPIEnabled = true + cliConfig.TxPoolAPIEnabled = true } else { errs.Add(json.Unmarshal([]byte(*config), &cliConfig)) } -- cgit v1.2.3 From cccb47666b2bccce378a9a56824061ea3a9a95fa Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Tue, 20 Oct 2020 12:20:49 -0400 Subject: Add RPC GasCap and TxFeeCap to CLI config --- plugin/params.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugin/params.go') 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)) } } -- cgit v1.2.3