Skip to content

Commit

Permalink
antiquate: close rotx before long (compressing/indexing) operations (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored Nov 18, 2024
1 parent 4f70b79 commit a68a9b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions eth/stagedsync/exec3.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ func flushAndCheckCommitmentV3(ctx context.Context, header *types.Header, applyT
panic(fmt.Errorf("%d != %d", doms.BlockNum(), header.Number.Uint64()))
}

t1 := time.Now()
rh, err := doms.ComputeCommitment(ctx, true, header.Number.Uint64(), e.LogPrefix())
if err != nil {
return false, fmt.Errorf("StateV3.Apply: %w", err)
Expand All @@ -827,12 +828,19 @@ func flushAndCheckCommitmentV3(ctx context.Context, header *types.Header, applyT
}
if bytes.Equal(rh, header.Root.Bytes()) {
if !inMemExec {
d1 := time.Since(t1)
t2 := time.Now()
if err := doms.Flush(ctx, applyTx); err != nil {
return false, err
}
if err = applyTx.(state2.HasAggTx).AggTx().(*state2.AggregatorRoTx).PruneCommitHistory(ctx, applyTx, nil); err != nil {
return false, err
}

d2 := time.Since(t2)
if !inMemExec {
logger.Error(fmt.Sprintf("[%s] Trie: calc=%s, flush=%s", e.LogPrefix(), d1, d2))
}
}
return true, nil
}
Expand Down
2 changes: 1 addition & 1 deletion params/network_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ const (
// considered immutable (i.e. soft finality). It is used by the downloader as a
// hard limit against deep ancestors, by the blockchain against deep reorgs, by
// the freezer as the cutoff threshold and by clique as the snapshot trust limit.
FullImmutabilityThreshold = 100_000
FullImmutabilityThreshold = 10_000
)
2 changes: 2 additions & 0 deletions turbo/snapshotsync/freezeblocks/caplin_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ func dumpBeaconBlocksRange(ctx context.Context, db kv.RoDB, fromSlot uint64, toS
return err
}
}
tx.Rollback()
if sn.Count() != snaptype.CaplinMergeLimit {
return fmt.Errorf("expected %d blocks, got %d", snaptype.CaplinMergeLimit, sn.Count())
}
Expand Down Expand Up @@ -566,6 +567,7 @@ func DumpBlobSidecarsRange(ctx context.Context, db kv.RoDB, storage blob_storage
}

}
tx.Rollback()
if err := sn.Compress(); err != nil {
return fmt.Errorf("compress: %w", err)
}
Expand Down

0 comments on commit a68a9b6

Please sign in to comment.