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

PVF validation host: pull not push PVFs #973

Open
pepyakin opened this issue Apr 9, 2021 · 5 comments · May be fixed by paritytech/polkadot#3655
Open

PVF validation host: pull not push PVFs #973

pepyakin opened this issue Apr 9, 2021 · 5 comments · May be fixed by paritytech/polkadot#3655
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task.

Comments

@pepyakin
Copy link
Contributor

pepyakin commented Apr 9, 2021

Currently candidate validation pushes PVF preimages to the candidate validation host. This is non-ideal, because PVF validation host caches compiled PVFs and does not need the original code blobs.

To fix this we should update PVF validation host so that it accepts not only raw PVFs but also PVF code hashes. In case of a cache miss, the PVF validation host should request the validation code preimage from candidate-validation.

It seems we cannot completely get rid of the mode where PVFs are passed directly as preimages. For example, for disputes, the subsystem that initiates candidate validation will have the validation code at hand, however, there is no guarantee the code can be found on the chain. In this case, it is just more convenient to pass the validation code directly.

@burdges
Copy link

burdges commented Apr 9, 2021

We do not yet move code into availability with this one, right?

for disputes, the subsystem that initiates candidate validation will have the validation code at hand, however, there is no guarantee the code can be found on the chain. In this case, it is just more convenient to pass the validation code directly.

This is true, but if we do code via availability then we could guarantee code can be found. As disputes retrigger availability for the candidate, then could also retrigger availability for the code. We expect both to already be availability so this usually resolves with a vote.

I'm not sure about the best intermediate steps to take to reach this however.


I previously suggested conceptualizing the code going into availability like a special parachain block, which although not essential, likely simplifies both code an analysis. In particular, anyone reconstructing code from erasure coding must recompute all pieces to check the merkle root, otherwise someone could hide two different PVFs inside the same erasure coded data.

If we do so, then we need the disputing validators to either retain this block or be able to recreate it. As long as this special block is a thin wrapper around the compressed code without extra tx garbage then this creates no problems.

Another route would be abstrating the availability system somehow to handle non-blocks. I donno..

@burdges
Copy link

burdges commented Apr 9, 2021

Also @rphmeier we discussed whether approval checkers should reconstruct and build these special thin code blocks. You convinced me approval checkers need not build the code, since if the code is invalid then every candidate becomes invalid, but we do still need approval checkers to check the erasure code reconstruction, or else someone can hide two different PVFs in the same erasure code data.

@pepyakin
Copy link
Contributor Author

pepyakin commented Apr 9, 2021

We do not yet move code into availability with this one, right?

Yes. In fact, I see this issue as a rather tactical change rather than strategical.

@eskimor
Copy link
Member

eskimor commented Nov 26, 2021

It seems we cannot completely get rid of the mode where PVFs are passed directly as preimages. For example, for disputes, the subsystem that initiates candidate validation will have the validation code at hand, however, there is no guarantee the code can be found on the chain. In this case, it is just more convenient to pass the validation code directly.

I think we can and should. For disputes we always query the chain for the PVF, so we very much rely on the PVF being on chain - and it will be, otherwise it won't be a valid dispute. If we want to be able to dispute non included candidates in the future, the mechanism for doing that will be quite different and we can just make sure to have the PVF when the validation host requests them, after we passed the hash.

I would very much like to avoid the added complexity of supporting both push and pull mechanisms.

@pepyakin
Copy link
Contributor Author

Agreed and good call.

I think this just got here because of lack of full grasp of the system at the moment of writing.

@Sophia-Gold Sophia-Gold transferred this issue from paritytech/polkadot Aug 24, 2023
@the-right-joyce the-right-joyce added I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. and removed I10-optimisation labels Aug 25, 2023
@the-right-joyce the-right-joyce moved this to In Progress in parachains team board Oct 18, 2023
claravanstaden added a commit to Snowfork/polkadot-sdk that referenced this issue Dec 8, 2023
* fmt

* revert

* revert

---------

Co-authored-by: claravanstaden <Cats 4 life!>
helin6 pushed a commit to boolnetwork/polkadot-sdk that referenced this issue Feb 5, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Mar 26, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Mar 27, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants