Roy Crihfield
0eba6888c1
* Refactor redundant DB code * Fix storage paths GetState takes a slot, not a leaf path * Add trie_by_cid/state.TryGetNode used in ipld-eth-server * Reorganize packages * direct_by_leaf/ is original StateDB package * sql/ for SQL DB interfaces * Test NodeBlob * Fix node resolution; use Cid struct as key was erroneously storing the cid in the fullNode's flag.cache * Add basic trie tests |
||
---|---|---|
direct_by_leaf | ||
internal | ||
sql | ||
trie_by_cid | ||
.gitignore | ||
go.mod | ||
go.sum | ||
README.md |
ipld-eth-statedb
Implementation of the geth vm.StateDB on top of ipld-eth-db, to allow us to plug into existing EVM functionality. Analogous to ipfs-ethdb but at one database abstraction level higher. This allows us to bypass the trie-traversal access pattern normally used by the EVM (and which ipfs-ethdb allows us to replicate ontop of our Postgres IPLD blockstore in the "public.blocks" table) and access state and storage directly in the "state_cids" and "storage_cids" tables.
Note: "IPFS" is chosen in the name of "ipfs-ethdb" as it can function through an IPFS BlockService abstraction or directly ontop of an IPLD blockstore, whereas this repository is very tightly coupled to the schema in ipld-eth-db.
The top-level package contains the implementation of the vm.StateDB
interface that accesses state directly using the
state_cids
and storage_cids
tables in ipld-eth-db. The trie_by_cid
package contains an alternative implementation
which accesses state in ipld.blocks
through the typical trie traversal access pattern (using CIDs instead of raw
keccak256 hashes), it is used for benchmarking and for functionality which requires performing a trie traversal
(things which must collect intermediate nodes, e.g. eth_getProof
and eth_getSlice
).