Skip to content

Commit

Permalink
t8n/evm: fix pre-state for forks before verkle
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Aug 9, 2024
1 parent 47addd7 commit 93ad9d7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 93ad9d7

Please sign in to comment.