Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a unit test to check the default values of all the flags in config file #1105

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions internal/cli/server/config_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,22 @@ func TestConfigLegacy(t *testing.T) {
readFile("./testdata/test.toml")
})
}

func TestDefaultConfigLegacy(t *testing.T) {
readFile := func(path string) {
expectedConfig, err := readLegacyConfig(path)
assert.NoError(t, err)

testConfig := DefaultConfig()

testConfig.Identity = "Polygon-Devs"
testConfig.DataDir = "/var/lib/bor"

assert.Equal(t, expectedConfig, testConfig)
}

// read file in hcl format
t.Run("toml", func(t *testing.T) {
readFile("./testdata/default.toml")
})
}
193 changes: 193 additions & 0 deletions internal/cli/server/testdata/default.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
chain = "mainnet"
identity = "Polygon-Devs"
verbosity = 3
log-level = ""
vmdebug = false
datadir = "/var/lib/bor"
ancient = ""
"db.engine" = "leveldb"
keystore = ""
"rpc.batchlimit" = 100
"rpc.returndatalimit" = 100000
syncmode = "full"
gcmode = "full"
snapshot = true
"bor.logs" = false
ethstats = ""
devfakeauthor = false

["eth.requiredblocks"]

[log]
vmodule = ""
json = false
backtrace = ""
debug = false

[p2p]
maxpeers = 50
maxpendpeers = 50
bind = "0.0.0.0"
port = 30303
nodiscover = false
nat = "any"
netrestrict = ""
nodekey = ""
nodekeyhex = ""
txarrivalwait = "500ms"
[p2p.discovery]
v4disc = true
v5disc = false
bootnodes = []
bootnodesv4 = []
bootnodesv5 = []
static-nodes = []
trusted-nodes = []
dns = []

[heimdall]
url = "http://localhost:1317"
"bor.without" = false
grpc-address = ""
"bor.runheimdall" = false
"bor.runheimdallargs" = ""
"bor.useheimdallapp" = false

[txpool]
locals = []
nolocals = false
journal = "transactions.rlp"
rejournal = "1h0m0s"
pricelimit = 1
pricebump = 10
accountslots = 16
globalslots = 32768
accountqueue = 16
globalqueue = 32768
lifetime = "3h0m0s"

[miner]
mine = false
etherbase = ""
extradata = ""
gaslimit = 30000000
gasprice = "1000000000"
recommit = "2m5s"
commitinterrupt = true

[jsonrpc]
ipcdisable = false
ipcpath = ""
gascap = 50000000
evmtimeout = "5s"
txfeecap = 1.0
allow-unprotected-txs = false
enabledeprecatedpersonal = false
[jsonrpc.http]
enabled = false
port = 8545
prefix = ""
host = "localhost"
api = ["eth", "net", "web3", "txpool", "bor"]
vhosts = ["localhost"]
corsdomain = ["localhost"]
ep-size = 40
ep-requesttimeout = "0s"
[jsonrpc.ws]
enabled = false
port = 8546
prefix = ""
host = "localhost"
api = ["net", "web3"]
origins = ["localhost"]
ep-size = 40
ep-requesttimeout = "0s"
[jsonrpc.graphql]
enabled = false
port = 0
prefix = ""
host = ""
vhosts = ["localhost"]
corsdomain = ["localhost"]
ep-size = 0
ep-requesttimeout = ""
[jsonrpc.auth]
jwtsecret = ""
addr = "localhost"
port = 8551
vhosts = ["localhost"]
[jsonrpc.timeouts]
read = "10s"
write = "30s"
idle = "2m0s"

[gpo]
blocks = 20
percentile = 60
maxheaderhistory = 1024
maxblockhistory = 1024
maxprice = "500000000000"
ignoreprice = "2"

[telemetry]
metrics = false
expensive = false
prometheus-addr = "127.0.0.1:7071"
opencollector-endpoint = ""
[telemetry.influx]
influxdb = false
endpoint = ""
database = ""
username = ""
password = ""
influxdbv2 = false
token = ""
bucket = ""
organization = ""
[telemetry.influx.tags]

[cache]
cache = 1024
gc = 25
snapshot = 10
database = 50
trie = 15
noprefetch = false
preimages = false
txlookuplimit = 2350000
triesinmemory = 128
blocklogs = 32
timeout = "1h0m0s"
fdlimit = 0

[leveldb]
compactiontablesize = 2
compactiontablesizemultiplier = 1.0
compactiontotalsize = 10
compactiontotalsizemultiplier = 10.0

[accounts]
unlock = []
password = ""
allow-insecure-unlock = false
lightkdf = false
disable-bor-wallet = true

[grpc]
addr = ":3131"

[developer]
dev = false
period = 0
gaslimit = 11500000

[parallelevm]
enable = true
procs = 8

[pprof]
pprof = false
port = 6060
addr = "127.0.0.1"
memprofilerate = 524288
blockprofilerate = 0
Loading