Roy Crihfield
761d60acdf
The Geth `core/state` and `trie` packages underwent a big refactor between `v1.11.6` and `1.13.14`. This code, which was adapted from those, needed corresponding updates. To do this I applied the diff patches from Geth directly where possible and in some places had to clone new parts of the Geth code and adapt them. In order to make this process as straightforward as possible in the future, I've attempted to minimize the number of changes vs. Geth and added some documentation in the `trie_by_cid` package. Reviewed-on: #5 |
||
---|---|---|
.github/workflows | ||
direct_by_leaf | ||
internal | ||
sql | ||
test | ||
trie_by_cid | ||
.gitignore | ||
go.mod | ||
go.sum | ||
README.md |
ipld-eth-statedb
This contains multiple implementations of the geth vm.StateDB and supporting types for different use cases.
Package direct_by_leaf
A read-only implementation which uses the schema defined in ipld-eth-db, to allow direct querying by state and storage node leaf key, bypassing the trie-traversal access pattern normally used by the EVM. This operates at one abstraction level higher than ipfs-ethdb, and is suitable for providing fast state reads.
Package trie_by_cid
A read-write implementation which uses a Postgres IPLD v0 Blockstore as the backing ethdb.Database
. Specifically this passes v1 CIDs of Keccak-256 hashes to the database in place of plain hashes, and can be used in combination with a ipfs-ethdb/postgres/v0 Database
instance, or an IPLD BlockService providing a v0 Blockstore.
This implementation uses trie traversal to access state, and is capable of computing state root hashes and performing full EVM operations. It's also suitable for scenarios requiring trie traversal and access to intermediate state nodes (e.g. eth_getProof
and eth_getSlice
on ipld-eth-server).