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

Make ProvingTrie Generic and Reusable #3880

Closed
2 tasks done
shawntabrizi opened this issue Mar 28, 2024 · 1 comment · Fixed by #3881
Closed
2 tasks done

Make ProvingTrie Generic and Reusable #3880

shawntabrizi opened this issue Mar 28, 2024 · 1 comment · Fixed by #3881
Labels
I5-enhancement An additional feature request. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@shawntabrizi
Copy link
Member

shawntabrizi commented Mar 28, 2024

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

I was looking at ways to implement simple merkle proofs within a pallet, and it seems that pallet_session::historical has this ability with the ProvingTrie.

However, the full definition for this type is within the pallet crate, and thus the simple idea of creating and using a merkle trie and proof is not available to other pallets without fully reimplementing the type.

Request

Create a generic and reusable version of the ProvingTrie which is made available by the Polkadot-SDK

Solution

Take the existing ProvingTrie, and make it generic over the data being proved.

Are you willing to help with this request?

Yes!

@shawntabrizi shawntabrizi added the I5-enhancement An additional feature request. label Mar 28, 2024
@github-actions github-actions bot added the I10-unconfirmed Issue might be valid, but it's not yet known. label Mar 28, 2024
@shawntabrizi
Copy link
Member Author

going to try this quickly

github-merge-queue bot pushed a commit that referenced this issue Sep 4, 2024
This PR will introduce a `BasicProvingTrie` type, which makes it easy to
construct and prove data in a base-16 merkle trie within the runtime.

Data into the merkle trie only require that they implement `Encode` /
`Decode`.

A FRAME compatible `TrieError` was created and added to `DispatchError`.

Expected usage is to construct the merkle trie with all data offline,
and then place only the merkle root of that trie on-chain.

Also offchain, a user is given a compact merkle proof of some data they
want to prove exists on the blockchain.

Then in the runtime, you can call `verify_single_value_proof` or
`verify_proof` with the root, proof, and the keys and values you want to
verify exists in the merkle trie.

Closes #3880

Contributes to #5400

---------

Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant