@@ -29,6 +29,8 @@ import (
2929 "strings"
3030 "time"
3131
32+ "github.com/syndtr/goleveldb/leveldb"
33+
3234 "github.com/scroll-tech/go-ethereum/common"
3335 "github.com/scroll-tech/go-ethereum/common/hexutil"
3436 "github.com/scroll-tech/go-ethereum/core"
@@ -44,7 +46,6 @@ import (
4446 "github.com/scroll-tech/go-ethereum/rollup/rcfg"
4547 "github.com/scroll-tech/go-ethereum/rpc"
4648 "github.com/scroll-tech/go-ethereum/trie"
47- "github.com/syndtr/goleveldb/leveldb"
4849)
4950
5051// PublicEthereumAPI provides an API to access Ethereum full node-related
@@ -354,13 +355,11 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles
354355 if err != nil {
355356 return nil , fmt .Errorf ("failed to retrieve parent state: %w" , err )
356357 }
358+ statedb .WithWitness (witness )
357359
358360 // Collect storage locations that prover needs but sequencer might not touch necessarily
359361 statedb .GetState (rcfg .L2MessageQueueAddress , rcfg .WithdrawTrieRootSlot )
360362
361- statedb .StartPrefetcher ("debug_execution_witness" , witness )
362- defer statedb .StopPrefetcher ()
363-
364363 receipts , _ , usedGas , err := blockchain .Processor ().Process (block , statedb , * blockchain .GetVMConfig ())
365364 if err != nil {
366365 return nil , fmt .Errorf ("failed to process block %d: %w" , block .Number (), err )
@@ -370,16 +369,10 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles
370369 return nil , fmt .Errorf ("failed to validate block %d: %w" , block .Number (), err )
371370 }
372371
373- // FIXME: testWitness will fail from time to time, the problem is caused by occasional state root mismatch
374- // after processing the block based on witness. We need to investigate the root cause and fix it.
375- for retries := 0 ; retries < 5 ; retries ++ {
376- if err = testWitness (blockchain , block , witness ); err == nil {
377- return witness , nil
378- } else {
379- log .Warn ("Failed to validate witness" , "block" , block .Number (), "error" , err )
380- }
372+ if err = testWitness (blockchain , block , witness ); err != nil {
373+ return nil , err
381374 }
382- return witness , err
375+ return witness , nil
383376}
384377
385378func testWitness (blockchain * core.BlockChain , block * types.Block , witness * stateless.Witness ) error {
0 commit comments