diff --git a/builder/files/config.toml b/builder/files/config.toml index d8503e4351..84c3327bbf 100644 --- a/builder/files/config.toml +++ b/builder/files/config.toml @@ -12,7 +12,7 @@ syncmode = "full" # snapshot = true # ethstats = "" -# [requiredblocks] +# ["eth.requiredblocks"] [p2p] # maxpeers = 1 diff --git a/docs/config.md b/docs/config.md index 196a0bf388..aebd9e12b9 100644 --- a/docs/config.md +++ b/docs/config.md @@ -19,6 +19,8 @@ gcmode = "full" snapshot = true ethstats = "" +["eth.requiredblocks"] + [p2p] maxpeers = 30 maxpendpeers = 50 diff --git a/internal/cli/server/command_test.go b/internal/cli/server/command_test.go index 9006559d0f..ab28de5ee6 100644 --- a/internal/cli/server/command_test.go +++ b/internal/cli/server/command_test.go @@ -24,7 +24,7 @@ func TestFlags(t *testing.T) { "--dev.period", "2", "--datadir", "./data", "--maxpeers", "30", - "--requiredblocks", "a=b", + "--eth.requiredblocks", "a=b", "--http.api", "eth,web3,bor", } err := c.extractFlags(args) diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 7dcc986c01..1e953dbd64 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -45,7 +45,7 @@ type Config struct { Identity string `hcl:"identity,optional" toml:"identity,optional"` // RequiredBlocks is a list of required (block number, hash) pairs to accept - RequiredBlocks map[string]string `hcl:"requiredblocks,optional" toml:"requiredblocks,optional"` + RequiredBlocks map[string]string `hcl:"eth.requiredblocks,optional" toml:"eth.requiredblocks,optional"` // LogLevel is the level of the logs to put out LogLevel string `hcl:"log-level,optional" toml:"log-level,optional"` diff --git a/internal/cli/server/config_test.go b/internal/cli/server/config_test.go index bf7787ac2e..5f3118996b 100644 --- a/internal/cli/server/config_test.go +++ b/internal/cli/server/config_test.go @@ -108,9 +108,6 @@ func TestConfigLoadFile(t *testing.T) { assert.Equal(t, config, &Config{ DataDir: "./data", - RequiredBlocks: map[string]string{ - "a": "b", - }, P2P: &P2PConfig{ MaxPeers: 30, }, diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index 327b0df338..a1c08f4888 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -56,7 +56,7 @@ func (c *Command) Flags() *flagset.Flagset { Default: c.cliConfig.GcMode, }) f.MapStringFlag(&flagset.MapStringFlag{ - Name: "requiredblocks", + Name: "eth.requiredblocks", Usage: "Comma separated block number-to-hash mappings to enforce (=)", Value: &c.cliConfig.RequiredBlocks, }) diff --git a/internal/cli/server/testdata/test.hcl b/internal/cli/server/testdata/test.hcl index 208fdc51c1..44138970fc 100644 --- a/internal/cli/server/testdata/test.hcl +++ b/internal/cli/server/testdata/test.hcl @@ -1,9 +1,5 @@ datadir = "./data" -requiredblocks = { - a = "b" -} - p2p { maxpeers = 30 } diff --git a/internal/cli/server/testdata/test.json b/internal/cli/server/testdata/test.json index 467835e755..a08e5aceb1 100644 --- a/internal/cli/server/testdata/test.json +++ b/internal/cli/server/testdata/test.json @@ -1,8 +1,5 @@ { "datadir": "./data", - "requiredblocks": { - "a": "b" - }, "p2p": { "maxpeers": 30 }, diff --git a/internal/cli/server/testdata/test.toml b/internal/cli/server/testdata/test.toml index ecc313b5b5..24e1dcafcb 100644 --- a/internal/cli/server/testdata/test.toml +++ b/internal/cli/server/testdata/test.toml @@ -1,6 +1,6 @@ datadir = "./data" -[requiredblocks] +["eth.requiredblocks"] a = "b" [p2p] diff --git a/scripts/getconfig.go b/scripts/getconfig.go index db756f7552..f8e9d8566d 100644 --- a/scripts/getconfig.go +++ b/scripts/getconfig.go @@ -107,7 +107,7 @@ var nameTagMap = map[string]string{ "keystore": "keystore", "syncmode": "syncmode", "gcmode": "gcmode", - "requiredblocks": "requiredblocks", + "eth.requiredblocks": "eth.requiredblocks", "0-snapshot": "snapshot", "url": "bor.heimdall", "bor.without": "bor.withoutheimdall", @@ -530,7 +530,7 @@ func commentFlags(path string, updatedArgs []string) { passwordFlag += 1 } - if line == "[requiredblocks]" || line == " [telemetry.influx.tags]" { + if line == "[\"eth.requiredblocks\"]" || line == " [telemetry.influx.tags]" { ignoreLineFlag = true } else if line != "" { if strings.HasPrefix(strings.Fields(line)[0], "[") { diff --git a/scripts/getconfig.sh b/scripts/getconfig.sh index 906a52b5c1..4de91a2ee6 100755 --- a/scripts/getconfig.sh +++ b/scripts/getconfig.sh @@ -2,7 +2,7 @@ # Instructions: # Execute `./getconfig.sh`, and follow the instructions displayed on the terminal -# The `config.toml` file will be created in the same directory as start.sh +# The `*config.toml` file will be created in the same directory as start.sh # It is recommended to check the flags generated in config.toml @@ -67,6 +67,8 @@ tempflags=${dumpconfigflags//$/} # using '@' as the path contains '/' tempflags=$(echo $tempflags | sed "s@ADDRESS@$ADD@g") tempflags=$(echo $tempflags | sed "s@BOR_DIR@$BORDIR@g") +tempflags=$(echo $tempflags | sed "s@BOR_HOME@$BORDIR@g") +tempflags=$(echo $tempflags | sed "s@BOR_DATA_DIR@$DATADIR@g") tempflags=$(echo $tempflags | sed "s@DATA_DIR@$DATADIR@g") # run the dumpconfig command with the flags from `./temp`