@@ -365,7 +365,7 @@ func GenerateChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int,
365365 return db , blocks , receipts
366366}
367367
368- func GenerateVerkleChain (config * params.ChainConfig , parent * types.Block , engine consensus.Engine , db ethdb.Database , n int , gen func (int , * BlockGen )) ([]* types.Block , []types.Receipts , []* verkle.VerkleProof , []verkle.StateDiff ) {
368+ func GenerateVerkleChain (config * params.ChainConfig , parent * types.Block , engine consensus.Engine , diskdb ethdb.Database , n int , gen func (int , * BlockGen )) ([]* types.Block , []types.Receipts , []* verkle.VerkleProof , []verkle.StateDiff ) {
369369 if config == nil {
370370 config = params .TestChainConfig
371371 }
@@ -434,20 +434,16 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
434434 return nil , nil
435435 }
436436 var snaps * snapshot.Tree
437- triedb := state .NewDatabaseWithConfig (db , nil )
438- triedb .StartVerkleTransition (common.Hash {}, common.Hash {}, config , config .PragueTime , common.Hash {})
439- triedb .EndVerkleTransition ()
440- //statedb, err := state.New(parent.Root(), triedb, snaps)
441- //if err != nil {
442- // panic(fmt.Sprintf("could not find state for block %d: err=%v, parent root=%x", parent.NumberU64(), err, parent.Root()))
443- //}
444- statedb .Database ().SaveTransitionState (parent .Root ())
437+ db := state .NewDatabaseWithConfig (diskdb , nil )
438+ db .StartVerkleTransition (common.Hash {}, common.Hash {}, config , config .PragueTime , common.Hash {})
439+ db .EndVerkleTransition ()
440+ db .SaveTransitionState (parent .Root ())
445441 for i := 0 ; i < n ; i ++ {
446- // XXX merge uncommment
447- statedb , err := state .New (parent .Root (), triedb , snaps )
442+ statedb , err := state .New (parent .Root (), db , snaps )
448443 if err != nil {
449444 panic (fmt .Sprintf ("could not find state for block %d: err=%v, parent root=%x" , i , err , parent .Root ()))
450445 }
446+ statedb .NewAccessWitness ()
451447 block , receipt := genblock (i , parent , statedb )
452448 blocks [i ] = block
453449 receipts [i ] = receipt
0 commit comments