Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Update guide candidate validation module#1264

Merged
rphmeier merged 5 commits intomasterfrom
prgn-candidate-validation
Jun 17, 2020
Merged

Update guide candidate validation module#1264
rphmeier merged 5 commits intomasterfrom
prgn-candidate-validation

Conversation

@coriolinus
Copy link
Contributor

Closes #1233.

@coriolinus coriolinus added A3-in_progress Pull request is in progress. No review needed at this stage. B0-silent Changes should not be mentioned in any release notes labels Jun 15, 2020
@coriolinus coriolinus self-assigned this Jun 15, 2020
@parity-cla-bot
Copy link

It looks like @coriolinus signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

@coriolinus coriolinus marked this pull request as ready for review June 16, 2020 12:54
@coriolinus coriolinus added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Jun 16, 2020
@coriolinus coriolinus requested a review from rphmeier June 16, 2020 12:54
@coriolinus
Copy link
Contributor Author

This is pretty brief, but Candidate Validation isn't all that complicated. There are some TODOs which need to be addressed, but the answers should hopefully be straightforward.

## Functionality

Given a candidate, its validation code, and its PoV, determine whether the candidate is valid. There are a few different situations this code will be called in, and this will lead to variance in where the parameters originate. Determining the parameters is beyond the scope of this subsystem.
Given the hashes of a relay parent and a parachain candidate block, and either its PoV or the information with which to retrieve the PoV from the network, spawn a short-lived async job to determine whether the candidate is valid.
Copy link
Contributor

Choose a reason for hiding this comment

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

The old line said:

Determining the parameters is beyond the scope of this subsystem.

I find this vastly superior to a system where the validation subsystem is responsible for fetching the PoV. The caller will know best where to get the PoV.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know what "determining the parameters" meant, in the old line.

If the caller is responsible for fetching the PoV, then what is this subsystem supposed to do when it receives a CandidateValidationMessage::Validate with PoVOrigin::Network? If it's the caller's responsibility, then we don't need PoVOrigin at all; we can just make the PoV one of Validate's fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's the caller's responsibility, then we don't need PoVOrigin at all; we can just make the PoV one of Validate's fields

Yeah, this is what I'd advocate for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I can make that change.


Each job follows this process:

- on `PoVOrigin::Network`, send a `QueryPoV` request to the [Availability Store](/node/utility/availability-store.html).
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on other review comments, I still think this shouldn't be a thing. But why would this help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps I'm confused, but my understanding is that:

  • in order to validate a parachain block, you need two ingredients: the block itself, and its PoV
  • this subsystem has ultimate responsibility for validating parachain blocks

In other words, it's a caller-friendliness thing: if the caller already has the PoV, it can embed that in PoVOrigin. If it just has the CandidateReceipt, then this module will handle the fetch. The assumption is that we may want to validate candidates from more than one different subsystem, given only the CandidateReceipt; by giving Candidate Validation the responsibility to get the PoV in that case, we avoid duplicating that code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right. The availability store is not networked, though. It just stores data. So if you don't already have all the pieces you'd need, then it couldn't return the candidate.

The availability fetching subsystem hasn't been described yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's my misunderstanding about the nature of the availability store, then. ac6fabe contains a brief sketch of what candidate fetch might look like.

- Get the full candidate from the current relay chain state
- Check the candidate's proof
> TODO: that's extremely hand-wavey. What does that actually entail?
- Generate either `Statement::Valid` or `Statement::Invalid`. Note that this never generates `Statement::Seconded`; Candidate Backing is the only subsystem which upgrades valid to seconded.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to return true/false or Valid/Invalid on the channel as opposed to the Statement type which can included Seconded - doesn't make sense here.

@rphmeier rphmeier merged commit ef01f47 into master Jun 17, 2020
@rphmeier rphmeier deleted the prgn-candidate-validation branch June 17, 2020 18:37
@rphmeier
Copy link
Contributor

(I merged and combined with #1270 )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guide: Candidate Validation

3 participants