trie, core/state: add the transition tree

This commit is contained in:
Guillaume Ballet 2025-08-07 17:31:40 +02:00
parent f692f252c0
commit 7b378bab39
2 changed files with 9 additions and 7 deletions

View file

@ -253,7 +253,7 @@ func newTrieReader(root common.Hash, db *triedb.Database, cache *utils.PointCach
if err != nil { if err != nil {
return nil, err return nil, err
} }
tr = trie.NewTransitionTree(mpt.(*trie.SecureTrie), tr.(*trie.VerkleTrie), false), nil tr = trie.NewTransitionTree(mpt, tr.(*trie.VerkleTrie), false)
} }
} }
if err != nil { if err != nil {

View file

@ -86,9 +86,6 @@ func (t *TransitionTrie) GetAccount(address common.Address) (*types.StateAccount
return nil, err return nil, err
} }
if data != nil { if data != nil {
if t.overlay.db.HasStorageRootConversion(address) {
data.Root = t.overlay.db.StorageRootConversion(address)
}
return data, nil return data, nil
} }
return t.base.GetAccount(address) return t.base.GetAccount(address)
@ -112,9 +109,9 @@ func (t *TransitionTrie) UpdateStorage(address common.Address, key []byte, value
// UpdateAccount abstract an account write to the trie. // UpdateAccount abstract an account write to the trie.
func (t *TransitionTrie) UpdateAccount(addr common.Address, account *types.StateAccount, codeLen int) error { func (t *TransitionTrie) UpdateAccount(addr common.Address, account *types.StateAccount, codeLen int) error {
if account.Root != (common.Hash{}) && account.Root != types.EmptyRootHash { // NOTE: before the rebase, this was saving the state root, so that OpenStorageTrie
t.overlay.db.SetStorageRootConversion(addr, account.Root) // could still work during a replay. This is no longer needed, as OpenStorageTrie
} // only needs to know what the account trie does now.
return t.overlay.UpdateAccount(addr, account, codeLen) return t.overlay.UpdateAccount(addr, account, codeLen)
} }
@ -195,3 +192,8 @@ func (t *TransitionTrie) Copy() *TransitionTrie {
func (t *TransitionTrie) UpdateContractCode(addr common.Address, codeHash common.Hash, code []byte) error { func (t *TransitionTrie) UpdateContractCode(addr common.Address, codeHash common.Hash, code []byte) error {
return t.overlay.UpdateContractCode(addr, codeHash, code) return t.overlay.UpdateContractCode(addr, codeHash, code)
} }
// Witness returns a set containing all trie nodes that have been accessed.
func (t *TransitionTrie) Witness() map[string]struct{} {
panic("not implemented")
}