|
|
@ -32,7 +32,6 @@ var ( |
|
|
|
legacyDataDirFlag, |
|
|
|
legacyDataDirFlag, |
|
|
|
|
|
|
|
|
|
|
|
taraceFlag, |
|
|
|
taraceFlag, |
|
|
|
triesInMemoryFlag, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dnsSyncFlags = []cli.Flag{ |
|
|
|
dnsSyncFlags = []cli.Flag{ |
|
|
@ -268,6 +267,16 @@ var ( |
|
|
|
gpoBlockGasLimitFlag, |
|
|
|
gpoBlockGasLimitFlag, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cacheConfigFlags = []cli.Flag{ |
|
|
|
|
|
|
|
cacheDisabled, |
|
|
|
|
|
|
|
cacheTrieNodeLimit, |
|
|
|
|
|
|
|
cacheTriesInMemory, |
|
|
|
|
|
|
|
cachePreimages, |
|
|
|
|
|
|
|
cacheSnapshotLimit, |
|
|
|
|
|
|
|
cacheSnapshotNoBuild, |
|
|
|
|
|
|
|
cacheSnapshotWait, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
metricsFlags = []cli.Flag{ |
|
|
|
metricsFlags = []cli.Flag{ |
|
|
|
metricsETHFlag, |
|
|
|
metricsETHFlag, |
|
|
|
metricsExpensiveETHFlag, |
|
|
|
metricsExpensiveETHFlag, |
|
|
@ -352,11 +361,6 @@ var ( |
|
|
|
Usage: "indicates if full transaction tracing should be enabled", |
|
|
|
Usage: "indicates if full transaction tracing should be enabled", |
|
|
|
DefValue: defaultConfig.General.TraceEnable, |
|
|
|
DefValue: defaultConfig.General.TraceEnable, |
|
|
|
} |
|
|
|
} |
|
|
|
triesInMemoryFlag = cli.IntFlag{ |
|
|
|
|
|
|
|
Name: "blockchain.tries_in_memory", |
|
|
|
|
|
|
|
Usage: "number of blocks from header stored in disk before exiting", |
|
|
|
|
|
|
|
DefValue: defaultConfig.General.TriesInMemory, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func getRootFlags() []cli.Flag { |
|
|
|
func getRootFlags() []cli.Flag { |
|
|
@ -436,14 +440,6 @@ func applyGeneralFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig) |
|
|
|
if cli.IsFlagChanged(cmd, isBackupFlag) { |
|
|
|
if cli.IsFlagChanged(cmd, isBackupFlag) { |
|
|
|
config.General.IsBackup = cli.GetBoolFlagValue(cmd, isBackupFlag) |
|
|
|
config.General.IsBackup = cli.GetBoolFlagValue(cmd, isBackupFlag) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if cli.IsFlagChanged(cmd, triesInMemoryFlag) { |
|
|
|
|
|
|
|
value := cli.GetIntFlagValue(cmd, triesInMemoryFlag) |
|
|
|
|
|
|
|
if value <= 2 { |
|
|
|
|
|
|
|
panic("Must provide number greater than 2 for General.TriesInMemory") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
config.General.TriesInMemory = value |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// network flags
|
|
|
|
// network flags
|
|
|
@ -2115,3 +2111,70 @@ func applyGPOFlags(cmd *cobra.Command, cfg *harmonyconfig.HarmonyConfig) { |
|
|
|
cfg.GPO.BlockGasLimit = cli.GetIntFlagValue(cmd, gpoBlockGasLimitFlag) |
|
|
|
cfg.GPO.BlockGasLimit = cli.GetIntFlagValue(cmd, gpoBlockGasLimitFlag) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cache config flags
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
|
|
cacheDisabled = cli.BoolFlag{ |
|
|
|
|
|
|
|
Name: "cache.disabled", |
|
|
|
|
|
|
|
Usage: "Whether to disable trie write caching (archive node)", |
|
|
|
|
|
|
|
DefValue: defaultCacheConfig.Disabled, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cacheTrieNodeLimit = cli.IntFlag{ |
|
|
|
|
|
|
|
Name: "cache.trie_node_limit", |
|
|
|
|
|
|
|
Usage: " Memory limit (MB) at which to flush the current in-memory trie to disk", |
|
|
|
|
|
|
|
DefValue: defaultCacheConfig.TrieNodeLimit, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cacheTriesInMemory = cli.Uint64Flag{ |
|
|
|
|
|
|
|
Name: "cache.tries_in_memory", |
|
|
|
|
|
|
|
Usage: "Block number from the head stored in disk before exiting", |
|
|
|
|
|
|
|
DefValue: defaultCacheConfig.TriesInMemory, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cachePreimages = cli.BoolFlag{ |
|
|
|
|
|
|
|
Name: "cache.preimages", |
|
|
|
|
|
|
|
Usage: "Whether to store preimage of trie key to the disk", |
|
|
|
|
|
|
|
DefValue: defaultCacheConfig.Preimages, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cacheSnapshotLimit = cli.IntFlag{ |
|
|
|
|
|
|
|
Name: "cache.snapshot_limit", |
|
|
|
|
|
|
|
Usage: "Memory allowance (MB) to use for caching snapshot entries in memory", |
|
|
|
|
|
|
|
DefValue: defaultCacheConfig.SnapshotLimit, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cacheSnapshotNoBuild = cli.BoolFlag{ |
|
|
|
|
|
|
|
Name: "cache.snapshot_no_build", |
|
|
|
|
|
|
|
Usage: "Whether the background generation is allowed", |
|
|
|
|
|
|
|
DefValue: defaultCacheConfig.SnapshotNoBuild, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cacheSnapshotWait = cli.BoolFlag{ |
|
|
|
|
|
|
|
Name: "cache.snapshot_wait", |
|
|
|
|
|
|
|
Usage: "Wait for snapshot construction on startup", |
|
|
|
|
|
|
|
DefValue: defaultCacheConfig.SnapshotWait, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func applyCacheFlags(cmd *cobra.Command, cfg *harmonyconfig.HarmonyConfig) { |
|
|
|
|
|
|
|
if cli.IsFlagChanged(cmd, cacheDisabled) { |
|
|
|
|
|
|
|
cfg.Cache.Disabled = cli.GetBoolFlagValue(cmd, cacheDisabled) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if cli.IsFlagChanged(cmd, cacheTrieNodeLimit) { |
|
|
|
|
|
|
|
cfg.Cache.TrieNodeLimit = cli.GetIntFlagValue(cmd, cacheTrieNodeLimit) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if cli.IsFlagChanged(cmd, cacheTriesInMemory) { |
|
|
|
|
|
|
|
value := cli.GetUint64FlagValue(cmd, cacheTriesInMemory) |
|
|
|
|
|
|
|
if value <= 2 { |
|
|
|
|
|
|
|
panic("Must provide number greater than 2 for Cache.TriesInMemory") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cfg.Cache.TriesInMemory = value |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if cli.IsFlagChanged(cmd, cachePreimages) { |
|
|
|
|
|
|
|
cfg.Cache.Preimages = cli.GetBoolFlagValue(cmd, cachePreimages) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if cli.IsFlagChanged(cmd, cacheSnapshotLimit) { |
|
|
|
|
|
|
|
cfg.Cache.SnapshotLimit = cli.GetIntFlagValue(cmd, cacheSnapshotLimit) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if cli.IsFlagChanged(cmd, cacheSnapshotNoBuild) { |
|
|
|
|
|
|
|
cfg.Cache.SnapshotNoBuild = cli.GetBoolFlagValue(cmd, cacheSnapshotNoBuild) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if cli.IsFlagChanged(cmd, cacheSnapshotWait) { |
|
|
|
|
|
|
|
cfg.Cache.SnapshotWait = cli.GetBoolFlagValue(cmd, cacheSnapshotWait) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|