-
Notifications
You must be signed in to change notification settings - Fork 144
Description
Issue Summary
From design doc:
The following
StorageState
methods are relatively easy to implement in the translation shim by utilizingdb.Backend
.
internal/client/db/backend.go
GetStorage(root *common.Hash, key []byte) ([]byte, error)
GetStorageByBlockHash(bhash *common.Hash, key []byte) ([]byte, error)
GetKeysWithPrefix(root *common.Hash, prefix []byte) ([][]byte, error)
GetStorageChild(root *common.Hash, keyToChild []byte) (trie.Trie, error)
GetStorageFromChild(root *common.Hash, keyToChild, key []byte) ([]byte, error)
GetStateRootFromBlock(bhash *common.Hash) (*common.Hash, error)
StorageRoot() (common.Hash, error)
Entries(root *common.Hash) (map[string][]byte, error)
LoadCode(hash *common.Hash) ([]byte, error)
LoadCodeHash(hash *common.Hash) (common.Hash, error)
GetStorageXXX
methods are easily accessible by translating and implementing theStorageProvider
trait forClient
internal/client/client.go
GetStateRootFromBlock
can be retrieved from already introducedHeaderBackend
interface whichdb.Backend
implements. Same forStorageRoot
.
Entries
should be refactored to utilize an iterator whereEntries
is called. I propose refactoring this method to return aPairsIter
which iterates through the keys and values.
LoadCode
andLoadCodeHash
should be trivially implemented by accessing the state trie for a given hash and retrieving the entry with key ":code".
Acceptance Criteria
- Introduce
StorageProvider
interface and implement it - Implement
GetXXX
methods - Implement
StorageRoot
method Revise(removed from scope)Entries
function call to return iterator.Update all references toEntries
to use iterator.- Implement
LoadCode
andLoadCodeHash
. - Unit tests.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status