-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Create a Basic Proving Trie for the Runtime #3881
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
Merged
shawntabrizi
merged 34 commits into
paritytech:master
from
shawntabrizi:shawntabrizi-proving-trie
Sep 4, 2024
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
d50d5e4
initial ideas
shawntabrizi 7f4422e
Update proving_trie.rs
shawntabrizi bdc0c84
create trait
shawntabrizi da385ab
use trait
shawntabrizi 6ab4bfb
clean up trait and basic trie further
shawntabrizi 1cfb29f
use trait in session historical
shawntabrizi 3080c7b
fix api, add basic end to end test
shawntabrizi 39b0fca
fix test
shawntabrizi 599f576
Revert "use trait in session historical"
shawntabrizi a1c8886
Merge branch 'master' into shawntabrizi-proving-trie
shawntabrizi 6bde2a3
Merge branch 'master' into shawntabrizi-proving-trie
Ank4n ead7951
Update substrate/primitives/runtime/src/proving_trie.rs
shawntabrizi 0cac048
Merge branch 'master' into shawntabrizi-proving-trie
shawntabrizi acfe734
fix some feedback
shawntabrizi 45f4287
update name
shawntabrizi efbe1c9
docs and multi value proof
shawntabrizi cfa62ce
improve test
shawntabrizi 885fd94
add multi-value query test
shawntabrizi 18a5c2e
Merge branch 'master' into shawntabrizi-proving-trie
shawntabrizi 5e3e518
Create pr_3881.prdoc
shawntabrizi f35cacc
Merge branch 'shawntabrizi-proving-trie' of https://github.com/shawnt…
shawntabrizi e6c3759
use v1
shawntabrizi 89679c3
Merge branch 'master' into shawntabrizi-proving-trie
shawntabrizi 6e853ba
Merge branch 'master' into shawntabrizi-proving-trie
shawntabrizi 00a7aa9
Merge remote-tracking branch 'upstream/master' into shawntabrizi-prov…
shawntabrizi ffbd656
use compact trie apis
shawntabrizi 0217d0f
Update proving_trie.rs
shawntabrizi f20038a
more docs
shawntabrizi f934d8d
bad data test
shawntabrizi c92bd6a
Merge branch 'master' into shawntabrizi-proving-trie
shawntabrizi 266a89b
additional warnings about layout
shawntabrizi 3034aab
Update prdoc/pr_3881.prdoc
shawntabrizi 1ceab64
remove lifetime
shawntabrizi c426a65
remove unused
shawntabrizi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 | ||
| # See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json | ||
|
|
||
| title: Introduce a Generic Proving Trie | ||
|
|
||
| doc: | ||
| - audience: Runtime Dev | ||
| description: | | ||
| This PR introduces a Proving Trie object which can be used inside the runtime. This can allow | ||
| for things like airdrops where a single hash is stored on chain representing the whole airdrop | ||
| and individuals present a proof of their inclusion in the airdrop. | ||
|
|
||
| crates: | ||
| - name: sp-runtime | ||
| bump: major |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not too sure if it should be part of sp-runtime crate.
Thing is the choice of using this trie should not be a default for any runtime (I think it is not the best tree for most use case, and I would encourage more binary trie, anyway it is very use case specific).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a binary trie available in Substrate?
Does this trie work along side child tries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the proof is to be run on child trie, there is no choice but to use this trie indeed.
(if using child trie root to prove, please be careful the chain will not be switching from trie V0 to trie V1 (should not matter for crowdloan as iirc the values are <= 32 byte), as a migration may change child trie root.
About this trie version, the simpliest would probably be to just pass the version in parameter.
When I read the PR I did not have this use case in mind but it is true that if what we are proving is from substrate state, then it could make sense to have this in runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I name this
ProvingTrieBase16, and that would be better?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not too sure anymore what was my point 🤦
Probably at first reading I was thinking it should be an external crate, then realizing it is being tightly linked with substrate state could actually be fine.
ProvingTrieBase16may not be a good idea as long as substrate does have a single trie backend.Maybe it could simple be a module in sp-trie, but guess I am ok with things being this way.