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

Basic PoT verification #1918

Merged
merged 7 commits into from
Sep 4, 2023
Merged

Basic PoT verification #1918

merged 7 commits into from
Sep 4, 2023

Conversation

nazar-pc
Copy link
Member

@nazar-pc nazar-pc commented Sep 1, 2023

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:

Copy link
Contributor

@vedhavyas vedhavyas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense 👍🏼

crates/sc-proof-of-time/src/source.rs Outdated Show resolved Hide resolved
crates/sc-proof-of-time/src/verifier.rs Outdated Show resolved Hide resolved
crates/sc-proof-of-time/src/verifier.rs Outdated Show resolved Hide resolved
crates/sc-proof-of-time/src/source.rs Show resolved Hide resolved
@nazar-pc nazar-pc merged commit 960369b into main Sep 4, 2023
9 checks passed
@nazar-pc nazar-pc deleted the basic-pot-verification branch September 4, 2023 15:26
@nazar-pc nazar-pc mentioned this pull request Apr 15, 2024
1 task
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.

2 participants