Skip to content

Commit 7b378ba

Browse files
committed
trie, core/state: add the transition tree
1 parent f692f25 commit 7b378ba

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

core/state/reader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ func newTrieReader(root common.Hash, db *triedb.Database, cache *utils.PointCach
253253
if err != nil {
254254
return nil, err
255255
}
256-
tr = trie.NewTransitionTree(mpt.(*trie.SecureTrie), tr.(*trie.VerkleTrie), false), nil
256+
tr = trie.NewTransitionTree(mpt, tr.(*trie.VerkleTrie), false)
257257
}
258258
}
259259
if err != nil {

trie/transition.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ func (t *TransitionTrie) GetAccount(address common.Address) (*types.StateAccount
8686
return nil, err
8787
}
8888
if data != nil {
89-
if t.overlay.db.HasStorageRootConversion(address) {
90-
data.Root = t.overlay.db.StorageRootConversion(address)
91-
}
9289
return data, nil
9390
}
9491
return t.base.GetAccount(address)
@@ -112,9 +109,9 @@ func (t *TransitionTrie) UpdateStorage(address common.Address, key []byte, value
112109

113110
// UpdateAccount abstract an account write to the trie.
114111
func (t *TransitionTrie) UpdateAccount(addr common.Address, account *types.StateAccount, codeLen int) error {
115-
if account.Root != (common.Hash{}) && account.Root != types.EmptyRootHash {
116-
t.overlay.db.SetStorageRootConversion(addr, account.Root)
117-
}
112+
// NOTE: before the rebase, this was saving the state root, so that OpenStorageTrie
113+
// could still work during a replay. This is no longer needed, as OpenStorageTrie
114+
// only needs to know what the account trie does now.
118115
return t.overlay.UpdateAccount(addr, account, codeLen)
119116
}
120117

@@ -195,3 +192,8 @@ func (t *TransitionTrie) Copy() *TransitionTrie {
195192
func (t *TransitionTrie) UpdateContractCode(addr common.Address, codeHash common.Hash, code []byte) error {
196193
return t.overlay.UpdateContractCode(addr, codeHash, code)
197194
}
195+
196+
// Witness returns a set containing all trie nodes that have been accessed.
197+
func (t *TransitionTrie) Witness() map[string]struct{} {
198+
panic("not implemented")
199+
}

0 commit comments

Comments
 (0)