Skip to content

Commit

Permalink
merge redundant conversion base tree hash vars (#450)
Browse files Browse the repository at this point in the history
* merge redundant conversion base tree hash vars

* remove extra traces

* revert new var assignment
  • Loading branch information
gballet authored Jun 17, 2024
1 parent a586f0d commit 4133497
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ type cachingDB struct {

// Transition-specific fields
// TODO ensure that this info is in the DB
LastMerkleRoot common.Hash // root hash of the read-only base tree
CurrentTransitionState *TransitionState
TransitionStatePerRoot lru.BasicLRU[common.Hash, *TransitionState]
transitionStateLock sync.Mutex
Expand Down Expand Up @@ -415,8 +414,8 @@ func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Addre
}
}
if db.InTransition() {
fmt.Printf("OpenStorageTrie during transition, state root=%x root=%x\n", stateRoot, root)
mpt, err := db.openStorageMPTrie(db.LastMerkleRoot, address, root, nil)
log.Info("OpenStorageTrie during transition", "state root", stateRoot, "root", root)
mpt, err := db.openStorageMPTrie(db.baseRoot, address, root, nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -548,7 +547,7 @@ func (db *cachingDB) AddRootTranslation(originalRoot, translatedRoot common.Hash
}

func (db *cachingDB) SetLastMerkleRoot(merkleRoot common.Hash) {
db.LastMerkleRoot = merkleRoot
db.baseRoot = merkleRoot
}

func (db *cachingDB) SaveTransitionState(root common.Hash) {
Expand Down

0 comments on commit 4133497

Please sign in to comment.