Skip to content

Commit

Permalink
fix dumpRawTrieDescendants
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Dec 14, 2023
1 parent f223dcd commit 1e2855b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
13 changes: 0 additions & 13 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ type Database interface {
// OpenStorageTrie opens the storage trie of an account.
OpenStorageTrie(stateRoot common.Hash, address common.Address, root common.Hash) (Trie, error)

// OpenStorageTrieWithAddrHash opens the storage trie of an account
OpenStorageTrieWithAddrHash(stateRoot common.Hash, addrHash common.Hash, root common.Hash) (Trie, error)

// CopyTrie returns an independent copy of the given trie.
CopyTrie(Trie) Trie

Expand Down Expand Up @@ -191,16 +188,6 @@ func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Addre
return tr, nil
}

// OpenStorageTrieWithAddrHash opens the storage trie of an account.
// arbitrum: the method is readded to not require address which is not available in pruner dumpRawTrieDescendants
func (db *cachingDB) OpenStorageTrieWithAddrHash(stateRoot common.Hash, addrHash common.Hash, root common.Hash) (Trie, error) {
tr, err := trie.NewStateTrie(trie.StorageTrieID(stateRoot, addrHash, root), db.triedb)
if err != nil {
return nil, err
}
return tr, nil
}

// CopyTrie returns an independent copy of the given trie.
func (db *cachingDB) CopyTrie(t Trie) Trie {
switch t := t.(type) {
Expand Down
2 changes: 1 addition & 1 deletion core/state/pruner/pruner.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func dumpRawTrieDescendants(db ethdb.Database, root common.Hash, output *stateBl
output.Put(data.CodeHash, nil)
}
if data.Root != (common.Hash{}) {
storageTr, err := sdb.OpenStorageTrieWithAddrHash(key, common.BytesToHash(accountIt.LeafKey()), data.Root)
storageTr, err := trie.NewStateTrie(trie.StorageTrieID(root, key, data.Root), sdb.TrieDB())
if err != nil {
return err
}
Expand Down
4 changes: 0 additions & 4 deletions light/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ func (db *odrDatabase) OpenStorageTrie(stateRoot common.Hash, address common.Add
return &odrTrie{db: db, id: StorageTrieID(db.id, address, root)}, nil
}

func (db *odrDatabase) OpenStorageTrieWithAddrHash(stateRoot common.Hash, addrHash common.Hash, root common.Hash) (state.Trie, error) {
return nil, errors.New("OpenStorageTrieWithAddrHash is not implemented for odrDatabase")
}

func (db *odrDatabase) CopyTrie(t state.Trie) state.Trie {
switch t := t.(type) {
case *odrTrie:
Expand Down

0 comments on commit 1e2855b

Please sign in to comment.