From 7bb7bacd5042d41bb2c3a5c13e4fcc4f543afce2 Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Thu, 1 Sep 2022 11:07:49 +0530 Subject: [PATCH] Merge pull request #503 from maticnetwork/shivam/sealer-gasPrice (#506) internal/cli/server: update default cli values Co-authored-by: SHIVAM SHARMA --- internal/cli/server/config.go | 20 ++++++++-------- internal/cli/server/config_legacy_test.go | 28 ++++++++++++----------- internal/cli/server/testdata/test.toml | 4 ++-- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 255cf633eb..8ee023db76 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -419,7 +419,7 @@ func DefaultConfig() *Config { TxPool: &TxPoolConfig{ Locals: []string{}, NoLocals: false, - Journal: "", + Journal: "transactions.rlp", Rejournal: 1 * time.Hour, PriceLimit: 30000000000, PriceBump: 10, @@ -432,8 +432,8 @@ func DefaultConfig() *Config { Sealer: &SealerConfig{ Enabled: false, Etherbase: "", - GasCeil: 20000000, - GasPrice: big.NewInt(30 * params.GWei), + GasCeil: 30_000_000, + GasPrice: big.NewInt(1 * params.GWei), ExtraData: "", }, Gpo: &GpoConfig{ @@ -453,22 +453,22 @@ func DefaultConfig() *Config { Prefix: "", Host: "localhost", API: []string{"eth", "net", "web3", "txpool", "bor"}, - Cors: []string{"*"}, - VHost: []string{"*"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, Ws: &APIConfig{ Enabled: false, Port: 8546, Prefix: "", Host: "localhost", - API: []string{"web3", "net"}, - Cors: []string{"*"}, - VHost: []string{"*"}, + API: []string{"net", "web3"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, Graphql: &APIConfig{ Enabled: false, - Cors: []string{"*"}, - VHost: []string{"*"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, }, Ethstats: "", diff --git a/internal/cli/server/config_legacy_test.go b/internal/cli/server/config_legacy_test.go index b28d7ae536..b11e9646f4 100644 --- a/internal/cli/server/config_legacy_test.go +++ b/internal/cli/server/config_legacy_test.go @@ -14,10 +14,10 @@ import ( func TestConfigLegacy(t *testing.T) { readFile := func(path string) { - config, err := readLegacyConfig(path) + expectedConfig, err := readLegacyConfig(path) assert.NoError(t, err) - assert.Equal(t, config, &Config{ + testConfig := &Config{ Chain: "mainnet", Identity: Hostname(), RequiredBlocks: map[string]string{ @@ -52,7 +52,7 @@ func TestConfigLegacy(t *testing.T) { TxPool: &TxPoolConfig{ Locals: []string{}, NoLocals: false, - Journal: "", + Journal: "transactions.rlp", Rejournal: 1 * time.Hour, PriceLimit: 30000000000, PriceBump: 10, @@ -65,8 +65,8 @@ func TestConfigLegacy(t *testing.T) { Sealer: &SealerConfig{ Enabled: false, Etherbase: "", - GasCeil: 20000000, - GasPrice: big.NewInt(30000000000), + GasCeil: 30000000, + GasPrice: big.NewInt(1 * params.GWei), ExtraData: "", }, Gpo: &GpoConfig{ @@ -86,22 +86,22 @@ func TestConfigLegacy(t *testing.T) { Prefix: "", Host: "localhost", API: []string{"eth", "net", "web3", "txpool", "bor"}, - Cors: []string{"*"}, - VHost: []string{"*"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, Ws: &APIConfig{ Enabled: false, Port: 8546, Prefix: "", Host: "localhost", - API: []string{"web3", "net"}, - Cors: []string{"*"}, - VHost: []string{"*"}, + API: []string{"net", "web3"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, Graphql: &APIConfig{ Enabled: false, - Cors: []string{"*"}, - VHost: []string{"*"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, }, Ethstats: "", @@ -149,7 +149,9 @@ func TestConfigLegacy(t *testing.T) { Enabled: false, Period: 0, }, - }) + } + + assert.Equal(t, expectedConfig, testConfig) } // read file in hcl format diff --git a/internal/cli/server/testdata/test.toml b/internal/cli/server/testdata/test.toml index ecc313b5b5..2277e03664 100644 --- a/internal/cli/server/testdata/test.toml +++ b/internal/cli/server/testdata/test.toml @@ -12,8 +12,8 @@ lifetime = "1s" [miner] mine = false -gaslimit = 20000000 -gasprice = "30000000000" +gaslimit = 30000000 +gasprice = "1000000000" [gpo] ignoreprice = "4"