@@ -244,8 +244,11 @@ func checkCommitmentRootViaSd(ctx context.Context, tx kv.TemporalTx, f state.Vis
244244}
245245
246246func checkCommitmentRootViaRecompute (ctx context.Context , tx kv.TemporalTx , sd * execctx.SharedDomains , info commitmentRootInfo , f state.VisibleFile , logger log.Logger ) error {
247+ trace := logger .Enabled (ctx , log .LvlTrace )
247248 touchLoggingVisitor := func (k []byte ) {
248- logger .Debug ("account touch for root block" , "key" , common .Address (k ), "blockNum" , info .blockNum , "file" , filepath .Base (f .Fullpath ()))
249+ if trace {
250+ logger .Trace ("account touch for root block" , "key" , common .Address (k ), "blockNum" , info .blockNum , "file" , filepath .Base (f .Fullpath ()))
251+ }
249252 }
250253 touches , err := touchHistoricalKeys (sd , tx , kv .AccountsDomain , info .blockMinTxNum , info .txNum + 1 , touchLoggingVisitor )
251254 if err != nil {
@@ -353,6 +356,7 @@ func checkCommitmentKvDeref(ctx context.Context, file state.VisibleFile, stepSiz
353356 )
354357 return derefCounts {}, nil
355358 }
359+ trace := logger .Enabled (ctx , log .LvlTrace )
356360 logger .Info ("[integrity] commitment deref in" , "kv" , fileName , "startTxNum" , startTxNum , "endTxNum" , endTxNum )
357361 commDecomp , err := seg .NewDecompressor (file .Fullpath ())
358362 if err != nil {
@@ -424,7 +428,7 @@ func checkCommitmentKvDeref(ctx context.Context, file state.VisibleFile, stepSiz
424428 counts .branchKeys ++
425429 branchData := commitment .BranchData (branchValue )
426430 newBranchData , err := branchData .ReplacePlainKeys (newBranchValueBuf [:0 ], func (key []byte , isStorage bool ) ([]byte , error ) {
427- if logger . Enabled ( ctx , log . LvlTrace ) {
431+ if trace {
428432 logger .Trace (
429433 "checking commitment deref for branch" ,
430434 "branchKey" , hex .EncodeToString (branchKey ),
@@ -435,7 +439,7 @@ func checkCommitmentKvDeref(ctx context.Context, file state.VisibleFile, stepSiz
435439 }
436440 if isStorage {
437441 if len (key ) == length .Addr + length .Hash {
438- if logger . Enabled ( ctx , log . LvlTrace ) {
442+ if trace {
439443 logger .Trace (
440444 "skipping, not a storage reference" ,
441445 "branchKey" , hex .EncodeToString (branchKey ),
@@ -468,7 +472,7 @@ func checkCommitmentKvDeref(ctx context.Context, file state.VisibleFile, stepSiz
468472 integrityErr = fmt .Errorf ("%w: %w" , ErrIntegrity , err )
469473 return key , nil
470474 }
471- if logger . Enabled ( ctx , log . LvlTrace ) {
475+ if trace {
472476 logger .Trace (
473477 "dereferenced storage key" ,
474478 "branchKey" , hex .EncodeToString (branchKey ),
@@ -482,7 +486,7 @@ func checkCommitmentKvDeref(ctx context.Context, file state.VisibleFile, stepSiz
482486 return plainKey , nil
483487 }
484488 if len (key ) == length .Addr {
485- if logger . Enabled ( ctx , log . LvlTrace ) {
489+ if trace {
486490 logger .Trace (
487491 "skipping, not an account reference" ,
488492 "branchKey" , hex .EncodeToString (branchKey ),
@@ -514,7 +518,7 @@ func checkCommitmentKvDeref(ctx context.Context, file state.VisibleFile, stepSiz
514518 integrityErr = fmt .Errorf ("%w: %w" , ErrIntegrity , err )
515519 return key , nil
516520 }
517- if logger . Enabled ( ctx , log . LvlTrace ) {
521+ if trace {
518522 logger .Trace (
519523 "dereferenced account key" ,
520524 "branchKey" , hex .EncodeToString (branchKey ),
@@ -770,12 +774,15 @@ func CheckCommitmentHistAtBlk(ctx context.Context, db kv.TemporalRoDB, br servic
770774 return fmt .Errorf ("commitment state txNum doesn't match maxTxNum: %d != %d" , latestTxNum , maxTxNum )
771775 }
772776 logger .Info ("commitment recalc info" , "blockNum" , blockNum , "minTxNum" , minTxNum , "maxTxNum" , maxTxNum , "toTxNum" , toTxNum )
777+ trace := logger .Enabled (ctx , log .LvlTrace )
773778 touchLoggingVisitor := func (k []byte ) {
774- args := []any {"key" , common .Address (k [:length .Addr ])}
775- if len (k ) > length .Addr {
776- args = append (args , "slot" , common .Hash (k [length .Addr :]))
779+ if trace {
780+ args := []any {"key" , common .Address (k [:length .Addr ])}
781+ if len (k ) > length .Addr {
782+ args = append (args , "slot" , common .Hash (k [length .Addr :]))
783+ }
784+ logger .Trace ("commitment touched key" , args ... )
777785 }
778- logger .Debug ("commitment touched key" , args ... )
779786 }
780787 touchStart := time .Now ()
781788 accTouches , err := touchHistoricalKeys (sd , tx , kv .AccountsDomain , minTxNum , toTxNum , touchLoggingVisitor )
0 commit comments