-
Notifications
You must be signed in to change notification settings - Fork 242
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
Basic PoT verification #1918
Merged
Merged
Basic PoT verification #1918
Conversation
This file contains 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
… everywhere, simplify proving/verifying API further, fix benches to show real numbers
nazar-pc
requested review from
NingLin-P,
rg3l3dr and
vedhavyas
as code owners
September 1, 2023 13:53
vedhavyas
reviewed
Sep 4, 2023
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.
Make sense 👍🏼
vedhavyas
approved these changes
Sep 4, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Everything except last commit here is still refactoring/preparation.
In the end we have proof and future proof in pre-digest, that is essentially all the client needs to provide right now.
In consensus log items (generated by runtime) we have number of iterations and update of PoT parameters (currently unused and will be used for both entropy injection and update of number of PoT iterations).
There will be seed and checkpoints for efficient verification in justifications later, but that requires paritytech/polkadot-sdk#1211 to function, which is why this PR implements a basic verification that is not relying on justifications and will work, for example, for sync from DSN (in case we do full verification, for probabilistic verification it'll be a different algorithm).
There are many opportunities for optimizations, but they are meant to be internal in verifier, so verifier's API shouldn't change as we do them, which also means those optimizations can be done in parallel.
I was thinking for a while how to track proofs and after numerous iterations we have just two inputs (seed and number of iterations) that are our key (for caching) and value is the number of checkpoints, that is all we need to verify proofs, we don't actually care about "PoT chain" in consensus since we will verify continuity of proofs on every fork of the chain by looking at the parent block.
Locally produced and otherwise pre-verified proofs are added to verifier such that we don't need to do expensive computation for known proofs, for unknown proofs verifier is (will be in the future after some extra optimizations) able to do verification just once and not many times for the proofs it sees for the first time.
The biggest optimization to be done here is to make proof verification in
subspace-proof-of-time
return checkpoints, such that we can cache them for later AND inject block justifications even if they were not gossiped to us initially.Code contributor checklist: