@@ -207,8 +207,8 @@ func checkCommitmentRootViaSd(ctx context.Context, tx kv.TemporalTx, f state.Vis
207207 return nil , err
208208 }
209209 sd .GetCommitmentCtx ().SetTrace (logger .Enabled (ctx , log .LvlTrace ))
210- sd .GetCommitmentCtx ().SetLimitedHistoryStateReader ( tx , maxTxNum ) // to use tx.Debug().GetLatestFromFiles with maxTxNum
211- latestTxNum , _ , err := sd .SeekCommitment (ctx , tx ) // seek commitment again to use the new state reader instead
210+ sd .GetCommitmentCtx ().SetStateReader ( commitmentdb . NewFilesOnlyStateReader ( tx , maxTxNum ))
211+ latestTxNum , _ , err := sd .SeekCommitment (ctx , tx ) // seek commitment again to use the new state reader instead
212212 if err != nil {
213213 return nil , err
214214 }
@@ -240,17 +240,13 @@ func checkCommitmentRootViaSd(ctx context.Context, tx kv.TemporalTx, f state.Vis
240240}
241241
242242func checkCommitmentRootViaRecompute (ctx context.Context , tx kv.TemporalTx , sd * execctx.SharedDomains , info commitmentRootInfo , f state.VisibleFile , logger log.Logger ) error {
243- trace := logger .Enabled (ctx , log .LvlTrace )
244- touchLoggingVisitor := func (k []byte ) {
245- if trace {
246- logger .Trace ("[integrity] CommitmentRoot" , "key" , common .Address (k ), "blockNum" , info .blockNum , "file" , filepath .Base (f .Fullpath ()))
247- }
248- }
249- touches , err := touchHistoricalKeys (sd , tx , kv .AccountsDomain , info .blockMinTxNum , info .txNum + 1 , 0 , nil /* no pre-built index */ , touchLoggingVisitor )
243+ accountTouches , storageTouches , err := sd .TouchChangedKeysFromHistory (tx , info .blockMinTxNum , info .txNum + 1 )
250244 if err != nil {
251245 return err
252246 }
253- logger .Info ("[integrity] CommitmentRoot recomputing" , "touches" , touches , "file" , filepath .Base (f .Fullpath ()))
247+ logger .Info ("[integrity] CommitmentRoot recomputing" ,
248+ "accountTouches" , accountTouches , "storageTouches" , storageTouches ,
249+ "file" , filepath .Base (f .Fullpath ()))
254250 recomputedBytes , err := sd .ComputeCommitment (ctx , tx , false /* saveStateAfter */ , info .blockNum , info .txNum , "" , nil /* commitProgress */ )
255251 if err != nil {
256252 return err
@@ -259,7 +255,10 @@ func checkCommitmentRootViaRecompute(ctx context.Context, tx kv.TemporalTx, sd *
259255 if recomputed != info .rootHash {
260256 return fmt .Errorf ("%w: recomputed root does not match verified root: %s != %s" , ErrIntegrity , recomputed , info .rootHash )
261257 }
262- logger .Info ("[integrity] CommitmentRoot recomputed matches" , "root" , recomputed , "touches" , touches , "file" , filepath .Base (f .Fullpath ()))
258+ logger .Info ("[integrity] CommitmentRoot recomputed matches" ,
259+ "root" , recomputed ,
260+ "accountTouches" , accountTouches , "storageTouches" , storageTouches ,
261+ "file" , filepath .Base (f .Fullpath ()))
263262 return nil
264263}
265264
0 commit comments