-
Notifications
You must be signed in to change notification settings - Fork 68
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
Compact Trie Proof format #56
Conversation
Correct me if I'm wrong: right now, the existing compact proof format is used for:
So if we modify the format, these are the things that would break/change. |
Only warp sync uses it (I mean not the current light client rpc). But we can probably version the protobuf schema somehow.
Yes, changing the compact proof in cumulus would still required collator to update their client to create a pov compatible with the new pvf (this can be tricky but we did it in the past when adding the first compact proof format), but on the verification side all decoding is in the pvf. |
For what it's worth, my immediate reaction to reading the draft is: I have no idea what to think of this, it's really too complicated and too big of a leap for me to figure out what the advantages and drawbacks of this format are. |
Psp may go a bit too far. Sequence of instruction:
So it is mostly description of proof content, ordered by trie node iteration. One discutable point is that value is written when node get accessed, and hashes are only written when node get out of scope. I will try to write the decoding in a recursive pseudo-code form later (which may be clearer than the stack based algorithm describe here). |
This PSP has quite a bit of typos and it's quite hard to follow. Imo, once you officially decide to use your I'll leave this open, but it probably needs to be written differently in the future. |
Small note about writing the child hash when poping node and child value after push: it allows saving a key push operation when there is no values.
so I am closing and will open it again when I got branch rewritten and this written in a simpler way. |
I currently make it a draft as it is something that seems good to switch to to me but is not strictly needed, and current .
It comes form conversation I had with @tomaka, and the realization that the current compact proof format can be a bit awkward.
So opening this is for initial feedbacks.
The design is largely inspired by turbogeth one but without the useless instructions and taking in consideration the possibility to have a sequence of compact proof.
(proto implement the eth variant but I don't want to describe them, just mentionning it is not incompatible).
So I create this PR to start discussion here.
Some part are undefined. More notably all the codec question as it is rather boring things that needs to be defined depending on frequency of nodes and other consideration but can be completed in a second step: my proto just use scale codec instead.
The intention would be to replace all existing Compact proof usage and extend to light client rpc too.
The algorithm here is mostly the decoding one, the algorithm for building can also be added, but it can be inferred from the decoding one, and the current implementation is a bit related to parity trie crate node iterator internals.