Skip to content
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

Allow child-trie-friendly proofs #680

Merged
merged 6 commits into from
Jun 7, 2023

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Jun 6, 2023

cc #166

At the moment, when decoding a proof, it is assumed that this proof only contains one trie, and the user is required to pass the expected trie root hash.

However, in the context of child tries, a proof can contain entries from multiple different tries (the main trie and child tries).

Normally, these tries are connected in the sense that the value of a main trie node starting with :child_storage:default: is equal to the root of another trie. However, I prefer to not put this assumption in the proof-related code.
Instead, I've adjusted the code to allow multiple different tries within the same proof, without checking whether these tries are connected to each other.

In terms of API changes, the API user no longer passes the expected trie root hash when decoding the proof, but instead passes the trie root hash whenever the proof is accessed. If the proof doesn't contain the requested trie, then None is returned, indicating an incomplete proof.

@tomaka tomaka enabled auto-merge June 7, 2023 06:42
@tomaka tomaka added this pull request to the merge queue Jun 7, 2023
Merged via the queue into smol-dot:main with commit 5dfc3ed Jun 7, 2023
@tomaka tomaka deleted the child-trie-friendly-proofs branch June 7, 2023 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant