-
Notifications
You must be signed in to change notification settings - Fork 0
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
Node deletion sometimes infeasible in multiproofs #6
Comments
Yup, this is an tricky corner case of updating the state root (I ran into it while building Beam Sync). The solution we had is that when building the proof for a block, to add the trie nodes accessed during the process of building the final state root. (For example, Branch B here) |
Ok thanks that's helpful. I'll see if there is a good way to map that solution to this problem One idea is that for all keys that have inclusion proof that becomes an exclusion proof, include Current processWhen assembling the proof for block
Possible processWhen assembling the proof for block
flowchart TD
A[some traversal in block n...] --> B[extension 'abc12345'] --> D[branch B]
B -.-> E[deleted key exclusion proof for path '...abcdef']
This effectively makes available the preimage for the sibling node extension '2345'. flowchart TD
A[traversal in multiproof from block n - 1 being updated...] --> B[extension 'abc'] --> F[branch A]
F --item 1--> C[*Now known* extension '2345'] --> D[branch B]
F --item d--> E[leaf being deleted with path '...abcdef']
Potentially some different tree structure scenarios to think about and check to see if this |
Patterns explored and cases that require knowledge of a node where only the
In a trio (grandparent-parent-sibling):
Diagrams: 22c9a1e |
Erratum: When the sibling is a leaf this also requires knowledge of that node. This is because the leaf path (part of the node) will be edited to include the path nibble that was part of the deleted parent. |
The process of fetching nodes from the subsequent block appears infeasible in some cases, as follows: Before:
After:
The sibling leaf node is required for editing in order to add to its path. The method to call Conclusion
|
Have not given this extensive thought, but I think there is another option: Algorithm:
|
Problem
When executing a block using proof-based state data:
Explanation
There appears to be insufficient information to construct post-block state root.
There are situations where a key is being removed from the trie during block execution. When a leaf node is
one of two children of a branch node, that branch node is now not required.
It can be seen that branch A would only have one child if the leaf were removed.
The updated trie needs:
However, the trie is represented as a merkle multiproof, either for
Nodes not accessed during block execution, such as branch A and extension '2345' are not present.
Here is what is present:
So it is not possible to know the contents of extension '2345' (perhaps it is '2', or '23456'). Hence
the two extensions cannot be combined. This prevents hashes from being known all the way back to the root.
Impact
One could execute a block without trusting a third party, but verification of the post-block state root would not be possible locally.
As blocks are deterministic this represents a loss of a nice sanity check for correct local block execution.
However the results of the EVM execution (full block trace) can still be obtained completely.
The text was updated successfully, but these errors were encountered: