-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proof Format Qs Thread #65
Comments
Is it correct that For example we could support any
Node hash being -> |
For the base16 modified merkle trie used by parity, each node has up to 16 children. Go It looks like the following would be appended to the The blake2b hashes of the children are then appended. I'm assuming we'd leave a slot for the Node hashes are 32 bytes. Although it has up to 16 children per branch node, it looks like Wouldn't this throw off the padding logic as it indexes based on child size (32 bytes)? |
I don't believe the ProofSpec is limited to 2 children since you can define a custom ordering in the
ICS23 allows you to specify what an empty child node will look like: https://github.com/confio/ics23/blob/b99c94329e/proofs.proto#L186 pinging @ethanfrey to verify my answers and provide details on the prefixing logic |
Yes this is the idea. And there is some logic added in recent PRs that iterate over them. (The fact that the byte order of the children may not represent the lexicographical ordering of their keys is an annoying one and added to try to make things work well for @mappum with merk.rs). I actually wonder if it may be easier to assert this ordering and have merk.rs change the proof format? |
Yeah, that section and the child keys left of the one you are proving are in the Prefix. All child keys right of the one you prove are in the suffix. I took a look at This means the node may be both a leaf and an inner node? Is that true? |
🤦 this is the same sort of over-optimisation that made the Ethereum Patricia Trie un-encodable. They may include a leaf node as one item, but if there are only 2 children on the level above, it will include an inner node and a leaf. ics23 has a relatively simple state non-turing complete machine that was designed to work for a number of cases I found. When there is a bitmap that must be parsed and understood to decipher the following items, then this becomes impossible to represent without custom Go code. I am starting to believe that while most Merkle trees could produce an ics23 compatible proof, they choose not to. There are 2 choices: (1) allow clients to define custom Go code for the state rather than ics23 spec. This will require all counterparties to include this custom code and slow down rollout, but maybe this is worth it. |
Would it make sense to type switch at a higher level over different types of tree structures -> proof types? E.g. generic merkle/verkle etc. Every non generalizable structure could be an additional type switch? For the parity/eth trie impls, maybe the type switching could be done within an extended proof spec with special ops depending on the merkle type? We're looking into adding a verkle tree to the cosmos sdk and are currently doing the following as hack in the meantime. Also, seems like verkle proofs can support both existence/non-existence proofs combined into multiproofs so no need to differentiate between the proof types? |
Looks like the octopus network guys also hitting the same issue with generalizing the hexary patricia merkle trie on the parity side. |
We're currently working on additional IBC light client implementations @ Polymer. Starting a thread here for general questions about the proof format to help us better understand the impl details so we can add addtional proof specs in the future.
The text was updated successfully, but these errors were encountered: