@@ -353,9 +353,9 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.
353353
354354// FinalizeAndAssemble implements consensus.Engine, setting the final state and
355355// assembling the block.
356- func (beacon * Beacon ) FinalizeAndAssemble (chain consensus.ChainHeaderReader , header * types.Header , state * state.StateDB , body * types.Body , receipts []* types.Receipt ) (* types.Block , error ) {
356+ func (beacon * Beacon ) FinalizeAndAssemble (chain consensus.ChainHeaderReader , header * types.Header , statedb * state.StateDB , body * types.Body , receipts []* types.Receipt ) (* types.Block , error ) {
357357 if ! beacon .IsPoSHeader (header ) {
358- return beacon .ethone .FinalizeAndAssemble (chain , header , state , body , receipts )
358+ return beacon .ethone .FinalizeAndAssemble (chain , header , statedb , body , receipts )
359359 }
360360 shanghai := chain .Config ().IsShanghai (header .Number , header .Time )
361361 if shanghai {
@@ -369,34 +369,31 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
369369 }
370370 }
371371 // Finalize and assemble the block.
372- beacon .Finalize (chain , header , state , body )
372+ beacon .Finalize (chain , header , statedb , body )
373373
374374 // Assign the final state root to header.
375- header .Root = state .IntermediateRoot (true )
375+ header .Root = statedb .IntermediateRoot (true )
376376
377377 // Assemble the final block.
378378 block := types .NewBlock (header , body , receipts , trie .NewStackTrie (nil ))
379379
380380 // Create the block witness and attach to block.
381381 // This step needs to happen as late as possible to catch all access events.
382382 if chain .Config ().IsVerkle (header .Number , header .Time ) {
383- keys := state .AccessEvents ().Keys ()
383+ //statedb.Database().SaveTransitionState(header.Root, &state.TransitionState{Ended: true})
384+ keys := statedb .AccessEvents ().Keys ()
384385
385386 // Open the pre-tree to prove the pre-state against
386387 parent := chain .GetHeaderByNumber (header .Number .Uint64 () - 1 )
387388 if parent == nil {
388389 return nil , fmt .Errorf ("nil parent header for block %d" , header .Number )
389390 }
390- preTrie , err := state .Database ().OpenTrie (parent .Root )
391+ preTrie , err := statedb .Database ().OpenTrie (parent .Root )
391392 if err != nil {
392393 return nil , fmt .Errorf ("error opening pre-state tree root: %w" , err )
393394 }
394- postTrie := state .GetTrie ()
395- if postTrie == nil {
396- return nil , errors .New ("post-state tree is not available" )
397- }
398395 vktPreTrie , okpre := preTrie .(* trie.VerkleTrie )
399- vktPostTrie , okpost := state .GetTrie ().(* trie.VerkleTrie )
396+ vktPostTrie , okpost := statedb .GetTrie ().(* trie.VerkleTrie )
400397
401398 // The witness is only attached iff both parent and current block are
402399 // using verkle tree.
0 commit comments