confio / proofs-ethereum

Convert ethereum trie proofs into confio/proofs format
GNU General Public License v3.0
0 stars 0 forks source link

Convert to confio/proofs format #3

Open ethanfrey opened 5 years ago

ethanfrey commented 5 years ago

Build something like convert.go and convert_test.go in https://github.com/confio/proofs-iavl. This builds on knowledge of how ethereum proofs work and valid proofs (#2). Then we convert it. Proofs must be considered valid. And we can clamp down on a LeafSpec for Ethereum Trie as well

ethanfrey commented 5 years ago

Given we have a function that can take key, value []byte, path []node, rootHash common.Hash and validate it, and that this is the same basic info as ExistenceProof, let us make a transformation that takes this info and converts it into the confio/proofs format, using the knowledge from #2 on the exact validation algorithm

ethanfrey commented 5 years ago

This seems to be impossible to do in a generic way.

The trie doesn't encode a (key, value) pair in the leaf, but rather only the value. The key must be extracted from the path in a very painstaking manner, extremely tied to many ethereum-specific data structures.

I would have a hard time doing this in go without using GPL go-ethereum code. A much, much harder time (if at all possible) in a generic format that is not designed specifically for the patricia trie, but should work with many merkle proofs