Skip to content

Commit

Permalink
Merge pull request #157 from ethereum-optimism/jg/bump_cache_for_main…
Browse files Browse the repository at this point in the history
…net_superchains

Bump the geth cache on OP stack mainnet chains
  • Loading branch information
ajsutton authored Oct 17, 2023
2 parents ec46803 + 404a6e7 commit ce04335
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ func prepare(ctx *cli.Context) {
to 0, and discovery is disabled.
`)

case ctx.IsSet(utils.BetaOPNetworkFlag.Name):
log.Info("Starting geth on an OP network...", "network", ctx.String(utils.BetaOPNetworkFlag.Name))

case !ctx.IsSet(utils.NetworkIdFlag.Name):
log.Info("Starting Geth on Ethereum mainnet...")
}
Expand All @@ -322,9 +325,16 @@ func prepare(ctx *cli.Context) {
!ctx.IsSet(utils.GoerliFlag.Name) &&
!ctx.IsSet(utils.DeveloperFlag.Name) {
// Nope, we're really on mainnet. Bump that cache up!
// Note: If we don't set the OPNetworkFlag and have already initialized the database, we may hit this case.
log.Info("Bumping default cache on mainnet", "provided", ctx.Int(utils.CacheFlag.Name), "updated", 4096)
ctx.Set(utils.CacheFlag.Name, strconv.Itoa(4096))
}
} else if ctx.String(utils.SyncModeFlag.Name) != "light" && !ctx.IsSet(utils.CacheFlag.Name) && ctx.IsSet(utils.BetaOPNetworkFlag.Name) {
// We haven't set the cache, but may used the OP network flag we may be on an OP stack mainnet.
if strings.Contains(ctx.String(utils.BetaOPNetworkFlag.Name), "mainnet") {
log.Info("Bumping default cache on mainnet", "provided", ctx.Int(utils.CacheFlag.Name), "updated", 4096, "network", ctx.String(utils.BetaOPNetworkFlag.Name))
ctx.Set(utils.CacheFlag.Name, strconv.Itoa(4096))
}
}
// If we're running a light client on any network, drop the cache to some meaningfully low amount
if ctx.String(utils.SyncModeFlag.Name) == "light" && !ctx.IsSet(utils.CacheFlag.Name) {
Expand Down

0 comments on commit ce04335

Please sign in to comment.