fix: disable pruning and prefetch if not flags are provided (#483)

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
This commit is contained in:
Péter Garamvölgyi 2023-08-24 18:15:45 +02:00 committed by GitHub
parent eb79758c01
commit b0657a7e45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -437,7 +437,7 @@ var (
Usage: "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)", Usage: "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)",
Value: 10, Value: 10,
} }
CacheNoPrefetchFlag = cli.BoolTFlag{ CacheNoPrefetchFlag = cli.BoolFlag{
Name: "cache.noprefetch", Name: "cache.noprefetch",
Usage: "Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)", Usage: "Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)",
} }
@ -1745,15 +1745,15 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
stack.Config().L1Confirmations = rpc.FinalizedBlockNumber stack.Config().L1Confirmations = rpc.FinalizedBlockNumber
log.Info("Setting flag", "--l1.sync.startblock", "4038000") log.Info("Setting flag", "--l1.sync.startblock", "4038000")
stack.Config().L1DeploymentBlock = 4038000 stack.Config().L1DeploymentBlock = 4038000
// double check correct config // disable pruning
if ctx.GlobalString(GCModeFlag.Name) != GCModeArchive { if ctx.GlobalString(GCModeFlag.Name) != GCModeArchive {
log.Crit("Must use --gcmode=archive") log.Crit("Must use --gcmode=archive")
} }
log.Info("Setting flag", "--gcmode", ctx.GlobalString(GCModeFlag.Name)) log.Info("Pruning disabled")
if !ctx.GlobalBool(CacheNoPrefetchFlag.Name) { cfg.NoPruning = true
log.Crit("Must use --cache.noprefetch") // disable prefetch
} log.Info("Prefetch disabled")
log.Info("Setting flag", "--cache.noprefetch", ctx.GlobalBool(CacheNoPrefetchFlag.Name)) cfg.NoPrefetch = true
case ctx.GlobalBool(DeveloperFlag.Name): case ctx.GlobalBool(DeveloperFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) { if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1337 cfg.NetworkId = 1337

View file

@ -24,7 +24,7 @@ import (
const ( const (
VersionMajor = 4 // Major version component of the current release VersionMajor = 4 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release VersionMinor = 3 // Minor version component of the current release
VersionPatch = 50 // Patch version component of the current release VersionPatch = 51 // Patch version component of the current release
VersionMeta = "sepolia" // Version metadata to append to the version string VersionMeta = "sepolia" // Version metadata to append to the version string
) )