From e3303294b4d14f31df742a3ed277de13303bf210 Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Sun, 4 Dec 2022 10:02:55 +0530 Subject: [PATCH 1/2] added ancient datadir flag and toml field, need to decide on default value and update the conversion script --- internal/cli/server/config.go | 8 ++++++++ internal/cli/server/flags.go | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 2e0a8f21f5..6bbe3d781a 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -53,6 +53,9 @@ type Config struct { // DataDir is the directory to store the state in DataDir string `hcl:"datadir,optional" toml:"datadir,optional"` + // Ancient is the directory to store the state in + Ancient string `hcl:"ancient,optional" toml:"ancient,optional"` + // KeyStoreDir is the directory to store keystores KeyStoreDir string `hcl:"keystore,optional" toml:"keystore,optional"` @@ -398,6 +401,7 @@ func DefaultConfig() *Config { RequiredBlocks: map[string]string{}, LogLevel: "INFO", DataDir: DefaultDataDir(), + Ancient: "", P2P: &P2PConfig{ MaxPeers: 50, MaxPendPeers: 50, @@ -879,6 +883,10 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (* n.BorLogs = c.BorLogs n.DatabaseHandles = dbHandles + if c.Ancient != "" { + n.DatabaseFreezer = c.Ancient + } + return &n, nil } diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index 550d76942b..a53e1c3e46 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -33,6 +33,12 @@ func (c *Command) Flags() *flagset.Flagset { Value: &c.cliConfig.DataDir, Default: c.cliConfig.DataDir, }) + f.StringFlag(&flagset.StringFlag{ + Name: "datadir.ancient", + Usage: "Data directory for ancient chain segments (default = inside chaindata)", + Value: &c.cliConfig.Ancient, + Default: c.cliConfig.Ancient, + }) f.StringFlag(&flagset.StringFlag{ Name: "keystore", Usage: "Path of the directory where keystores are located", From 531d67a53757fb5ab6776861eaa4f1e933cf098a Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Mon, 5 Dec 2022 07:52:26 +0530 Subject: [PATCH 2/2] updated toml files with ancient field --- builder/files/config.toml | 1 + docs/cli/example_config.toml | 1 + packaging/templates/mainnet-v1/archive/config.toml | 1 + packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml | 1 + packaging/templates/mainnet-v1/sentry/validator/bor/config.toml | 1 + packaging/templates/mainnet-v1/without-sentry/bor/config.toml | 1 + packaging/templates/testnet-v4/archive/config.toml | 1 + packaging/templates/testnet-v4/sentry/sentry/bor/config.toml | 1 + packaging/templates/testnet-v4/sentry/validator/bor/config.toml | 1 + packaging/templates/testnet-v4/without-sentry/bor/config.toml | 1 + 10 files changed, 10 insertions(+) diff --git a/builder/files/config.toml b/builder/files/config.toml index f79b892e7f..e2267469bb 100644 --- a/builder/files/config.toml +++ b/builder/files/config.toml @@ -6,6 +6,7 @@ chain = "mainnet" # identity = "Pratiks-MacBook-Pro.local" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "/var/lib/bor/keystore" syncmode = "full" # gcmode = "full" diff --git a/docs/cli/example_config.toml b/docs/cli/example_config.toml index bc48b752d5..cdf2a989d7 100644 --- a/docs/cli/example_config.toml +++ b/docs/cli/example_config.toml @@ -6,6 +6,7 @@ chain = "mainnet" # Name of the chain to sync ("mumbai", "mainnet") o identity = "Annon-Identity" # Name/Identity of the node (default = OS hostname) log-level = "INFO" # Set log level for the server datadir = "var/lib/bor" # Path of the data directory to store information +ancient = "" # Data directory for ancient chain segments (default = inside chaindata) keystore = "" # Path of the directory where keystores are located syncmode = "full" # Blockchain sync mode (only "full" sync supported) gcmode = "full" # Blockchain garbage collection mode ("full", "archive") diff --git a/packaging/templates/mainnet-v1/archive/config.toml b/packaging/templates/mainnet-v1/archive/config.toml index 8989a1b7b5..a0eda44c15 100644 --- a/packaging/templates/mainnet-v1/archive/config.toml +++ b/packaging/templates/mainnet-v1/archive/config.toml @@ -2,6 +2,7 @@ chain = "mainnet" # identity = "node_name" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "" syncmode = "full" gcmode = "archive" diff --git a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml index d91e12b31e..b6d6b34f4d 100644 --- a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml @@ -2,6 +2,7 @@ chain = "mainnet" # identity = "node_name" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "" syncmode = "full" # gcmode = "full" diff --git a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml index c9f583aae3..e0a9be320f 100644 --- a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml @@ -4,6 +4,7 @@ chain = "mainnet" # identity = "node_name" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "$BOR_DIR/keystore" syncmode = "full" # gcmode = "full" diff --git a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml index 5c4a057b91..b316ce4e8f 100644 --- a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml @@ -4,6 +4,7 @@ chain = "mainnet" # identity = "node_name" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "$BOR_DIR/keystore" syncmode = "full" # gcmode = "full" diff --git a/packaging/templates/testnet-v4/archive/config.toml b/packaging/templates/testnet-v4/archive/config.toml index 5b7cbdd78e..ce0d0ff983 100644 --- a/packaging/templates/testnet-v4/archive/config.toml +++ b/packaging/templates/testnet-v4/archive/config.toml @@ -2,6 +2,7 @@ chain = "mumbai" # identity = "node_name" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "" syncmode = "full" gcmode = "archive" diff --git a/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml b/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml index f98e04ff42..3655478d45 100644 --- a/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml +++ b/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml @@ -2,6 +2,7 @@ chain = "mumbai" # identity = "node_name" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "" syncmode = "full" # gcmode = "full" diff --git a/packaging/templates/testnet-v4/sentry/validator/bor/config.toml b/packaging/templates/testnet-v4/sentry/validator/bor/config.toml index e2a404263d..9d30428205 100644 --- a/packaging/templates/testnet-v4/sentry/validator/bor/config.toml +++ b/packaging/templates/testnet-v4/sentry/validator/bor/config.toml @@ -4,6 +4,7 @@ chain = "mumbai" # identity = "node_name" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "$BOR_DIR/keystore" syncmode = "full" # gcmode = "full" diff --git a/packaging/templates/testnet-v4/without-sentry/bor/config.toml b/packaging/templates/testnet-v4/without-sentry/bor/config.toml index 567c9a5b0a..0e0aeae3a1 100644 --- a/packaging/templates/testnet-v4/without-sentry/bor/config.toml +++ b/packaging/templates/testnet-v4/without-sentry/bor/config.toml @@ -4,6 +4,7 @@ chain = "mumbai" # identity = "node_name" # log-level = "INFO" datadir = "/var/lib/bor/data" +# ancient = "" # keystore = "$BOR_DIR/keystore" syncmode = "full" # gcmode = "full"