From 7912dd00ad9977e5121f73537e046474e58b6368 Mon Sep 17 00:00:00 2001 From: Giulio Date: Thu, 5 Sep 2024 11:01:27 +0200 Subject: [PATCH 1/2] save --- eth/stagedsync/exec3.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 4022149e481..274b7c7636b 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -225,7 +225,8 @@ func ExecV3(ctx context.Context, agg.SetCollateAndBuildWorkers(1) } - pruneNonEssentials := cfg.prune.History.Enabled() && cfg.prune.History.PruneTo(execStage.BlockNumber) == execStage.BlockNumber + //pruneNonEssentials := cfg.prune.History.Enabled() && cfg.prune.History.PruneTo(execStage.BlockNumber) == execStage.BlockNumber + pruneNonEssentials := false // Disabled for now because we need to keep some data for wallets. var err error inMemExec := txc.Doms != nil From d06201d4d8e9cc71b5b7e60fc9d62e101c43f80a Mon Sep 17 00:00:00 2001 From: Giulio Date: Thu, 5 Sep 2024 11:17:24 +0200 Subject: [PATCH 2/2] save --- erigon-lib/config3/config3.go | 2 ++ eth/stagedsync/exec3.go | 3 +-- turbo/cli/flags.go | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/erigon-lib/config3/config3.go b/erigon-lib/config3/config3.go index af2aa090f37..f5b53fc7d3d 100644 --- a/erigon-lib/config3/config3.go +++ b/erigon-lib/config3/config3.go @@ -23,3 +23,5 @@ const HistoryV3AggregationStep = 1_562_500 // = 100M / 64. Dividers: 2, 5, 10, 2 const EnableHistoryV4InTest = true const MaxReorgDepthV3 = 1024 + +const DefaultPruneDistance = 100_000 diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 274b7c7636b..4022149e481 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -225,8 +225,7 @@ func ExecV3(ctx context.Context, agg.SetCollateAndBuildWorkers(1) } - //pruneNonEssentials := cfg.prune.History.Enabled() && cfg.prune.History.PruneTo(execStage.BlockNumber) == execStage.BlockNumber - pruneNonEssentials := false // Disabled for now because we need to keep some data for wallets. + pruneNonEssentials := cfg.prune.History.Enabled() && cfg.prune.History.PruneTo(execStage.BlockNumber) == execStage.BlockNumber var err error inMemExec := txc.Doms != nil diff --git a/turbo/cli/flags.go b/turbo/cli/flags.go index 52e8d727288..03e0ae462b6 100644 --- a/turbo/cli/flags.go +++ b/turbo/cli/flags.go @@ -22,6 +22,7 @@ import ( "time" "github.com/erigontech/erigon-lib/common/hexutil" + "github.com/erigontech/erigon-lib/config3" "github.com/erigontech/erigon-lib/txpool/txpoolcfg" @@ -434,10 +435,10 @@ func ApplyFlagsForEthConfigCobra(f *pflag.FlagSet, cfg *ethconfig.Config) { case "archive": case "full": mode.Blocks = prune.Distance(math.MaxUint64) - mode.History = prune.Distance(0) + mode.History = prune.Distance(config3.DefaultPruneDistance) case "minimal": - mode.Blocks = prune.Distance(2048) // 2048 is just some blocks to allow reorgs - mode.History = prune.Distance(0) + mode.Blocks = prune.Distance(config3.DefaultPruneDistance) // 2048 is just some blocks to allow reorgs and data for rpc + mode.History = prune.Distance(config3.DefaultPruneDistance) default: utils.Fatalf("error: --prune.mode must be one of archive, full, minimal") }