-
Notifications
You must be signed in to change notification settings - Fork 1.6k
ValidationData refactoring #1539
Description
Rephrased more abstractly here:
We currently maintain an invariant that everything that is backed in the relay chain satisfies a number of checks on the commitments of the candidate - that they meet size limits, only send messages on valid channels, etc.
However, it is not clear to me how the validators are meant to check those things off-chain, because there is currently no runtime API that exposes these things. It's also not clear to me how collators are meant to construct blocks that satisfy these limits. I think we want to expose this data from the runtime API, but we don't need to keep it available for secondary checkers because of the invariant I mentioned at the beginning.
I think we should have two main changes to ValidationData with a couple of implied secondary changes.
Main changes:
- Combine
LocalValidationDataandGlobalValidationDatainto a singleValidationDatastruct. - Split
ValidationDataintoPersistedValidationDataandNonPersistedValidationData.
The result would look something like this:
struct ValidationData {
/// Validation data that needs to be persisted for secondary checkers.
///
/// These validation data are generally derived from some relay-chain state to form inputs to
/// the validation function, and as such need to be persisted by the availability system
/// to avoid dependence on availability of the relay-chain state.
persisted: PersistedValidationData,
/// These validation data are derived from some relay-chain state to check outputs of the validation
/// function. Since the commitments of the validation function are checked by the relay-chain,
/// secondary checkers can rely on the invariant that the relay-chain only includes para-blocks
/// for which these checks have already been done. As such, there is no need for this information
/// to be persisted by the availability system. Nevertheless, we expose it so the backing validators
/// can validate the outputs of a candidate before voting to submit it to the relay-chain and so
/// collators can collate candidates that satisfy the criteria implied by this field.
non_persisted: NonPersistedValidationData,
}Secondary changes:
- Combine the
global_validation_dataandlocal_validation_dataruntime APIs - The
validation_data_hashin candidate descriptors should reference only the persisted validation data. - The
AvailableDatastruct should store only the persisted validation data.
These changes encompass both the guide and the code-base.