From 93ad9d785f59c08548de4eafb2f5003c11b32773 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 9 Aug 2024 15:22:23 -0300 Subject: [PATCH] t8n/evm: fix pre-state for forks before verkle Signed-off-by: Ignacio Hagopian --- cmd/evm/internal/t8ntool/execution.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index 01d23052a877..5cd520092741 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -464,15 +464,15 @@ func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prest } } + state.NoBanner() + // Commit db an create a snapshot from it. + mptRoot, err := statedb.Commit(0, false) + if err != nil { + panic(err) + } + // If verkle mode started, establish the conversion if verkle { - state.NoBanner() - // Commit db an create a snapshot from it. - mptRoot, err := statedb.Commit(0, false) - if err != nil { - panic(err) - } - // If the current tree is a VerkleTrie, it means the state conversion has ended. // We don't need to continue with conversion setups and can return early. if _, ok := statedb.GetTrie().(*trie.VerkleTrie); ok { @@ -553,6 +553,11 @@ func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prest if err != nil { panic(err) } + } else { + statedb, err = state.New(mptRoot, sdb, nil) + if err != nil { + panic(err) + } } if statedb.Database().InTransition() || statedb.Database().Transitioned() {