@@ -355,13 +355,11 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles
355355 if err != nil {
356356 return nil , fmt .Errorf ("failed to retrieve parent state: %w" , err )
357357 }
358+ statedb .WithWitness (witness )
358359
359360 // Collect storage locations that prover needs but sequencer might not touch necessarily
360361 statedb .GetState (rcfg .L2MessageQueueAddress , rcfg .WithdrawTrieRootSlot )
361362
362- statedb .StartPrefetcher ("debug_execution_witness" , witness )
363- defer statedb .StopPrefetcher ()
364-
365363 receipts , _ , usedGas , err := blockchain .Processor ().Process (block , statedb , * blockchain .GetVMConfig ())
366364 if err != nil {
367365 return nil , fmt .Errorf ("failed to process block %d: %w" , block .Number (), err )
@@ -371,16 +369,10 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles
371369 return nil , fmt .Errorf ("failed to validate block %d: %w" , block .Number (), err )
372370 }
373371
374- // FIXME: testWitness will fail from time to time, the problem is caused by occasional state root mismatch
375- // after processing the block based on witness. We need to investigate the root cause and fix it.
376- for retries := 0 ; retries < 5 ; retries ++ {
377- if err = testWitness (blockchain , block , witness ); err == nil {
378- return witness , nil
379- } else {
380- log .Warn ("Failed to validate witness" , "block" , block .Number (), "error" , err )
381- }
372+ if err = testWitness (blockchain , block , witness ); err != nil {
373+ return nil , err
382374 }
383- return witness , err
375+ return witness , nil
384376}
385377
386378func testWitness (blockchain * core.BlockChain , block * types.Block , witness * stateless.Witness ) error {
0 commit comments