Skip to content

Commit

Permalink
fix: assume that having to create a new transaction state mean it has…
Browse files Browse the repository at this point in the history
…n't happened.

This is a workaround, because it will always be false when restarting a node
that has started the transition but not necessarily completed it.
  • Loading branch information
gballet committed Mar 26, 2024
1 parent 1784337 commit ff36168
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
2 changes: 0 additions & 2 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1767,8 +1767,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
// is the fork block and that the conversion needs to be marked at started.
if !bc.stateCache.InTransition() && !bc.stateCache.Transitioned() {
bc.stateCache.StartVerkleTransition(parent.Root, emptyVerkleRoot, bc.Config(), bc.Config().PragueTime, parent.Root)
} else {
log.Debug("skipped initialization")
}
}
if parent.Number.Uint64() == conversionBlock {
Expand Down
6 changes: 1 addition & 5 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package state
import (
"errors"
"fmt"
"runtime/debug"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/lru"
Expand Down Expand Up @@ -238,7 +237,6 @@ func (db *cachingDB) StartVerkleTransition(originalRoot, translatedRoot common.H
if pragueTime != nil {
chainConfig.PragueTime = pragueTime
}
debug.PrintStack()
}

func (db *cachingDB) ReorgThroughVerkleTransition() {
Expand Down Expand Up @@ -357,7 +355,6 @@ func (db *cachingDB) OpenTrie(root common.Hash) (Trie, error) {
// If the verkle conversion has ended, return a single
// verkle trie.
if db.CurrentTransitionState.ended {
debug.PrintStack()
log.Debug("transition ended, returning a simple verkle tree")
return vkt, nil
}
Expand Down Expand Up @@ -570,9 +567,8 @@ func (db *cachingDB) LoadTransitionState(root common.Hash) {
ts, ok := db.TransitionStatePerRoot[root]
if !ok || ts == nil {
log.Debug("could not find any transition state, starting with a fresh state", "is verkle", db.triedb.IsVerkle())
debug.PrintStack()
// Start with a fresh state
ts = &TransitionState{ended: db.triedb.IsVerkle()}
ts = &TransitionState{ended: false}
}

// Copy so that the CurrentAddress pointer in the map
Expand Down
4 changes: 0 additions & 4 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,6 @@ func (api *ConsensusAPI) newPayload(params engine.ExecutableData, versionedHashe
api.eth.BlockChain().StartVerkleTransition(parent.Root, common.Hash{}, api.eth.BlockChain().Config(), nil, parent.Root)
}
}
// // Reset db merge state in case of a reorg
// if !api.eth.BlockChain().Config().IsPrague(block.Number(), block.Time()) {
// api.eth.BlockChain().ReorgThroughVerkleTransition()
// }
// Another cornercase: if the node is in snap sync mode, but the CL client
// tries to make it import a block. That should be denied as pushing something
// into the database directly will conflict with the assumptions of snap sync
Expand Down

0 comments on commit ff36168

Please sign in to comment.